Skip to content

Commit e71ddbf

Browse files
committed
Migrate from pdm to uv
1 parent 25eafa4 commit e71ddbf

9 files changed

Lines changed: 2534 additions & 2150 deletions

File tree

.github/workflows/cd.yml

Lines changed: 35 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ env:
88
CD: "true"
99
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1010
PYTHON_DEFAULT_VERSION: "3.12"
11+
UV_VERSION: "0.8.24"
1112

1213
jobs:
1314
deploy:
@@ -35,11 +36,16 @@ jobs:
3536
uses: actions/setup-python@v6
3637
with:
3738
python-version: ${{ env.PYTHON_DEFAULT_VERSION }}
39+
- uses: astral-sh/setup-uv@v7
40+
with:
41+
version: ${{ env.UV_VERSION }}
42+
enable-cache: true
3843
- name: Install dependencies
39-
run: python -m pip install --upgrade nox pdm==2.26.4
44+
run: |
45+
uv sync --locked --group nox
4046
- name: Build the distribution
4147
id: build
42-
run: nox -vs build
48+
run: uv run nox -vs build
4349
- name: Read the Changelog
4450
id: read-changelog
4551
uses: mindsers/changelog-reader-action@v2
@@ -62,6 +68,8 @@ jobs:
6268
password: ${{ secrets.B2_PYPI_PASSWORD }}
6369
deploy-linux-bundle:
6470
needs: deploy
71+
env:
72+
UV_PYTHON: ${{ env.PYTHON_DEFAULT_VERSION }}
6573
strategy:
6674
fail-fast: false
6775
matrix:
@@ -75,21 +83,25 @@ jobs:
7583
uses: deadsnakes/action@v3.2.0 # staticx doesn't work with python installed by setup-python action
7684
with:
7785
python-version: ${{ env.PYTHON_DEFAULT_VERSION }}
86+
- uses: astral-sh/setup-uv@v7
87+
with:
88+
version: ${{ env.UV_VERSION }}
89+
enable-cache: true
7890
- name: Install dependencies
7991
run: |
8092
sudo apt-get -y update
8193
sudo apt-get -y install patchelf scons
82-
python -m pip install --upgrade nox pdm==2.26.4
94+
uv sync --locked --group nox
8395
git config --global --add safe.directory '*'
8496
- name: Bundle the distribution
8597
id: bundle
86-
run: nox -vs bundle
98+
run: uv run nox -vs bundle
8799
- name: Sign the bundle
88100
id: sign
89-
run: nox -vs sign
101+
run: uv run nox -vs sign
90102
- name: Generate hashes
91103
id: hashes
92-
run: nox -vs make_dist_digest
104+
run: uv run nox -vs make_dist_digest
93105
- name: Upload the bundle to the GitHub release
94106
uses: softprops/action-gh-release@v2
95107
with:
@@ -104,6 +116,7 @@ jobs:
104116
SM_API_KEY: ${{ secrets.SM_API_KEY }}
105117
SM_CLIENT_CERT_FILE_B64: ${{ secrets.SM_CLIENT_CERT_FILE_B64 }}
106118
SM_CLIENT_CERT_PASSWORD: ${{ secrets. SM_CLIENT_CERT_PASSWORD }}
119+
UV_PYTHON: ${{ env.PYTHON_DEFAULT_VERSION }}
107120
runs-on: windows-2022
108121
steps:
109122
- uses: actions/checkout@v4
@@ -113,12 +126,17 @@ jobs:
113126
uses: actions/setup-python@v6
114127
with:
115128
python-version: ${{ env.PYTHON_DEFAULT_VERSION }}
129+
- uses: astral-sh/setup-uv@v7
130+
with:
131+
version: ${{ env.UV_VERSION }}
132+
enable-cache: true
116133
- name: Install dependencies
117-
run: python -m pip install --upgrade nox pdm==2.26.4
134+
run: |
135+
uv sync --locked --group nox
118136
- name: Bundle the distribution
119137
id: bundle
120138
shell: bash
121-
run: nox -vs bundle
139+
run: uv run nox -vs bundle
122140
- name: Install client for code signing with Software Trust Manager
123141
uses: digicert/ssm-code-signing@v1.1.0
124142
env:
@@ -131,10 +149,10 @@ jobs:
131149
shell: bash
132150
- name: Sign the bundle using a keypair alias
133151
id: sign
134-
run: nox -vs sign -- '${{ secrets.SM_KEYPAIR_ALIAS }}' '${{ secrets.SM_CERT_FINGERPRINT }}'
152+
run: uv run nox -vs sign -- '${{ secrets.SM_KEYPAIR_ALIAS }}' '${{ secrets.SM_CERT_FINGERPRINT }}'
135153
- name: Generate hashes
136154
id: hashes
137-
run: nox -vs make_dist_digest
155+
run: uv run nox -vs make_dist_digest
138156
- name: Create GitHub release and upload the distribution
139157
id: create-release
140158
uses: softprops/action-gh-release@v2
@@ -158,10 +176,15 @@ jobs:
158176
uses: actions/setup-python@v6
159177
with:
160178
python-version: ${{ env.PYTHON_DEFAULT_VERSION }}
179+
- uses: astral-sh/setup-uv@v7
180+
with:
181+
version: ${{ env.UV_VERSION }}
182+
enable-cache: true
161183
- name: Install dependencies
162-
run: python -m pip install --upgrade nox pdm==2.26.4
184+
run: |
185+
uv sync --locked --group nox
163186
- name: Build Dockerfile
164-
run: nox -vs generate_dockerfile
187+
run: uv run nox -vs generate_dockerfile
165188
- name: Set up QEMU
166189
uses: docker/setup-qemu-action@v3
167190
- name: Set up Docker Buildx

