Skip to content

Commit 0545d81

Browse files
dcherianclaude
andauthored
Switch to uv (#589)
Co-authored-by: Claude <[email protected]>
1 parent 5609564 commit 0545d81

File tree

10 files changed

+3286
-183
lines changed

10 files changed

+3286
-183
lines changed

.github/workflows/ci.yaml

Lines changed: 34 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -20,55 +20,43 @@ jobs:
2020
build:
2121
name: Build (${{ matrix.python-version }}, ${{ matrix.os }}), ${{ matrix.env }}
2222
runs-on: ${{ matrix.os }}
23-
defaults:
24-
run:
25-
shell: bash -l {0}
2623
strategy:
2724
fail-fast: false
2825
matrix:
2926
os: ["ubuntu-latest"]
3027
python-version: ["3.11", "3.13"]
31-
env: [""]
28+
env: ["test"]
3229
include:
33-
- env: "all-min-deps"
30+
- env: "test-min-deps"
3431
python-version: "3.11"
3532
os: ubuntu-latest
36-
- env: "no-optional-deps"
33+
- env: "test-no-optional"
3734
python-version: "3.13"
3835
os: ubuntu-latest
3936
steps:
4037
- uses: actions/checkout@v5
4138
with:
4239
fetch-depth: 0 # Fetch all history for all branches and tags.
43-
- name: Set environment variables
44-
run: |
45-
echo "PYTHON_VERSION=${{ matrix.python-version }}" >> $GITHUB_ENV
46-
if [[ "${{ matrix.env }}" == "" ]] ;
47-
then
48-
echo "CONDA_ENV_FILE=ci/environment.yml" >> $GITHUB_ENV
49-
fi
50-
if [[ "${{ matrix.env }}" == "no-optional-deps" ]] ;
51-
then
52-
echo "CONDA_ENV_FILE=ci/environment-no-optional-deps.yml" >> $GITHUB_ENV
53-
fi
54-
if [[ "${{ matrix.env }}" == "all-min-deps" ]] ;
55-
then
56-
echo "CONDA_ENV_FILE=ci/environment-all-min-deps.yml" >> $GITHUB_ENV
57-
fi
58-
- name: Set up conda environment
59-
uses: mamba-org/setup-micromamba@v2
40+
41+
- name: Set up Python
42+
uses: actions/setup-python@v5
43+
with:
44+
python-version: ${{ matrix.python-version }}
45+
46+
- name: Install uv
47+
uses: astral-sh/setup-uv@v4
6048
with:
61-
environment-file: ${{ env.CONDA_ENV_FILE }}
62-
environment-name: cf_xarray_test
63-
cache-environment: true
64-
create-args: >-
65-
python=${{ matrix.python-version }}
66-
- name: Install cf_xarray
49+
enable-cache: true
50+
51+
- name: Install dependencies
6752
run: |
68-
python -m pip install --no-deps -e .
53+
uv pip install --system -e .
54+
uv pip install --system --group ${{ matrix.env }}
55+
6956
- name: Run Tests
7057
run: |
7158
pytest -n auto --cov=./ --cov-report=xml
59+
7260
- name: Upload code coverage to Codecov
7361
uses: codecov/[email protected]
7462
with:
@@ -81,33 +69,34 @@ jobs:
8169
mypy:
8270
name: mypy
8371
runs-on: "ubuntu-latest"
84-
defaults:
85-
run:
86-
shell: bash -l {0}
8772
strategy:
8873
matrix:
8974
python-version: ["3.11", "3.13"]
9075
steps:
9176
- uses: actions/checkout@v5
9277
with:
9378
fetch-depth: 0 # Fetch all history for all branches and tags.
94-
- name: Set up conda environment
95-
uses: mamba-org/setup-micromamba@v2
79+
80+
- name: Set up Python
81+
uses: actions/setup-python@v5
9682
with:
97-
environment-file: ci/environment.yml
98-
environment-name: cf_xarray_test
99-
cache-environment: true
100-
create-args: >-
101-
python=${{ matrix.python-version }}
102-
- name: Install cf_xarray
103-
run: |
104-
python -m pip install --no-deps -e .
105-
- name: Install mypy
83+
python-version: ${{ matrix.python-version }}
84+
85+
- name: Install uv
86+
uses: astral-sh/setup-uv@v4
87+
with:
88+
enable-cache: true
89+
90+
- name: Install dependencies
10691
run: |
107-
python -m pip install 'mypy'
92+
uv pip install --system -e .
93+
uv pip install --system --group test
94+
uv pip install --system --group typing
95+
10896
- name: Run mypy
10997
run: |
11098
python -m mypy --install-types --non-interactive --cobertura-xml-report mypy_report cf_xarray/
99+
111100
- name: Upload mypy coverage to Codecov
112101
uses: codecov/[email protected]
113102
with:

.github/workflows/upstream-dev-ci.yaml

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88
branches:
99
- main
1010
schedule:
11-
- cron: "0 0 * * *" # Daily At 00:00 UTC
11+
- cron: "0 0 * * *" # Daily "At 00:00" UTC
1212
workflow_dispatch: # allows you to trigger the workflow run manually
1313

1414
concurrency:
@@ -23,9 +23,6 @@ jobs:
2323
name: upstream-dev
2424
runs-on: ubuntu-latest
2525
if: ${{ (contains( github.event.pull_request.labels.*.name, 'test-upstream') && github.event_name == 'pull_request') || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' }}
26-
defaults:
27-
run:
28-
shell: bash -l {0}
2926
strategy:
3027
fail-fast: false
3128
matrix:
@@ -34,20 +31,20 @@ jobs:
3431
- uses: actions/checkout@v5
3532
with:
3633
fetch-depth: 0 # Fetch all history for all branches and tags.
37-
- name: Set environment variables
38-
run: |
39-
echo "PYTHON_VERSION=${{ matrix.python-version }}" >> $GITHUB_ENV
40-
- name: Set up conda environment
41-
uses: mamba-org/setup-micromamba@v2
34+
35+
- name: Set up Python
36+
uses: actions/setup-python@v5
4237
with:
43-
environment-file: ci/upstream-dev-env.yml
44-
environment-name: cf_xarray_test
45-
cache-env: False
46-
create-args: >-
47-
python=${{ matrix.python-version }}
48-
- name: Install cf_xarray
38+
python-version: ${{ matrix.python-version }}
39+
40+
- name: Install uv
41+
uses: astral-sh/setup-uv@v4
42+
43+
- name: Install dependencies
4944
run: |
50-
python -m pip install --no-deps -e .
45+
uv pip install --system -e .
46+
uv pip install --system --group test-upstream
47+
5148
- name: Run Tests
5249
if: success()
5350
id: status

.readthedocs.yml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,17 @@ sphinx:
44
build:
55
os: ubuntu-lts-latest
66
tools:
7-
python: mambaforge-latest
7+
python: "3.11"
88
jobs:
9+
pre_create_environment:
10+
- asdf plugin add uv
11+
- asdf install uv latest
12+
- asdf global uv latest
13+
create_environment:
14+
- uv venv "${READTHEDOCS_VIRTUALENV_PATH}"
15+
install:
16+
- UV_PROJECT_ENVIRONMENT="${READTHEDOCS_VIRTUALENV_PATH}" uv sync --frozen --group docs
917
post_checkout:
1018
- (git --no-pager log --pretty="tformat:%s" -1 | grep -vqF "[skip-rtd]") || exit 183
11-
pre_install:
12-
- conda list sphinx
13-
- conda list cf_xarray
14-
- conda list
15-
16-
conda:
17-
environment: ci/doc.yml
1819

1920
formats: []

ci/doc.yml

Lines changed: 0 additions & 28 deletions
This file was deleted.

ci/environment-all-min-deps.yml

Lines changed: 0 additions & 25 deletions
This file was deleted.

ci/environment-no-optional-deps.yml

Lines changed: 0 additions & 13 deletions
This file was deleted.

ci/environment.yml

Lines changed: 0 additions & 25 deletions
This file was deleted.

ci/upstream-dev-env.yml

Lines changed: 0 additions & 22 deletions
This file was deleted.

0 commit comments

Comments
 (0)