Skip to content

Commit 68c756a

Browse files
committed
TST: replace pip with uv in CI
1 parent e962538 commit 68c756a

File tree

5 files changed

+58
-68
lines changed

5 files changed

+58
-68
lines changed

.github/workflows/bleeding-edge.yaml

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ name: CI (bleeding edge)
55
# goals: check stability against
66
# - dev version of Python, numpy, matplotlib, and unyt
77
# - Cython and pytest pre-releases
8-
# - building with future pip default options
98

109
on:
1110
push:
@@ -35,36 +34,37 @@ jobs:
3534
uses: actions/checkout@v5
3635

3736
- name: Set up Python (newest testable version)
38-
uses: actions/setup-python@v6
37+
uses: astral-sh/setup-uv@v7
3938
with:
4039
# this version should be upgraded as often as possible, typically once a year when
4140
# Cython, numpy and matplotlib are known to be compatible
4241
python-version: '3.14'
43-
allow-prereleases: true
42+
enable-cache: false
43+
44+
- name: Configure uv
45+
run: |
46+
echo "UV_PRERELEASE=allow" >> "$GITHUB_ENV"
47+
echo "UV_INDEX=https://pypi.anaconda.org/scientific-python-nightly-wheels/simple" >> "$GITHUB_ENV"
48+
echo "UV_INDEX_STRATEGY=unsafe-best-match" >> "$GITHUB_ENV"
4449
4550
- name: Install dependencies
51+
# note: the --no-build flag can later be configured at the project level to
52+
# blacklist certain packages we *never* want to build
4653
run: |
47-
python -m pip install --upgrade pip
48-
python -m pip install --upgrade setuptools wheel
49-
python -m pip install --pre --only-binary ":all:" numpy matplotlib Cython \
50-
--extra-index https://pypi.anaconda.org/scientific-python-nightly-wheels/simple
51-
python -m pip install --pre ewah-bool-utils
52-
python -m pip install git+https://github.com/yt-project/unyt.git
53-
python -m pip install git+https://github.com/pytest-dev/pytest.git
54+
uv pip install setuptools
55+
uv pip install --no-build numpy matplotlib Cython ewah-bool-utils
56+
uv add git+https://github.com/yt-project/unyt.git
57+
uv add --extra test git+https://github.com/pytest-dev/pytest.git
5458
5559
- name: Build
5660
# --no-build-isolation is used to guarantee that build time dependencies
5761
# are not installed by pip as specified from pyproject.toml, hence we get
5862
# to use the dev version of numpy at build time.
59-
run: |
60-
python -m pip -v install -e .[test] --no-build-isolation
61-
62-
- run: python -m pip list
63+
run: uv sync --extra test --no-build-isolation
6364

65+
- run: yt config set --local yt log_level 50 # Disable excessive output
6466
- name: Run Tests
65-
run: |
66-
yt config set --local yt log_level 50 # Disable excessive output
67-
pytest yt -vvv --color=yes
67+
run: uv run --no-sync pytest yt -vvv --color=yes
6868

6969
create-issue:
7070
if: ${{ failure() && github.event_name == 'schedule' }}

.github/workflows/build-test.yaml

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ jobs:
6262
venv-loc: bin
6363
- os: ubuntu-latest
6464
# minimal tests with latest Python and no optional dependencies
65-
python-version: '3.x'
65+
python-version: '3.14'
6666
dependencies: ''
6767
tests-type: unit
6868
test-runner: pytest
@@ -77,9 +77,10 @@ jobs:
7777

7878
steps:
7979
- name: Set up Python
80-
uses: actions/setup-python@v6
80+
uses: astral-sh/setup-uv@v7
8181
with:
8282
python-version: ${{ matrix.python-version }}
83+
enable-cache: false
8384
- name: Checkout repo (bare)
8485
if: matrix.tests-type != 'answer'
8586
uses: actions/checkout@v5
@@ -92,34 +93,27 @@ jobs:
9293
shell: bash
9394
env:
9495
dependencies: ${{ matrix.dependencies }}
95-
run: |
96-
python -m venv .venv
97-
source .venv/${{matrix.venv-loc}}/activate
98-
source ./tests/ci_install.sh
96+
run: source ./tests/ci_install.sh
9997

10098
- name: Install and patch nosetest
10199
if: matrix.test-runner == 'nose'
100+
# note: this could be handled with [tool.uv.sources]
102101
run: |
103-
source .venv/${{matrix.venv-loc}}/activate
104-
python -m pip install -r nose_requirements.txt
102+
uv pip install -r nose_requirements.txt
105103
find .venv/lib/python${{matrix.python-version}}/site-packages/nose -name '*.py' \
106104
-exec sed -i -e s/collections.Callable/collections.abc.Callable/g '{}' ';'
107105
108106
- name: Show final env
109-
run: |
110-
source .venv/${{matrix.venv-loc}}/activate
111-
python -m pip list
107+
run: uv pip list
112108

113109
- name: Run Unit Tests (pytest)
114110
if: matrix.test-runner == 'pytest'
115-
run: |
116-
source .venv/${{matrix.venv-loc}}/activate
117-
pytest yt --color=yes
111+
run: uv run --no-sync pytest yt --color=yes
112+
118113
- name: Run Tests (nose)
119114
if: matrix.test-runner == 'nose'
120115
run: |
121-
source .venv/${{matrix.venv-loc}}/activate
122-
cat nose_ignores.txt | xargs python -m nose -c nose_unit.cfg --traverse-namespace
116+
cat nose_ignores.txt | xargs uv run python -m nose -c nose_unit.cfg --traverse-namespace
123117
124118
image-tests:
125119
name: Image tests
@@ -132,9 +126,10 @@ jobs:
132126