.github/workflows/ci.yml

Lines changed: 68 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88

99
env:
1010
PYTHON_DEFAULT_VERSION: "3.12"
11+
UV_VERSION: "0.8.24"
1112

1213
jobs:
1314
lint:
@@ -24,16 +25,21 @@ jobs:
2425
uses: actions/setup-python@v6
2526
with:
2627
python-version: ${{ env.PYTHON_DEFAULT_VERSION }}
28+
- uses: astral-sh/setup-uv@v7
29+
with:
30+
version: ${{ env.UV_VERSION }}
31+
enable-cache: true
2732
- name: Install dependencies
28-
run: python -m pip install --upgrade nox pdm==2.26.4
33+
run: |
34+
uv sync --locked --group nox
2935
- name: Run linters
30-
run: nox -vs lint
36+
run: uv run nox -vs lint
3137
- name: Validate new changelog entries
3238
if: (contains(github.event.pull_request.labels.*.name, '-changelog') == false) && (github.event.pull_request.base.ref != '')
3339
run: if [ -z "$(git diff --diff-filter=A --name-only origin/${{ github.event.pull_request.base.ref }} changelog.d)" ];
3440
then echo no changelog item added; exit 1; fi
3541
- name: Changelog validation
36-
run: nox -vs towncrier_check
42+
run: uv run nox -vs towncrier_check
3743
build:
3844
timeout-minutes: 30
3945
needs: lint
@@ -46,10 +52,15 @@ jobs:
4652
uses: actions/setup-python@v6
4753
with:
4854
python-version: ${{ env.PYTHON_DEFAULT_VERSION }}
55+
- uses: astral-sh/setup-uv@v7
56+
with:
57+
version: ${{ env.UV_VERSION }}
58+
enable-cache: true
4959
- name: Install dependencies
50-
run: python -m pip install --upgrade nox pdm==2.26.4
60+
run: |
61+
uv sync --locked --group nox
5162
- name: Build the distribution
52-
run: nox -vs build
63+
run: uv run nox -vs build
5364
cleanup_buckets:
5465
timeout-minutes: 30
5566
needs: lint
@@ -68,12 +79,18 @@ jobs:
6879
with:
6980
python-version: ${{ env.PYTHON_DEFAULT_VERSION }}
7081
cache: "pip"
82+
- uses: astral-sh/setup-uv@v7
83+
if: ${{ env.B2_TEST_APPLICATION_KEY != '' && env.B2_TEST_APPLICATION_KEY_ID != '' }} # TODO: skip this whole job instead
84+
with:
85+
version: ${{ env.UV_VERSION }}
86+
enable-cache: true
7187
- name: Install dependencies
7288
if: ${{ env.B2_TEST_APPLICATION_KEY != '' && env.B2_TEST_APPLICATION_KEY_ID != '' }} # TODO: skip this whole job instead
73-
run: python -m pip install --upgrade nox pdm==2.26.4
89+
run: |
90+
uv sync --locked --group nox
7491
- name: Find and remove old buckets
7592
if: ${{ env.B2_TEST_APPLICATION_KEY != '' && env.B2_TEST_APPLICATION_KEY_ID != '' }} # TODO: skip this whole job instead
76-
run: nox -vs cleanup_buckets
93+
run: uv run nox -vs cleanup_buckets
7794
test:
7895
timeout-minutes: 90
7996
needs: cleanup_buckets
@@ -100,6 +117,10 @@ jobs:
100117
uses: actions/setup-python@v6
101118
with:
102119
python-version: ${{ matrix.python-version }}
120+
- uses: astral-sh/setup-uv@v7
121+
with:
122+
version: ${{ env.UV_VERSION }}
123+
enable-cache: true
103124
- name: Install test binary dependencies
104125
if: startsWith(matrix.os, 'ubuntu')
105126
run: |
@@ -111,15 +132,16 @@ jobs:
111132
run: |
112133
brew install fish
113134
- name: Install dependencies
114-
run: python -m pip install --upgrade nox pdm==2.26.4
135+
run: |
136+
uv sync --locked --group nox
115137
- name: Run unit tests
116-
run: nox -vs unit -p ${{ matrix.python-version }}
138+
run: uv run nox -vs unit -p ${{ matrix.python-version }}
117139
- name: Run integration tests (without secrets)
118-
run: nox -vs integration -p ${{ matrix.python-version }} -- -m "not require_secrets"
140+
run: uv run nox -vs integration -p ${{ matrix.python-version }} -- -m "not require_secrets"
119141
- name: Run integration tests (with secrets)
120142
# Limit CI workload by running integration tests with secrets only on edge Python versions.
121143
if: ${{ env.B2_TEST_APPLICATION_KEY != '' && env.B2_TEST_APPLICATION_KEY_ID != '' && contains(fromJSON('["3.9", "pypy3.10", "3.14"]'), matrix.python-version) }}
122-
run: nox -vs integration -p ${{ matrix.python-version }} -- -m "require_secrets" --cleanup
144+
run: uv run nox -vs integration -p ${{ matrix.python-version }} -- -m "require_secrets" --cleanup
123145
test-docker:
124146
timeout-minutes: 90
125147
needs: cleanup_buckets
@@ -136,10 +158,15 @@ jobs:
136158
uses: actions/setup-python@v6
137159
with:
138160
python-version: ${{ env.PYTHON_DEFAULT_VERSION }}
161+
- uses: astral-sh/setup-uv@v7
162+
with:
163+
version: ${{ env.UV_VERSION }}
164+
enable-cache: true
139165
- name: Install dependencies
140-
run: python -m pip install --upgrade nox pdm==2.26.4
166+
run: |
167+
uv sync --locked --group nox
141168
- name: Generate Dockerfile
142-
run: nox -vs generate_dockerfile
169+
run: uv run nox -vs generate_dockerfile
143170
- name: Set up QEMU
144171
uses: docker/setup-qemu-action@v3
145172
- name: Set up Docker Buildx
@@ -153,13 +180,14 @@ jobs:
153180
platforms: linux/amd64
154181
- name: Run tests with docker
155182
if: ${{ env.B2_TEST_APPLICATION_KEY != '' && env.B2_TEST_APPLICATION_KEY_ID != '' }}
156-
run: nox -vs docker_test -- backblazeit/b2:test
183+
run: uv run nox -vs docker_test -- backblazeit/b2:test
157184
test-linux-bundle:
158185
timeout-minutes: 90
159186
needs: cleanup_buckets
160187
env:
161188
B2_TEST_APPLICATION_KEY: ${{ secrets.B2_TEST_APPLICATION_KEY }}
162189
B2_TEST_APPLICATION_KEY_ID: ${{ secrets.B2_TEST_APPLICATION_KEY_ID }}
190+
UV_PYTHON: ${{ env.PYTHON_DEFAULT_VERSION }}
163191
WORKFLOW_ID: ${{ github.run_id }}-${{ github.run_attempt }}-${{ github.job }}
164192
runs-on: ${{ matrix.os }}
165193
strategy:
@@ -174,24 +202,28 @@ jobs:
174202
uses: deadsnakes/action@v3.2.0 # staticx doesn't work with python installed by setup-python action
175203
with:
176204
python-version: ${{ env.PYTHON_DEFAULT_VERSION }}
205+
- uses: astral-sh/setup-uv@v7
206+
with:
207+
version: ${{ env.UV_VERSION }}
208+
enable-cache: true
177209
- name: Install dependencies
178210
run: |
179211
sudo apt-get -y update
180212
sudo apt-get -y install patchelf scons
181-
python -m pip install --upgrade nox pdm==2.26.4
213+
uv sync --locked --group nox
182214
git config --global --add safe.directory '*'
183215
- name: Bundle the distribution
184216
id: bundle
185217
shell: bash
186-
run: nox -vs bundle
218+
run: uv run nox -vs bundle
187219
- name: Generate hashes
188220
id: hashes
189-
run: nox -vs make_dist_digest
221+
run: uv run nox -vs make_dist_digest
190222
- name: Run integration tests (without secrets)
191-
run: nox -vs integration -p ${{ env.PYTHON_DEFAULT_VERSION }} -- --sut=${{ steps.bundle.outputs.sut_path }} -m "not require_secrets"
223+
run: uv run nox -vs integration -p ${{ env.PYTHON_DEFAULT_VERSION }} -- --sut=${{ steps.bundle.outputs.sut_path }} -m "not require_secrets"
192224
- name: Run integration tests (with secrets)
193225
if: ${{ env.B2_TEST_APPLICATION_KEY != '' && env.B2_TEST_APPLICATION_KEY_ID != '' }}
194-
run: nox -vs integration -p ${{ env.PYTHON_DEFAULT_VERSION }} -- --sut=${{ steps.bundle.outputs.sut_path }} -m "require_secrets" --cleanup
226+
run: uv run nox -vs integration -p ${{ env.PYTHON_DEFAULT_VERSION }} -- --sut=${{ steps.bundle.outputs.sut_path }} -m "require_secrets" --cleanup
195227
- name: Upload assets
196228
if: failure()
197229
uses: actions/upload-artifact@v4
@@ -206,6 +238,7 @@ jobs:
206238
env:
207239
B2_TEST_APPLICATION_KEY: ${{ secrets.B2_TEST_APPLICATION_KEY }}
208240
B2_TEST_APPLICATION_KEY_ID: ${{ secrets.B2_TEST_APPLICATION_KEY_ID }}
241+
UV_PYTHON: ${{ env.PYTHON_DEFAULT_VERSION }}
209242
WORKFLOW_ID: ${{ github.run_id }}-${{ github.run_attempt }}-${{ github.job }}
210243
runs-on: windows-2022 # keep the version aligned with cd.yml
211244
steps:
@@ -216,20 +249,25 @@ jobs:
216249
uses: actions/setup-python@v6
217250
with:
218251
python-version: ${{ env.PYTHON_DEFAULT_VERSION }}
252+
- uses: astral-sh/setup-uv@v7
253+
with:
254+
version: ${{ env.UV_VERSION }}
255+
enable-cache: true
219256
- name: Install dependencies
220-
run: python -m pip install --upgrade nox pdm==2.26.4
257+
run: |
258+
uv sync --locked --group nox
221259
- name: Bundle the distribution
222260
id: bundle
223261
shell: bash
224-
run: nox -vs bundle
262+
run: uv run nox -vs bundle
225263
- name: Generate hashes
226264
id: hashes
227-
run: nox -vs make_dist_digest
265+
run: uv run nox -vs make_dist_digest
228266
- name: Run integration tests (without secrets)
229-
run: nox -vs integration -p ${{ env.PYTHON_DEFAULT_VERSION }} -- --sut=${{ steps.bundle.outputs.sut_path }} -m "not require_secrets"
267+
run: uv run nox -vs integration -p ${{ env.PYTHON_DEFAULT_VERSION }} -- --sut=${{ steps.bundle.outputs.sut_path }} -m "not require_secrets"
230268
- name: Run integration tests (with secrets)
231269
if: ${{ env.B2_TEST_APPLICATION_KEY != '' && env.B2_TEST_APPLICATION_KEY_ID != '' }}
232-
run: nox -vs integration -p ${{ env.PYTHON_DEFAULT_VERSION }} -- --sut=${{ steps.bundle.outputs.sut_path }} -m "require_secrets" --cleanup
270+
run: uv run nox -vs integration -p ${{ env.PYTHON_DEFAULT_VERSION }} -- --sut=${{ steps.bundle.outputs.sut_path }} -m "require_secrets" --cleanup
233271
- name: Upload assets
234272
if: failure()
235273
uses: actions/upload-artifact@v4
@@ -250,12 +288,16 @@ jobs:
250288
uses: actions/setup-python@v6
251289
with:
252290
python-version: ${{ env.PYTHON_DEFAULT_VERSION }}
291+
- uses: astral-sh/setup-uv@v7
292+
with:
293+
version: ${{ env.UV_VERSION }}
294+
enable-cache: true
253295
- name: Install dependencies
254296
env:
255297
DEBIAN_FRONTEND: noninteractive
256298
run: |
257299
sudo apt-get update -y
258300
sudo apt-get install -y graphviz plantuml
259-
python -m pip install --upgrade nox pdm==2.26.4
301+
uv sync --locked --group nox
260302
- name: Build the docs
261-
run: nox --non-interactive -vs doc
303+
run: uv run nox --non-interactive -vs doc

