10
10
11
11
env :
12
12
COLUMNS : 150
13
+ UV_PYTHON : 3.13
13
14
14
15
jobs :
15
16
coverage :
@@ -30,26 +31,27 @@ jobs:
30
31
31
32
- run : rustup component add llvm-tools-preview
32
33
33
- - name : set up python
34
- uses : actions /setup-python@v5
34
+ - name : install uv
35
+ uses : astral-sh /setup-uv@v3
35
36
with :
36
- python-version : ' 3.13 '
37
+ enable-cache : true
37
38
38
- - run : pip install -r tests/requirements.txt
39
+ - name : install deps
40
+ run : uv sync --group testing
39
41
40
42
- run : rustc --version --verbose
41
43
42
- - run : pip install -e .
44
+ - run : make build-dev
43
45
env :
44
46
RUST_BACKTRACE : 1
45
47
RUSTFLAGS : ' -C instrument-coverage'
46
48
47
- - run : pip freeze
49
+ - run : uv pip freeze
48
50
49
- - run : coverage run -m pytest
51
+ - run : uv run coverage run -m pytest
50
52
51
53
- run : ls -lha
52
- - run : coverage xml
54
+ - run : uv run coverage xml
53
55
54
56
- run : coverage-prepare lcov python/pydantic_core/*.so
55
57
@@ -85,24 +87,27 @@ jobs:
85
87
with :
86
88
key : test-v3
87
89
88
- - name : set up python
89
- uses : actions /setup-python@v5
90
+ - name : install uv
91
+ uses : astral-sh /setup-uv@v3
90
92
with :
91
- python-version : ${{ matrix.python-version }}
92
- allow-prereleases : true
93
+ enable-cache : true
93
94
94
- - run : pip install -r tests/requirements.txt
95
+ - name : install deps
96
+ run : uv sync --group testing
95
97
96
- - run : pip install -e .
98
+ - run : uv pip install -e .
97
99
env :
98
100
RUST_BACKTRACE : 1
99
101
100
- - run : pip freeze
102
+ - run : uv pip freeze
101
103
102
- - run : pytest
104
+ - run : uv run pytest
103
105
env :
104
106
HYPOTHESIS_PROFILE : slow
105
107
108
+ env :
109
+ UV_PYTHON : ${{ matrix.python-version }}
110
+
106
111
test-os :
107
112
name : test on ${{ matrix.os }}
108
113
@@ -121,20 +126,21 @@ jobs:
121
126
- name : cache rust
122
127
uses : Swatinem/rust-cache@v2
123
128
124
- - name : set up python
125
- uses : actions /setup-python@v5
129
+ - name : install uv
130
+ uses : astral-sh /setup-uv@v3
126
131
with :
127
- python-version : ' 3.13 '
132
+ enable-cache : true
128
133
129
- - run : pip install -r tests/requirements.txt
134
+ - name : install deps
135
+ run : uv sync --group testing
130
136
131
- - run : pip install -e .
137
+ - run : uv pip install -e .
132
138
env :
133
139
RUST_BACKTRACE : 1
134
140
135
- - run : pip freeze
141
+ - run : uv pip freeze
136
142
137
- - run : pytest
143
+ - run : uv run pytest
138
144
139
145
- run : cargo test
140
146
@@ -145,14 +151,17 @@ jobs:
145
151
steps :
146
152
- uses : actions/checkout@v4
147
153
148
- - name : set up python
149
- uses : actions /setup-python@v5
154
+ - name : install uv
155
+ uses : astral-sh /setup-uv@v3
150
156
with :
151
- python-version : ' 3.13'
157
+ enable-cache : true
158
+
159
+ - name : install deps
160
+ run : uv sync --group testing
152
161
153
162
- name : resolve MSRV
154
163
id : resolve-msrv
155
- run : echo MSRV=`python -c 'import tomllib; print(tomllib.load(open("Cargo.toml", "rb"))["package"]["rust-version"])'` >> $GITHUB_OUTPUT
164
+ run : echo MSRV=`uv run python -c 'import tomllib; print(tomllib.load(open("Cargo.toml", "rb"))["package"]["rust-version"])'` >> $GITHUB_OUTPUT
156
165
157
166
- name : install rust MSRV
158
167
uses : dtolnay/rust-toolchain@master
@@ -162,15 +171,13 @@ jobs:
162
171
- name : cache rust
163
172
uses : Swatinem/rust-cache@v2
164
173
165
- - run : pip install -r tests/requirements.txt
166
-
167
- - run : pip install -e .
174
+ - run : uv pip install -e .
168
175
env :
169
176
RUST_BACKTRACE : 1
170
177
171
- - run : pip freeze
178
+ - run : uv pip freeze
172
179
173
- - run : pytest
180
+ - run : uv run pytest
174
181
175
182
- run : cargo test
176
183
@@ -188,22 +195,28 @@ jobs:
188
195
189
196
steps :
190
197
- uses : actions/checkout@v4
191
- - name : set up python
192
- uses : actions/setup-python@v5
198
+
199
+ - name : install uv
200
+ uses : astral-sh/setup-uv@v3
193
201
with :
194
- python-version : ${{ matrix.python-version }}
202
+ enable-cache : true
195
203
196
204
- name : install rust stable
197
205
uses : dtolnay/rust-toolchain@stable
198
206
199
207
- name : cache rust
200
208
uses : Swatinem/rust-cache@v2
201
209
202
- - run : pip install -r tests/requirements.txt
210
+ - name : install deps
211
+ run : uv sync --group testing
212
+
203
213
- run : make build-dev
204
214
205
- - run : pip freeze
206
- - run : pytest
215
+ - run : uv pip freeze
216
+ - run : uv run pytest
217
+
218
+ env :
219
+ UV_PYTHON : ${{ matrix.python-version }}
207
220
208
221
test-pydantic-integration :
209
222
runs-on : ubuntu-latest
@@ -232,20 +245,24 @@ jobs:
232
245
233
246
- name : install deps
234
247
run : |
235
- uv sync --python 3.13 -- extra timezone
248
+ uv sync --extra timezone
236
249
uv pip install maturin pip
237
- uv run bash -c 'cd ../pydantic-core && make build-dev '
250
+ uv run bash -c 'cd ../pydantic-core && maturin develop '
238
251
working-directory : pydantic
239
252
240
253
- run : uv --version && uv pip list
241
254
working-directory : pydantic
242
- # Run pytest with lax xfail because we often add tests to pydantic
243
- # which xfail on a pending release of pydantic-core
255
+
256
+ # Run pytest with lax xfail because we often add tests to pydantic
257
+ # which xfail on a pending release of pydantic-core
244
258
- run : uv run pytest --override-ini=xfail_strict=False
245
259
working-directory : pydantic
246
260
env :
247
261
PYDANTIC_PRIVATE_ALLOW_UNHANDLED_SCHEMA_TYPES : 1
248
262
263
+ env :
264
+ UV_PROJECT_ENVIRONMENT : ${{ github.workspace }}/.venv
265
+
249
266
lint :
250
267
runs-on : ubuntu-latest
251
268
@@ -260,32 +277,21 @@ jobs:
260
277
- name : cache rust
261
278
uses : Swatinem/rust-cache@v2
262
279
263
- - uses : actions/setup-python@v5
264
- with :
265
- python-version : ' 3.13'
266
-
267
280
# used to lint js code
268
281
- uses : actions/setup-node@v4
269
282
with :
270
283
node-version : ' 18'
271
284
272
- - uses : actions/cache@v4
273
- id : cache-py
274
- name : cache python
285
+ - name : install uv
286
+ uses : astral-sh/setup-uv@v3
275
287
with :
276
- path : ${{ env.pythonLocation }}
277
- key : >
278
- py
279
- ${{ env.pythonLocation }}
280
- ${{ hashFiles('tests/requirements-linting.txt') }}
281
- ${{ hashFiles('pyproject.toml') }}
282
-
283
- - run : pip install -r tests/requirements-linting.txt
284
- if : steps.cache-py.outputs.cache-hit != 'true'
285
-
286
- - run : make build-dev
288
+ enable-cache : true
287
289
288
- - run : pip freeze
290
+ - name : install deps
291
+ run : |
292
+ uv sync --group linting
293
+ make build-dev
294
+ uv pip freeze
289
295
290
296
- run : make lint
291
297
- run : make pyright
@@ -319,12 +325,6 @@ jobs:
319
325
steps :
320
326
- uses : actions/checkout@v4
321
327
322
- - name : set up python
323
- id : setup-python
324
- uses : actions/setup-python@v5
325
- with :
326
- python-version : ' 3.13'
327
-
328
328
- name : install rust nightly
329
329
uses : dtolnay/rust-toolchain@nightly
330
330
with :
@@ -342,7 +342,13 @@ jobs:
342
342
version : ' 3.1.58'
343
343
actions-cache-folder : emsdk-cache
344
344
345
- - run : pip install 'maturin>=1,<2' 'ruff==0.5.0' typing_extensions
345
+ - name : install uv
346
+ uses : astral-sh/setup-uv@v3
347
+ with :
348
+ enable-cache : true
349
+
350
+ - name : install deps
351
+ run : uv sync --group wasm
346
352
347
353
- name : build wheels
348
354
run : make build-wasm
@@ -364,6 +370,9 @@ jobs:
364
370
name : wasm_wheels
365
371
path : dist
366
372
373
+ env :
374
+ UV_PYTHON : 3.12
375
+
367
376
# https://github.com/marketplace/actions/alls-green#why used for branch protection checks
368
377
check :
369
378
if : always()
@@ -533,11 +542,10 @@ jobs:
533
542
steps :
534
543
- uses : actions/checkout@v4
535
544
536
- - name : set up python
537
- uses : actions /setup-python@v5
545
+ - name : install uv
546
+ uses : astral-sh /setup-uv@v3
538
547
with :
539
- python-version : ${{ matrix.interpreter }}
540
- allow-prereleases : true
548
+ enable-cache : true
541
549
542
550
- name : install rust stable
543
551
id : rust-toolchain
@@ -572,10 +580,9 @@ jobs:
572
580
573
581
- name : generate pgo data
574
582
run : |
575
- pip install -U pip
576
- pip install -r tests/requirements.txt
577
- pip install pydantic-core --no-index --no-deps --find-links pgo-wheel --force-reinstall
578
- pytest tests/benchmarks
583
+ uv sync --group testing
584
+ uv pip install pydantic-core --no-index --no-deps --find-links pgo-wheel --force-reinstall
585
+ uv run pytest tests/benchmarks
579
586
rustup run ${{ steps.rust-toolchain.outputs.name }} bash -c 'echo LLVM_PROFDATA=$RUSTUP_HOME/toolchains/$RUSTUP_TOOLCHAIN/lib/rustlib/${{ env.RUST_HOST }}/bin/llvm-profdata >> "$GITHUB_ENV"'
580
587
581
588
- name : merge pgo data
@@ -601,6 +608,9 @@ jobs:
601
608
name : pypi_files_${{ matrix.os }}_${{ matrix.interpreter }}
602
609
path : dist
603
610
611
+ env :
612
+ UV_PYTHON : ${{ matrix.interpreter }}
613
+
604
614
inspect-pypi-assets :
605
615
needs : [build, build-sdist, build-pgo]
606
616
runs-on : ubuntu-latest
@@ -667,20 +677,20 @@ jobs:
667
677
if command -v apt-get &> /dev/null; then
668
678
echo "installing python & pip with apt-get..."
669
679
apt-get update
670
- apt-get install -y --no-install-recommends python3 python3-pip python3-venv git
680
+ apt-get install -y --no-install-recommends python3 python3-pip python3-venv git curl
671
681
else
672
682
echo "installing python & pip with apk..."
673
683
apk update
674
- apk add python3 py3-pip git
684
+ apk add python3 py3-pip git curl
675
685
fi
676
686
run : |
677
687
set -x
678
- python3 -m venv venv
679
- source venv/ bin/activate
680
- python3 -m pip install -r tests/requirements.txt
681
- python3 -m pip install pydantic-core --no-index --no-deps --find-links dist --force-reinstall
682
- python3 -m pytest --ignore=tests/test_docstrings.py
683
- python3 -c 'import pydantic_core._pydantic_core; print(pydantic_core._pydantic_core.__version__)'
688
+ curl -LsSf https://astral.sh/uv/install.sh | sh
689
+ source $HOME/.local/ bin/env
690
+ uv sync --frozen --group testing --no-install-project
691
+ uv pip install pydantic-core --no-index --no-deps --find-links dist --force-reinstall
692
+ uv run --no-sync pytest --ignore=tests/test_docstrings.py
693
+ uv run --no-sync python -c 'import pydantic_core._pydantic_core; print(pydantic_core._pydantic_core.__version__)'
684
694
685
695
test-builds-os :
686
696
name : test build on ${{ matrix.os }}
@@ -695,10 +705,10 @@ jobs:
695
705
steps :
696
706
- uses : actions/checkout@v4
697
707
698
- - name : set up python
699
- uses : actions /setup-python@v5
708
+ - name : install uv
709
+ uses : astral-sh /setup-uv@v3
700
710
with :
701
- python-version : ' 3.13 '
711
+ enable-cache : true
702
712
703
713
- name : get dist artifacts
704
714
uses : actions/download-artifact@v4
@@ -707,9 +717,9 @@ jobs:
707
717
merge-multiple : true
708
718
path : dist
709
719
710
- - run : pip install -r tests/requirements.txt
711
- - run : pip install pydantic-core --no-index --no-deps --find-links dist --force-reinstall
712
- - run : pytest --ignore=tests/test_docstrings.py
720
+ - run : uv sync --group testing
721
+ - run : uv pip install pydantic-core --no-index --no-deps --find-links dist --force-reinstall
722
+ - run : uv run pytest --ignore=tests/test_docstrings.py
713
723
714
724
release :
715
725
needs : [test-builds-arch, test-builds-os, build-sdist, check]
0 commit comments