133127
steps:
134128
- name: Set up Python
135-
uses: actions/setup-python@v6
129+
uses: astral-sh/setup-uv@v7
136130
with:
137131
python-version: '3.11'
132+
enable-cache: false
138133

139134
- name: Checkout repo (with submodules)
140135
uses: actions/checkout@v5
@@ -145,14 +140,14 @@ jobs:
145140
shell: bash
146141
env:
147142
dependencies: 'cartopy'
148-
run: |
149-
source ./tests/ci_install.sh
143+
run: source ./tests/ci_install.sh
150144

151145
- run: python -m pip list
152146

153147
- name: Run Image Tests
154148
run: |
155-
pytest yt --color=yes --mpl -m mpl_image_compare \
149+
uv run --no-sync \
150+
pytest yt --color=yes --mpl -m mpl_image_compare \
156151
--mpl-generate-summary=html \
157152
--mpl-results-path=pytest_mpl_results \
158153
--mpl-baseline-path=tests/pytest_mpl_baseline \
@@ -161,7 +156,8 @@ jobs:
161156
- name: Generate new image baseline
162157
if: failure()
163158
run: |
164-
pytest yt --color=yes --mpl -m mpl_image_compare \
159+
uv run --no-sync \
160+
pytest yt --color=yes --mpl -m mpl_image_compare \
165161
--mpl-generate-path=pytest_mpl_new_baseline \
166162
--last-failed
167163

.github/workflows/type-checking.yaml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,18 @@ jobs:
2828
uses: actions/checkout@v5
2929

3030
- name: Set up Python
31-
uses: actions/setup-python@v6
31+
uses: astral-sh/setup-uv@v7
3232
with:
3333
# run with oldest supported python version
3434
# so that we always get compatible versions of
3535
# core dependencies at type-check time
3636
python-version: '3.10'
37+
enable-cache: false
3738

3839
- name: Build
39-
run: |
40-
python3 -m pip install --upgrade pip
41-
python3 -m pip install -e . -r requirements/typecheck.txt
40+
run: uv pip install -e . -r requirements/typecheck.txt
4241

43-
- run: python -m pip list
42+
- run: uv pip list
4443

4544
- name: Run mypy
46-
run: mypy yt
45+
run: uv run --no-sync mypy yt

.github/workflows/wheels.yaml

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -71,20 +71,21 @@ jobs:
7171
uses: actions/checkout@v5
7272

7373
- name: Set up Python
74-
uses: actions/setup-python@v6
74+
uses: astral-sh/setup-uv@v7
7575
with:
7676
python-version: '3.10'
77+
enable-cache: false
7778

7879
- name: Build sdist
7980
run: pipx run build --sdist
8081

8182
- name: Test sdist
8283
run: |
83-
python -m pip install "$(echo dist/*.tar.gz)[test]"
84-
python -m pip list
84+
uv pip install "yt[test]" --find-links dist/
85+
uv pip list
8586
project_dir=$(pwd)
86-
cd ../../
87-
pytest -c $project_dir/pyproject.toml --rootdir . --color=yes --pyargs yt
87+
uv run --dir ../../ --no-project \
88+
pytest -c $project_dir/pyproject.toml --rootdir . --color=yes --pyargs yt
8889
8990
- name: Upload sdist
9091
uses: actions/upload-artifact@v4
@@ -101,28 +102,23 @@ jobs:
101102
with:
102103
submodules: true
103104
- name: Set up Python
104-
uses: actions/setup-python@v6
105+
uses: astral-sh/setup-uv@v7
105106
with:
106107
python-version: '3.13'
108+
enable-cache: false
107109
- name: install check-manifest
108110
run: |
109-
python -m pip install --upgrade pip
110-
python -m pip install check-manifest
111+
uv pip install check-manifest
111112
- name: Install build time dependencies
112113
shell: bash
113114

114-
# keep in sync with pyproject.toml
115-
run: |
116-
python -m pip install Cython>=3.0.3
117-
python -m pip install numpy>=2.0.0
118-
python -m pip install ewah-bool-utils>=1.2.0
119-
python -m pip install --upgrade setuptools
115+
# keep in sync with pyproject.toml [build_system]
116+
run: uv pip install Cython numpy ewah-bool-utils setuptools
120117
- name: build yt
121118
shell: bash
122-
run: |
123-
python -m pip install --no-build-isolation .
119+
run: uv pip install --no-build-isolation .
124120
- name: run check-manifest
125-
run: check-manifest -vvv
121+
run: uv run --no-sync check-manifest -vvv
126122

127123
deploy:
128124
name: Publish to PyPI

tests/ci_install.sh

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,17 @@ fi
3232
# but the primary intention is to embed this script in CI jobs
3333
if [[ ${dependencies} == "minimal" ]]; then
3434
# test with minimal versions of runtime dependencies
35-
python -m pip install -e ".[test]" -r minimal_requirements.txt
35+
uv pip install ".[test]" -c minimal_requirements.txt
3636
elif [[ ${dependencies} == "cartopy" ]]; then
37-
python -m pip install 'cartopy>=0.22'
3837
# scipy is an optional dependency to cartopy
39-
python -m pip install scipy
40-
python -m pip install -e ".[test]"
38+
uv pip install 'cartopy>=0.22' scipy
39+
uv sync --extra test --inexact
4140
elif [[ ${dependencies} == "full" ]]; then
4241
# test with all optional runtime dependencies
43-
python -m pip install -e ".[test,full]"
42+
uv sync --extra test --extra full
4443
else
45-
# test with no special requirements
46-
python -m pip install -e ".[test]"
44+
# test with no special requirements
45+
uv sync --extra test
4746
fi
4847

4948
# Disable excessive output

0 commit comments

Comments
 (0)