Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
4baf3c7
run migrate-to-uv and update failing test
DocOtak Sep 30, 2025
1971710
use uvx for ruff cf
DocOtak Sep 30, 2025
082a4e9
include minimum python version in .python-version file
DocOtak Sep 30, 2025
035933e
update ct build step to use uv
DocOtak Sep 30, 2025
e88369d
activate uv venv in build ci
DocOtak Sep 30, 2025
5577f2e
use lowest-direct resolution strategy
DocOtak Oct 1, 2025
08dab9f
switch ci test to uv
DocOtak Oct 1, 2025
7846908
update gsw min dep to 3.4.2
DocOtak Oct 1, 2025
4e802c8
add python resolution markers to gsw dependency
DocOtak Oct 1, 2025
5035ca4
add netCDF4 dev python version dependency markers
DocOtak Oct 1, 2025
15df252
include python version markers in docs dep group
DocOtak Oct 1, 2025
76fa5c7
actually use the netCDF4 version that supports python 3.13
DocOtak Oct 1, 2025
9e9610a
use uv in readthedocs
DocOtak Oct 1, 2025
7dc5ea6
remove poetry stuff from gitignore and ci.yml
DocOtak Oct 1, 2025
afeddc3
use highest resolution strategy in docs building
DocOtak Oct 1, 2025
8e27af9
update readme with uv specific instructions
DocOtak Oct 1, 2025
24b542b
use uv to publish to pypi (using trust publishing)
DocOtak Oct 1, 2025
cbb7bed
Use uv run with no-sync
rcaneill Oct 1, 2025
d6e9d22
update constraints
Oct 1, 2025
8b20a2f
uv sync without doc
Oct 1, 2025
d5208bc
lock
Oct 1, 2025
7e81f86
rm 3.10 and correct typo
Oct 1, 2025
135369d
constrains pint
Oct 1, 2025
ef65684
no need all docs
Oct 1, 2025
25f69f1
try python3.14 ci
Oct 1, 2025
8394807
install cf_units without wheels
Oct 1, 2025
901eb93
pytest update for 3.14
Oct 1, 2025
29b5e19
install cf_units afterward
Oct 2, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 17 additions & 39 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,70 +17,48 @@ jobs:
fail-fast: false
matrix:
os: ["ubuntu-latest", "macos-latest"]
python-version: ["3.10", "3.11", "3.12", "3.13"]
python-version: ["3.11", "3.12", "3.13", "3.14"]

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
- name: Set up latest uv and Python ${{ matrix.python-version }}
uses: astral-sh/setup-uv@v6
with:
python-version: ${{ matrix.python-version }}
activate-environment: true
- name: Install / build
run: |
python -m pip install --upgrade pip
pip install .
uv pip install .

