Skip to content

Commit 08755e4

Browse files
ci: Use uv for all pip installs (#2444)
* Use 'uv pip' for all calls to 'pip install' and 'pip uninstall' in CI workflows. - c.f. https://github.com/astral-sh/uv/ - Still use pip for Python 3.8 until astral-sh/uv#2062 is resolved. * Apply subtle changes to install commands in .github/workflows/dependencies-head.yml. - 'uv pip install --upgrade' will try to upgrade all dependencies of the target package as well, which for the dependencies-head workflow isn't the goal. So remove the '--upgrade' from calls that also install from the scientific-python-nightly-wheels package index when testing only particular packages. - 'up pip' and 'pip' have different behavior with regards to --extra-index-url, as 'uv pip' gives --extra-index-url priority over --index-url, where 'pip' does not give priority to either. Use this with 'uv pip' to give priority to the scientific-python-nightly-wheels package index. * Add uv to the 'develop' extras.
1 parent 682ce76 commit 08755e4

11 files changed

+72
-49
lines changed

.github/workflows/bump-version.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,9 @@ jobs:
204204

205205
- name: Install Python dependencies
206206
run: |
207-
python -m pip install --upgrade pip setuptools wheel
208-
python -m pip install tbump
207+
python -m pip install uv
208+
uv pip install --system --upgrade pip setuptools wheel
209+
uv pip install --system tbump
209210
python -m pip list
210211
211212
- name: Setup Git user to push new tag

.github/workflows/ci-windows.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,9 @@ jobs:
2929

3030
- name: Install dependencies
3131
run: |
32-
python -m pip install --upgrade pip setuptools wheel
33-
python -m pip install --upgrade '.[all,test]'
32+
python -m pip install uv
33+
uv pip install --system --upgrade pip setuptools wheel
34+
uv pip install --system --upgrade '.[all,test]'
3435
3536
- name: List installed Python packages
3637
run: python -m pip list

.github/workflows/ci.yml

+9
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,15 @@ jobs:
4444
python-version: ${{ matrix.python-version }}
4545

4646
- name: Install dependencies
47+
if: matrix.python-version != '3.8'
48+
run: |
49+
python -m pip install uv
50+
uv pip install --system --upgrade pip setuptools wheel
51+
uv pip install --system --upgrade ".[all,test]"
52+
53+
# c.f. https://github.com/astral-sh/uv/issues/2062
54+
- name: Install dependencies (Python 3.8)
55+
if: matrix.python-version == '3.8'
4756
run: |
4857
python -m pip install --upgrade pip setuptools wheel
4958
python -m pip install --upgrade ".[all,test]"

.github/workflows/dependencies-head.yml

+35-29
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,9 @@ 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 ".[all,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
3637
- name: List release candidates, alpha, and beta releases
@@ -57,14 +58,14 @@ jobs:
5758
with:
5859
python-version: ${{ matrix.python-version }}
5960

60-
# Use nightly SciPy wheels from Anaconda's PyPI
61-
# c.f. https://twitter.com/ralfgommers/status/1419917265781334025
6261
- name: Install dependencies
6362
run: |
64-
python -m pip install --upgrade pip setuptools wheel
65-
python -m pip --no-cache-dir --quiet install --upgrade ".[all,test]"
66-
python -m pip uninstall --yes scipy
67-
python -m pip install --upgrade --index-url https://pypi.anaconda.org/scientific-python-nightly-wheels/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
6869
python -m pip list
6970
7071
- name: Test with pytest
@@ -87,11 +88,12 @@ jobs:
8788
python-version: ${{ matrix.python-version }}
8889
- name: Install dependencies
8990
run: |
90-
python -m pip install --upgrade pip setuptools wheel
91-
python -m pip --no-cache-dir --quiet install --upgrade ".[all,test]"
92-
python -m pip uninstall --yes iminuit
93-
python -m pip install --upgrade cython
94-
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
9597
python -m pip list
9698
- name: Test with pytest
9799
run: |
@@ -113,10 +115,11 @@ jobs:
113115
python-version: ${{ matrix.python-version }}
114116
- name: Install dependencies
115117
run: |
116-
python -m pip install --upgrade pip setuptools wheel
117-
python -m pip --no-cache-dir --quiet install --upgrade ".[all,test]"
118-
python -m pip uninstall --yes uproot
119-
python -m pip install --upgrade git+https://github.com/scikit-hep/uproot5.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
120123
python -m pip list
121124
- name: Test with pytest
122125
run: |
@@ -140,16 +143,18 @@ jobs:
140143

141144
- name: Install dependencies
142145
run: |
143-
python -m pip install --upgrade pip setuptools wheel
144-
python -m pip --no-cache-dir --quiet install --upgrade ".[all,test]"
145-
python -m pip uninstall --yes matplotlib
146-
# Need to use --extra-index-url as dependencies aren't on scientific-python-nightly-wheels 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.
147151
# Need to use --pre as dev releases will need priority over stable releases.
148-
python -m pip install \
149-
--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 \
150155
--pre \
151-
--index-url https://pypi.anaconda.org/scientific-python-nightly-wheels/simple \
152-
--extra-index-url https://pypi.org/simple/ \
156+
--index-url https://pypi.org/simple/ \
157+
--extra-index-url https://pypi.anaconda.org/scientific-python-nightly-wheels/simple \
153158
matplotlib
154159
155160
- name: List installed Python packages
@@ -175,10 +180,11 @@ jobs:
175180
python-version: ${{ matrix.python-version }}
176181
- name: Install dependencies
177182
run: |
178-
python -m pip install --upgrade pip setuptools wheel
179-
python -m pip --no-cache-dir --quiet install --upgrade ".[all,test]"
180-
python -m pip uninstall --yes pytest
181-
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
182188
python -m pip list
183189
- name: Test with pytest
184190
run: |

.github/workflows/docs.yml

+4-3
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,10 @@ jobs:
2828

2929
- name: Install Python dependencies
3030
run: |
31-
python -m pip install --upgrade pip setuptools wheel
32-
python -m pip --quiet install --upgrade .[docs,test]
33-
python -m pip install yq
31+
python -m pip install uv
32+
uv pip install --system --upgrade pip setuptools wheel
33+
uv pip --quiet install --system --upgrade ".[docs,test]"
34+
uv pip install --system yq
3435
python -m pip list
3536
3637
- name: Install apt-get dependencies

.github/workflows/lower-bound-requirements.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@ jobs:
2626

2727
- name: Install dependencies and force lowest bound
2828
run: |
29-
python -m pip install --upgrade pip setuptools wheel
30-
python -m pip --no-cache-dir install --constraint tests/constraints.txt ".[all,test]"
29+
python -m pip install uv
30+
uv pip install --system --upgrade pip setuptools wheel
31+
uv pip --no-cache install --system --constraint tests/constraints.txt ".[all,test]"
3132
3233
- name: List installed Python packages
3334
run: python -m pip list

.github/workflows/notebooks.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,10 @@ jobs:
2828

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

.github/workflows/publish-package.yml

+5-4
Original file line numberDiff line numberDiff line change
@@ -43,19 +43,20 @@ jobs:
4343

4444
- name: Install python-build and twine
4545
run: |
46-
python -m pip install --upgrade pip
47-
python -m pip install build twine
46+
python -m pip install uv
47+
uv pip install --system --upgrade pip
48+
uv pip install --system build twine
4849
python -m pip list
4950
5051
- name: Build a sdist and wheel
5152
if: github.event_name != 'schedule'
5253
run: |
53-
python -m build .
54+
python -m build --installer uv .
5455
5556
- name: Build a sdist and wheel and check for warnings
5657
if: github.event_name == 'schedule'
5758
run: |
58-
PYTHONWARNINGS=error,default::DeprecationWarning python -m build .
59+
PYTHONWARNINGS=error,default::DeprecationWarning python -m build --installer uv .
5960
6061
- name: Verify untagged commits have dev versions
6162
if: "!startsWith(github.ref, 'refs/tags/')"

.github/workflows/release_tests.yml

+5-4
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,10 @@ jobs:
3636

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

.readthedocs.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ sphinx:
2121
# If using Sphinx, optionally build your docs in additional formats such as PDF and ePub
2222
formats: all
2323

24-
# python -m pip install .[docs]
24+
# python -m pip install '.[docs]'
2525
python:
2626
install:
2727
- method: pip

pyproject.toml

+1
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ develop = [
134134
"pre-commit",
135135
"nox",
136136
"codemetapy>=2.3.0",
137+
"uv>=0.1.39"
137138
]
138139

139140
[tool.hatch.version]

0 commit comments

Comments
 (0)