Skip to content

Commit 902ffce

Browse files
ci(backport): Use uv for all pip installs (#2494)
* Backport: - PR #2444 - PR #2475
1 parent 290a23c commit 902ffce

8 files changed

+82
-64
lines changed

.github/workflows/bump-version.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,9 @@ jobs:
198198

199199
- name: Install Python dependencies
200200
run: |
201-
python -m pip install --upgrade pip setuptools wheel
202-
python -m pip install tbump
201+
python -m pip install uv
202+
uv pip install --system --upgrade pip setuptools wheel
203+
uv pip install --system tbump
203204
python -m pip list
204205
205206
- name: Setup Git user to push new tag

.github/workflows/ci.yml

+9-7
Original file line numberDiff line numberDiff line change
@@ -43,17 +43,19 @@ jobs:
4343
with:
4444
python-version: ${{ matrix.python-version }}
4545

46-
- name: Install dependencies (Python 3.7)
47-
if: matrix.python-version == '3.7'
46+
- name: Install dependencies
47+
if: matrix.python-version != '3.7' && matrix.python-version != '3.8'
4848
run: |
49-
python -m pip install --upgrade pip setuptools wheel
50-
python -m pip install --find-links https://storage.googleapis.com/jax-releases/jax_releases.html --upgrade .[test]
49+
python -m pip install uv
50+
uv pip install --system --upgrade pip setuptools wheel
51+
uv pip install --system --upgrade ".[all,test]"
5152
52-
- name: Install dependencies
53-
if: matrix.python-version != '3.7'
53+
# c.f. https://github.com/astral-sh/uv/issues/2062
54+
- name: Install dependencies (Python 3.7, 3.8)
55+
if: matrix.python-version == '3.7' || matrix.python-version == '3.8'
5456
run: |
5557
python -m pip install --upgrade pip setuptools wheel
56-
python -m pip install --upgrade .[test]
58+
python -m pip install --find-links https://storage.googleapis.com/jax-releases/jax_releases.html --upgrade ".[all,test]"
5759
5860
- name: List installed Python packages
5961
run: python -m pip list

.github/workflows/dependencies-head.yml

+44-33
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,18 @@ jobs:
2929

3030
- name: Install dependencies
3131
run: |
32-
python -m pip install --upgrade pip setuptools wheel
33-
python -m pip --no-cache-dir --quiet install --upgrade --pre .[test]
32+
python -m pip install uv
33+
uv pip install --system --upgrade pip setuptools wheel
34+
uv pip --no-cache --quiet install --system --upgrade --pre ".[all,test]"
3435
python -m pip list
3536
37+
- name: List release candidates, alpha, and beta releases
38+
run: |
39+
python -m pip list | egrep '[0-9](rc|[ab])[0-9]'
40+
3641
- name: Test with pytest
3742
run: |
38-
pytest --ignore tests/benchmarks/ --ignore tests/contrib --ignore tests/test_notebooks.py
43+
pytest --ignore tests/contrib --ignore tests/benchmarks --ignore tests/test_notebooks.py
3944
4045
scipy:
4146

@@ -53,19 +58,19 @@ jobs:
5358
with:
5459
python-version: ${{ matrix.python-version }}
5560

56-
# Use nightly SciPy wheels from Anaconda's PyPI
57-
# c.f. https://twitter.com/ralfgommers/status/1419917265781334025
5861
- name: Install dependencies
5962
run: |
60-
python -m pip install --upgrade pip setuptools wheel
61-
python -m pip --no-cache-dir --quiet install --upgrade .[test]
62-
python -m pip uninstall --yes scipy
63-
python -m pip install --upgrade --index-url https://pypi.anaconda.org/scipy-wheels-nightly/simple scipy
63+
python -m pip install uv
64+
uv pip install --system --upgrade pip setuptools wheel
65+
uv pip --no-cache --quiet install --system --upgrade ".[all,test]"
66+
uv pip uninstall --system scipy
67+
# uv wants to upgrade dependencies (numpy) to a dev release too, so don't --upgrade
68+
uv pip install --system --index-url https://pypi.anaconda.org/scientific-python-nightly-wheels/simple scipy
6469
python -m pip list
6570
6671
- name: Test with pytest
6772
run: |
68-
pytest --ignore tests/benchmarks/ --ignore tests/contrib --ignore tests/test_notebooks.py
73+
pytest --ignore tests/contrib --ignore tests/benchmarks --ignore tests/test_notebooks.py
6974
7075
iminuit:
7176

@@ -83,15 +88,16 @@ jobs:
8388
python-version: ${{ matrix.python-version }}
8489
- name: Install dependencies
8590
run: |
86-
python -m pip install --upgrade pip setuptools wheel
87-
python -m pip --no-cache-dir --quiet install --upgrade .[test]
88-
python -m pip uninstall --yes iminuit
89-
python -m pip install --upgrade cython
90-
python -m pip install --upgrade git+https://github.com/scikit-hep/iminuit.git
91+
python -m pip install uv
92+
uv pip install --system --upgrade pip setuptools wheel
93+
uv pip --no-cache --quiet install --system --upgrade ".[all,test]"
94+
uv pip uninstall --system iminuit
95+
uv pip install --system --upgrade cython
96+
uv pip install --system --upgrade git+https://github.com/scikit-hep/iminuit.git
9197
python -m pip list
9298
- name: Test with pytest
9399
run: |
94-
pytest --ignore tests/benchmarks/ --ignore tests/contrib --ignore tests/test_notebooks.py
100+
pytest --ignore tests/contrib --ignore tests/benchmarks --ignore tests/test_notebooks.py
95101
96102
uproot5:
97103

@@ -109,14 +115,15 @@ jobs:
109115
python-version: ${{ matrix.python-version }}
110116
- name: Install dependencies
111117
run: |
112-
python -m pip install --upgrade pip setuptools wheel
113-
python -m pip --no-cache-dir --quiet install --upgrade .[test]
114-
python -m pip uninstall --yes uproot
115-
python -m pip install --upgrade git+https://github.com/scikit-hep/uproot4.git
118+
python -m pip install uv
119+
uv pip install --system --upgrade pip setuptools wheel
120+
uv pip --no-cache --quiet install --system --upgrade ".[all,test]"
121+
uv pip uninstall --system uproot
122+
uv pip install --system --upgrade git+https://github.com/scikit-hep/uproot5.git
116123
python -m pip list
117124
- name: Test with pytest
118125
run: |
119-
pytest --ignore tests/benchmarks/ --ignore tests/contrib --ignore tests/test_notebooks.py
126+
pytest --ignore tests/contrib --ignore tests/benchmarks --ignore tests/test_notebooks.py
120127
121128
matplotlib:
122129

@@ -136,15 +143,18 @@ jobs:
136143

137144
- name: Install dependencies
138145
run: |
139-
python -m pip install --upgrade pip setuptools wheel
140-
python -m pip --no-cache-dir --quiet install --upgrade .[test]
141-
python -m pip uninstall --yes matplotlib
142-
# Need to use --extra-index-url as dependencies aren't on scipy-wheels-nightly package index.
146+
python -m pip install uv
147+
uv pip install --system --upgrade pip setuptools wheel
148+
uv pip --no-cache --quiet install --system --upgrade ".[all,test]"
149+
uv pip uninstall --system matplotlib
150+
# Need to use --extra-index-url as all dependencies aren't on scientific-python-nightly-wheels package index.
143151
# Need to use --pre as dev releases will need priority over stable releases.
144-
python -m pip install \
145-
--upgrade \
152+
# Note that uv and pip differ on --extra-index-url priority
153+
# c.f. https://github.com/scientific-python/upload-nightly-action/issues/76
154+
uv pip install --system \
146155
--pre \
147-
--extra-index-url https://pypi.anaconda.org/scipy-wheels-nightly/simple \
156+
--index-url https://pypi.org/simple/ \
157+
--extra-index-url https://pypi.anaconda.org/scientific-python-nightly-wheels/simple \
148158
matplotlib
149159
150160
- name: List installed Python packages
@@ -170,11 +180,12 @@ jobs:
170180
python-version: ${{ matrix.python-version }}
171181
- name: Install dependencies
172182
run: |
173-
python -m pip install --upgrade pip setuptools wheel
174-
python -m pip --no-cache-dir --quiet install --upgrade .[test]
175-
python -m pip uninstall --yes pytest
176-
python -m pip install --upgrade git+https://github.com/pytest-dev/pytest.git
183+
python -m pip install uv
184+
uv pip install --system --upgrade pip setuptools wheel
185+
uv pip --no-cache --quiet install --system --upgrade ".[all,test]"
186+
uv pip uninstall --system pytest
187+
uv pip install --system --upgrade git+https://github.com/pytest-dev/pytest.git
177188
python -m pip list
178189
- name: Test with pytest
179190
run: |
180-
pytest --ignore tests/benchmarks/ --ignore tests/contrib --ignore tests/test_notebooks.py
191+
pytest --ignore tests/contrib --ignore tests/benchmarks --ignore tests/test_notebooks.py

.github/workflows/docs.yml

+4-3
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,10 @@ jobs:
3131

3232
- name: Install Python dependencies
3333
run: |
34-
python -m pip install --upgrade pip setuptools wheel
35-
python -m pip --quiet install --upgrade .[docs,test]
36-
python -m pip install yq
34+
python -m pip install uv
35+
uv pip install --system --upgrade pip setuptools wheel
36+
uv pip --quiet install --system --upgrade ".[docs,test]"
37+
uv pip install --system yq
3738
python -m pip list
3839
3940
- name: Install apt-get dependencies

.github/workflows/notebooks.yml

+4-2
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,10 @@ jobs:
2828

2929
- name: Install dependencies
3030
run: |
31-
python -m pip install --upgrade pip setuptools wheel
32-
python -m pip install --upgrade .[test]
31+
python -m pip install uv
32+
uv pip install --system --upgrade pip setuptools wheel
33+
# FIXME: c.f. https://github.com/scikit-hep/pyhf/issues/2104
34+
uv pip install --system --upgrade ".[all,test]" 'jupyter-client<8.0.0'
3335
3436
- name: List installed Python packages
3537
run: python -m pip list

.github/workflows/publish-package.yml

+5-4
Original file line numberDiff line numberDiff line change
@@ -41,19 +41,20 @@ jobs:
4141

4242
- name: Install python-build and twine
4343
run: |
44-
python -m pip install --upgrade pip
45-
python -m pip install build twine
44+
python -m pip install uv
45+
uv pip install --system --upgrade pip
46+
uv pip install --system build twine
4647
python -m pip list
4748
4849
- name: Build a sdist and wheel
4950
if: github.event_name != 'schedule'
5051
run: |
51-
python -m build .
52+
python -m build --installer uv .
5253
5354
- name: Build a sdist and wheel and check for warnings
5455
if: github.event_name == 'schedule'
5556
run: |
56-
PYTHONWARNINGS=error,default::DeprecationWarning python -m build .
57+
PYTHONWARNINGS=error,default::DeprecationWarning python -m build --installer uv .
5758
5859
- name: Verify untagged commits have dev versions
5960
if: "!startsWith(github.ref, 'refs/tags/')"

.github/workflows/release_tests.yml

+5-4
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,10 @@ jobs:
3737

3838
- name: Install from PyPI
3939
run: |
40-
python -m pip install --upgrade pip setuptools wheel
41-
python -m pip install --pre pyhf[backends,xmlio]
42-
python -m pip install pytest pytest-cov
40+
python -m pip install uv
41+
uv pip install --system --upgrade pip setuptools wheel
42+
uv pip install --system --pre 'pyhf[backends,xmlio]'
43+
uv pip install --system pytest
4344
python -m pip list
4445
4546
- name: Canary test public API
@@ -49,6 +50,6 @@ jobs:
4950
# FIXME: c.f. https://github.com/proycon/codemetapy/issues/24
5051
- name: Verify requirements in codemeta.json
5152
run: |
52-
python -m pip install jq "codemetapy>=2.4.1"
53+
uv pip install --system jq "codemetapy>=2.3.0"
5354
codemetapy --inputtype python --no-extras pyhf > codemeta_generated.json
5455
diff <(jq -S .softwareRequirements codemeta.json) <(jq -S .softwareRequirements codemeta_generated.json)

.readthedocs.yaml

+8-9
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,21 @@ version: 2
99
build:
1010
os: ubuntu-22.04
1111
tools:
12-
python: "3.11"
12+
python: "3.12"
1313
apt_packages:
1414
- curl
1515
- jq
16+
jobs:
17+
post_create_environment:
18+
- pip install uv
19+
post_install:
20+
# VIRTUAL_ENV needs to be set manually for now.
21+
# See https://github.com/readthedocs/readthedocs.org/pull/11152/
22+
- VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH uv pip install '.[docs]'
1623

1724
# Build documentation in the docs/ directory with Sphinx
1825
sphinx:
1926
configuration: docs/conf.py
2027

2128
# If using Sphinx, optionally build your docs in additional formats such as PDF and ePub
2229
formats: all
23-
24-
# python -m pip install .[docs]
25-
python:
26-
install:
27-
- method: pip
28-
path: .
29-
extra_requirements:
30-
- docs

0 commit comments

Comments
 (0)