CONTRIBUTING.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ for a given github issue).
5555

5656
## Developer Info
5757

58-
You'll need to have [nox](https://github.com/theacodes/nox) and [pdm](https://pdm-project.org/) installed:
58+
You'll need to have [nox](https://github.com/theacodes/nox) and [uv](https://docs.astral.sh/uv/) installed:
5959

60-
* `pip install nox pdm`
60+
* `pip install nox uv`
6161

6262
With `nox`, you can run different sessions (default are `lint` and `test`):
6363

@@ -106,10 +106,10 @@ Given Python interpreters should be installed in the operating system or via [py
106106

107107
## Managing dependencies
108108

109-
We use [pdm](https://pdm-project.org/) for managing dependencies and developing locally.
109+
We use [uv](https://docs.astral.sh/uv/) for managing dependencies and developing locally.
110110
If you want to change any of the project requirements (or requirement bounds) in `pyproject.toml`,
111-
make sure that `pdm.lock` file reflects those changes by using `pdm add`, `pdm update` or other
112-
commands - see [documentation](https://pdm-project.org/latest/). You can verify that lock file
111+
make sure that `uv.lock` file reflects those changes by using `uv add`, `uv lock` or other
112+
commands - see [documentation](https://docs.astral.sh/uv/). You can verify that lock file
113113
is up to date by running the linter.
114114

115115
## Linting
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Migrate from pdm to uv.

0 commit comments

Comments
 (0)