Skip to content

Commit 0a37446

Browse files
authored
Adopt uv for dependency management and require Python 3.10 (#2085)
* Switch dependency management to uv and require Python 3.10 * Fix Python 3.10 setup in workflows * Fix CI failures in uv workflows * Adjust uv export for pip-audit * chore: update ASF config to reflect Python 3.10+ requirement
1 parent f64c857 commit 0a37446

28 files changed

+2582
-197
lines changed

.asf.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ github:
4848
- "Unit Tests (Python 3.12)"
4949
- "Unit Tests (Python 3.13)"
5050
- "Dependency Review"
51-
- "Run Various Lint and Other Checks (3.10)"
52-
- "Build and upload Documentation (3.10)"
51+
- "Run Various Lint and Other Checks"
52+
- "Build and upload Documentation"
5353

5454
notifications:
5555
jobs: notifications@libcloud.apache.org

.github/workflows/install-tests.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,12 @@ jobs:
2020
fail-fast: false
2121
matrix:
2222
python_version:
23-
- "3.8"
24-
- "3.9"
23+
2524
- "3.10"
2625
- "3.11"
2726
- "3.12"
2827
- "3.13"
29-
- "pypy-3.9"
28+
3029
- "pypy-3.10"
3130

3231
steps:

.github/workflows/integration-tests.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,23 +38,26 @@ jobs:
3838
uses: actions/setup-python@v6
3939
with:
4040
python-version: ${{ matrix.python_version }}
41+
- name: Install uv
42+
uses: astral-sh/setup-uv@v4
4143

4244
- name: Install OS / deb dependencies
4345
run: |
4446
sudo DEBIAN_FRONTEND=noninteractive apt-get update
4547
sudo DEBIAN_FRONTEND=noninteractive apt-get install -yq gcc libvirt-dev
4648
47-
- name: Cache Python Dependencies
49+
- name: Cache uv
4850
uses: actions/cache@v5
4951
with:
50-
path: ~/.cache/pip
51-
key: ${{ runner.os }}-pip-${{ hashFiles('requirements-tests.txt', 'integration/storage/requirements.txt') }}
52+
path: ~/.cache/uv
53+
key: ${{ runner.os }}-uv-${{ hashFiles('uv.lock') }}
5254
restore-keys: |
53-
${{ runner.os }}-pip-
55+
${{ runner.os }}-uv-
5456
5557
- name: Install Python Dependencies
5658
run: |
57-
pip install -r requirements-ci.txt
59+
uv sync --extra ci
60+
echo "${GITHUB_WORKSPACE}/.venv/bin" >> "$GITHUB_PATH"
5861
5962
- name: Run tox target
6063
run: |

.github/workflows/main.yml

Lines changed: 90 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,11 @@ jobs:
3232
fail-fast: false
3333
matrix:
3434
python_version:
35-
- "3.9"
3635
- "3.10"
3736
- "3.11"
3837
- "3.12"
3938
- "3.13"
4039
# cryptography is not compatible with older PyPy versions
41-
- "pypy-3.9"
4240
- "pypy-3.10"
4341
os:
4442
- ubuntu-latest
@@ -49,28 +47,33 @@ jobs:
4947
uses: actions/setup-python@v6
5048
with:
5149
python-version: ${{ matrix.python_version }}
50+
- name: Install uv
51+
uses: astral-sh/setup-uv@v4
5252

5353
- name: Install OS / deb dependencies
5454
run: |
5555
sudo DEBIAN_FRONTEND=noninteractive apt-get update
5656
sudo DEBIAN_FRONTEND=noninteractive apt-get install -yq gcc libvirt-dev
5757
58-
- name: Cache Python Dependencies
58+
- name: Cache uv
5959
uses: actions/cache@v5
6060
with:
61-
path: ~/.cache/pip
62-
key: ${{ runner.os }}-pip-${{ hashFiles('requirements-tests.txt', '') }}
61+
path: ~/.cache/uv
62+
key: ${{ runner.os }}-uv-${{ hashFiles('uv.lock') }}
6363
restore-keys: |
64-
${{ runner.os }}-pip-
64+
${{ runner.os }}-uv-
6565
6666
- name: Install Python Dependencies
67-
run: pip install -r requirements-ci.txt
67+
run: uv sync --extra ci
68+
69+
- name: Add .venv to PATH
70+
run: echo "${GITHUB_WORKSPACE}/.venv/bin" >> "$GITHUB_PATH"
6871

6972
- name: Run unit tests tox target
7073
run: tox -e py${{ matrix.python_version }}
7174

7275
- name: Run dist install checks tox target
73-
if: ${{ matrix.python_version != 'pypy-3.9' && matrix.python_version != 'pypy-3.10' }}
76+
if: ${{ matrix.python_version != 'pypy-3.10' }}
7477
run: tox -e py${{ matrix.python_version }}-dist,py${{ matrix.python_version }}-dist-wheel
7578

7679
code_coverage:
@@ -79,30 +82,35 @@ jobs:
7982

8083
strategy:
8184
matrix:
82-
python_version: [ "3.10"]
85+
python_version: [ "3.10" ]
8386

8487
steps:
8588
- uses: actions/checkout@v6
8689
- name: Use Python ${{ matrix.python_version }}
8790
uses: actions/setup-python@v6
8891
with:
8992
python-version: ${{ matrix.python_version }}
93+
- name: Install uv
94+
uses: astral-sh/setup-uv@v4
9095

9196
- name: Install OS / deb dependencies
9297
run: |
9398
sudo DEBIAN_FRONTEND=noninteractive apt-get update
9499
sudo DEBIAN_FRONTEND=noninteractive apt-get install -yq graphviz gcc libvirt-dev
95100
96-
- name: Cache Python Dependencies
101+
- name: Cache uv
97102
uses: actions/cache@v5
98103
with:
99-
path: ~/.cache/pip
100-
key: ${{ runner.os }}-pip-${{ hashFiles('requirements-tests.txt') }}
104+
path: ~/.cache/uv
105+
key: ${{ runner.os }}-uv-${{ hashFiles('uv.lock') }}
101106
restore-keys: |
102-
${{ runner.os }}-pip-
107+
${{ runner.os }}-uv-
103108
104109
- name: Install Python Dependencies
105-
run: pip install -r requirements-ci.txt
110+
run: uv sync --extra ci
111+
112+
- name: Add .venv to PATH
113+
run: echo "${GITHUB_WORKSPACE}/.venv/bin" >> "$GITHUB_PATH"
106114

107115
- name: Run Checks
108116
run: tox -e coverage-ci
@@ -130,22 +138,27 @@ jobs:
130138
uses: actions/setup-python@v6
131139
with:
132140
python-version: ${{ matrix.python_version }}
141+
- name: Install uv
142+
uses: astral-sh/setup-uv@v4
133143

134144
- name: Install OS / deb dependencies
135145
run: |
136146
sudo DEBIAN_FRONTEND=noninteractive apt-get update
137147
sudo DEBIAN_FRONTEND=noninteractive apt-get install -yq graphviz gcc libvirt-dev
138148
139-
- name: Cache Python Dependencies
149+
- name: Cache uv
140150
uses: actions/cache@v5
141151
with:
142-
path: ~/.cache/pip
143-
key: ${{ runner.os }}-pip-${{ hashFiles('requirements-lint.txt') }}
152+
path: ~/.cache/uv
153+
key: ${{ runner.os }}-uv-${{ hashFiles('uv.lock') }}
144154
restore-keys: |
145-
${{ runner.os }}-pip-
155+
${{ runner.os }}-uv-
146156
147157
- name: Install Python Dependencies
148-
run: pip install -r requirements-ci.txt
158+
run: uv sync --extra ci
159+
160+
- name: Add .venv to PATH
161+
run: echo "${GITHUB_WORKSPACE}/.venv/bin" >> "$GITHUB_PATH"
149162

150163
- name: Run shellcheck
151164
run: shellcheck dist/*.sh contrib/*.sh
@@ -173,19 +186,25 @@ jobs:
173186
uses: actions/setup-python@v6
174187
with:
175188
python-version: ${{ matrix.python_version }}
189+
- name: Install uv
190+
uses: astral-sh/setup-uv@v4
191+
- name: Install OS / deb dependencies
192+
run: |
193+
sudo DEBIAN_FRONTEND=noninteractive apt-get update
194+
sudo DEBIAN_FRONTEND=noninteractive apt-get install -yq gcc libvirt-dev pkg-config
176195
177-
- name: Cache Python Dependencies
196+
- name: Cache uv
178197
uses: actions/cache@v5
179198
with:
180-
path: ~/.cache/pip
181-
key: ${{ runner.os }}-pip-${{ hashFiles('requirements-lint.txt') }}
199+
path: ~/.cache/uv
200+
key: ${{ runner.os }}-uv-${{ hashFiles('uv.lock') }}
182201
restore-keys: |
183-
${{ runner.os }}-pip-
202+
${{ runner.os }}-uv-
184203
185204
- name: Install Python Dependencies
186205
run: |
187-
pip install -r requirements-ci.txt
188-
pip install "build==1.2.2"
206+
uv sync --extra ci --extra build
207+
echo "${GITHUB_WORKSPACE}/.venv/bin" >> "$GITHUB_PATH"
189208
190209
- name: Build Release Artifact
191210
run: |
@@ -229,7 +248,7 @@ jobs:
229248
# Since wheel doesn't include those files, we need to manually copy them over from
230249
# repo root so we can run the tests
231250
cp ../../tox.ini .
232-
cp ../../requirements-tests.txt .
251+
cp ../../pyproject.toml .
233252
cp ../../libcloud/test/secrets.py-dist libcloud/test/secrets.py-dist
234253
tox -c tox.ini -epy3.10
235254
@@ -262,26 +281,36 @@ jobs:
262281

263282
steps:
264283
- uses: actions/checkout@v6
265-
- name: Install OS / deb dependencies
266-
run: |
267-
sudo DEBIAN_FRONTEND=noninteractive apt-get update
268-
sudo DEBIAN_FRONTEND=noninteractive apt-get install -yq gcc libvirt-dev
269-
270284
- name: Use Python ${{ matrix.python_version }}
271285
uses: actions/setup-python@v6
272286
with:
273287
python-version: ${{ matrix.python_version }}
288+
- name: Install uv
289+
uses: astral-sh/setup-uv@v4
274290

275-
- name: Cache Python Dependencies
291+
- name: Install OS / deb dependencies
292+
run: |
293+
sudo DEBIAN_FRONTEND=noninteractive apt-get update
294+
sudo DEBIAN_FRONTEND=noninteractive apt-get install -yq gcc libvirt-dev
295+
296+
- name: Cache uv
276297
uses: actions/cache@v5
277298
with:
278-
path: ~/.cache/pip
279-
key: ${{ runner.os }}-pip-${{ hashFiles('requirements-lint.txt') }}
299+
path: ~/.cache/uv
300+
key: ${{ runner.os }}-uv-${{ hashFiles('uv.lock') }}
280301
restore-keys: |
281-
${{ runner.os }}-pip-
302+
${{ runner.os }}-uv-
282303
283304
- name: Install Python Dependencies
284-
run: pip install -r requirements-ci.txt
305+
run: uv sync --extra ci
306+
307+
- name: Add .venv to PATH
308+
run: echo "${GITHUB_WORKSPACE}/.venv/bin" >> "$GITHUB_PATH"
309+
310+
- name: Ensure pip is available
311+
run: |
312+
python -m ensurepip --upgrade
313+
python -m pip install --upgrade pip
285314
286315
- name: Install Library Into Virtualenv
287316
run: |
@@ -304,10 +333,13 @@ jobs:
304333
- name: Cleanup
305334
run: rm -rf venv/ || true
306335

336+
- name: Export Development Requirements
337+
run: uv export --extra test --extra lint --extra mypy --extra docs --format requirements.txt --no-hashes --no-emit-project --output-file requirements-dev.txt
338+
307339
- name: Run Pip Audit Check On All Development And Test Dependencies
308340
uses: pypa/gh-action-pip-audit@1220774d901786e6f652ae159f7b6bc8fea6d266 # v1.1.0
309341
with:
310-
inputs: requirements-tests.txt requirements-lint.txt requirements-mypy.txt requirements-docs.txt
342+
inputs: requirements-dev.txt
311343
# setuptools which we don't install or depend on directly
312344
ignore-vulns: |
313345
GHSA-r9hx-vwmv-q579
@@ -329,22 +361,27 @@ jobs:
329361
uses: actions/setup-python@v6
330362
with:
331363
python-version: ${{ matrix.python_version }}
364+
- name: Install uv
365+
uses: astral-sh/setup-uv@v4
332366

333367
- name: Install OS / deb dependencies
334368
run: |
335369
sudo DEBIAN_FRONTEND=noninteractive apt-get update
336370
sudo DEBIAN_FRONTEND=noninteractive apt-get install -yq graphviz gcc libvirt-dev
337371
338-
- name: Cache Python Dependencies
372+
- name: Cache uv
339373
uses: actions/cache@v5
340374
with:
341-
path: ~/.cache/pip
342-
key: ${{ runner.os }}-pip-${{ hashFiles('requirements-tests.txt') }}
375+
path: ~/.cache/uv
376+
key: ${{ runner.os }}-uv-${{ hashFiles('uv.lock') }}
343377
restore-keys: |
344-
${{ runner.os }}-pip-
378+
${{ runner.os }}-uv-
345379
346380
- name: Install Python Dependencies
347-
run: pip install -r requirements-ci.txt
381+
run: uv sync --extra ci
382+
383+
- name: Add .venv to PATH
384+
run: echo "${GITHUB_WORKSPACE}/.venv/bin" >> "$GITHUB_PATH"
348385

349386
- name: Run Micro Benchmarks
350387
run: tox -e micro-benchmarks
@@ -363,6 +400,8 @@ jobs:
363400
uses: actions/setup-python@v6
364401
with:
365402
python-version: ${{ matrix.python_version }}
403+
- name: Install uv
404+
uses: astral-sh/setup-uv@v4
366405

367406
- name: Print Environment Info
368407
run: printenv | sort
@@ -372,16 +411,19 @@ jobs:
372411
sudo DEBIAN_FRONTEND=noninteractive apt-get update
373412
sudo DEBIAN_FRONTEND=noninteractive apt-get install -yq graphviz gcc libvirt-dev
374413
375-
- name: Cache Python Dependencies
414+
- name: Cache uv
376415
uses: actions/cache@v5
377416
with:
378-
path: ~/.cache/pip
379-
key: ${{ runner.os }}-pip-${{ hashFiles('requirements-docs.txt') }}
417+
path: ~/.cache/uv
418+
key: ${{ runner.os }}-uv-${{ hashFiles('uv.lock') }}
380419
restore-keys: |
381-
${{ runner.os }}-pip-
420+
${{ runner.os }}-uv-
382421
383422
- name: Install Python Dependencies
384-
run: pip install -r requirements-ci.txt
423+
run: uv sync --extra ci
424+
425+
- name: Add .venv to PATH
426+
run: echo "${GITHUB_WORKSPACE}/.venv/bin" >> "$GITHUB_PATH"
385427

386428
- name: Build Docs
387429
run: tox -e docs
@@ -392,5 +434,5 @@ jobs:
392434
RTD_TOKEN: ${{ secrets.RTD_TOKEN }}
393435
BRANCH_NAME: "trunk"
394436
run: |
395-
pip install requests
437+
python -m pip install requests
396438
python ./contrib/trigger_rtd_build.py

.github/workflows/publish_dev_artifact.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,15 @@ jobs:
2828
uses: actions/setup-python@v6
2929
with:
3030
python-version: "3.10"
31+
- name: Install uv
32+
uses: astral-sh/setup-uv@v4
3133

3234
- name: Print Environment Info
3335
run: printenv | sort
3436
- name: Install Dependencies
3537
run: |
36-
pip install --upgrade pip
37-
pip install build
38+
uv sync --extra build
39+
echo "${GITHUB_WORKSPACE}/.venv/bin" >> "$GITHUB_PATH"
3840
3941
- name: Create Dev Artifacts
4042
run: |

0 commit comments

Comments
 (0)