test:
name: test (ubuntu-latest, ${{ matrix.python-version }}, ${{ matrix.pint }} Pint, packages version ${{ matrix.version }})
name: test (ubuntu-latest, ${{ matrix.python-version }}, ${{ matrix.pint }} Pint, packages version ${{ matrix.resolution }})
runs-on: "ubuntu-latest"
env:
poetry_version: 2.1.3
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13"]
python-version: ["3.11", "3.12", "3.13", "3.14"]
pint: ["with", "without"]
version: ["lock"]
include:
- python-version: "3.10"
version: "minimal"
pint: "with"
- python-version: "3.13"
version: "maximal"
pint: "with"
resolution: ["highest", "lowest-direct"]
steps:
- uses: actions/checkout@v4
- name: Install poetry
run: pipx install poetry==${{ env.poetry_version }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
- name: Install uv and Python ${{ matrix.python-version }}
uses: astral-sh/setup-uv@v6
with:
python-version: ${{ matrix.python-version }}
cache: 'poetry'
activate-environment: true
- name: Install udunits
run: sudo apt-get install -y libudunits2-dev
- name: update lock file
if: matrix.version == 'maximal'
run: poetry update
- name: Install dependencies
run: |
poetry install --with dev
poetry run pip install cf_units==3.3.0
uv sync --resolution ${{matrix.resolution}} --no-group docs
- if: matrix.pint == 'with'
name: Install pint and pint-xarray
run: |
poetry install -E pint
- name: use minimal versions for lock file
if: matrix.version == 'minimal'
uv sync --resolution ${{matrix.resolution}} --no-group docs --extra pint
- name: Install cf_units
run: |
cp pyproject.toml pyproject.toml.bak
pipx install uv
uvx migrate-to-uv
uv add --active "toolz>=0.12.0" "appnope>=0.1.0" "decorator>=5.1.1" "python-json-logger>2.0.4" "matplotlib>=3.5.0" "bleach>5.0.0" --frozen
uv lock --resolution lowest
uv pip freeze > requirements.txt
poetry run pip install -r requirements.txt
cp pyproject.toml.bak pyproject.toml
export UDUNITS2_XML_PATH=/usr/share/xml/udunits/udunits2.xml
uv pip install cf_units==3.3.0
- name: Test with pytest
run: |
poetry run pytest gsw_xarray/tests
uv run --no-sync pytest gsw_xarray/tests
17 changes: 11 additions & 6 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,16 @@ on:
- "v*.*.*"
workflow_dispatch:
jobs:
build:
publish:
runs-on: ubuntu-latest
permissions:
id-token: write

steps:
- uses: actions/checkout@v4
- name: Build and publish to pypi
uses: JRubics/poetry-publish@v2.0
with:
pypi_token: ${{ secrets.PYPI_TOKEN }}
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v6
- name: Build Dists
run: uv build
- name: Publish Python distribution to PyPI
run: uv publish
19 changes: 8 additions & 11 deletions .github/workflows/ruff.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Python
uses: actions/setup-python@v5
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
python-version: "3.11"
- name: Install dependencies
enable-cache: true
- name: Lint with ruff
run: |
python -m pip install --upgrade pip
pip install ruff
# Update output format to enable automatic inline annotations.
- name: Run Ruff
run: ruff check --output-format=github .
- name: Run Ruff format
run: ruff format --check .
uvx ruff check --output-format=github .
- name: Test code style with ruff
run: |
uvx ruff format --check .
7 changes: 0 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,6 @@ target/
profile_default/
ipython_config.py

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

Expand Down
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.11
16 changes: 9 additions & 7 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@ build:
tools:
python: "3.12"
jobs:
post_create_environment:
# Install poetry
# https://python-poetry.org/docs/#installing-manually
- pip install poetry
post_install:
# Install dependencies with 'docs' extra
- VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH poetry install --with docs
# https://docs.readthedocs.com/platform/stable/build-customization.html#install-dependencies-with-uv
pre_create_environment:
- asdf plugin add uv
- asdf install uv latest
- asdf global uv latest
create_environment:
- uv venv "${READTHEDOCS_VIRTUALENV_PATH}"
install:
- UV_PROJECT_ENVIRONMENT="${READTHEDOCS_VIRTUALENV_PATH}" uv sync --resolution highest --group docs

sphinx:
configuration: docs/conf.py
13 changes: 6 additions & 7 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -262,31 +262,30 @@ to open an issue in the `GitHub issues page <https://github.com/DocOtak/gsw-xarr
In order to contribute to gsw-xarray, please fork the repository and
submit a pull request. A good step by step tutorial for starting with git can be found in the
`xarray contributor guide <https://xarray.pydata.org/en/stable/contributing.html#working-with-the-code>`_.
A main difference is that we do not use conda as python environment, but poetry.
A main difference is that we do not use conda as python environment, but uv.

Set up the environment
......................

You will first need to `install poetry <https://python-poetry.org/docs/#installation>`_.
You will first need to `install uv <https://docs.astral.sh/uv/getting-started/installation/>`_.
Then go to your local clone of gsw-xarray and launch installation:

.. code:: bash

cd /path/to/your/gsw-xarray
poetry install --with dev
uv sync --all-groups

You can then activate the environment by launching a shell
within the virtual environment:
If desired, you can then activate the environment manually:

.. code:: bash

poetry shell
source .venv/bin/activate

You can check that the tests pass locally:

.. code:: bash

pytest gsw_xarray/tests
uv run pytest gsw_xarray/tests

You can install `pre-commit <https://pre-commit.com/#install>`_ to run the linting
automatically at each commit.
Expand Down
2 changes: 1 addition & 1 deletion gsw_xarray/tests/test_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def test_versions_are_in_sync():

path = Path(__file__).resolve().parents[2] / "pyproject.toml"
pyproject = toml.loads(open(str(path)).read())
pyproject_version = pyproject["tool"]["poetry"]["version"]
pyproject_version = pyproject["project"]["version"]

package_init_version = gsw_xarray.__version__

Expand Down
Loading