1010
1111env :
1212 COLUMNS : 150
13+ UV_PYTHON : 3.13
1314
1415jobs :
1516 coverage :
@@ -30,26 +31,27 @@ jobs:
3031
3132 - run : rustup component add llvm-tools-preview
3233
33- - name : set up python
34- uses : actions /setup-python@v5
34+ - name : install uv
35+ uses : astral-sh /setup-uv@v3
3536 with :
36- python-version : ' 3.13 '
37+ enable-cache : true
3738
38- - run : pip install -r tests/requirements.txt
39+ - name : install deps
40+ run : uv sync --group testing
3941
4042 - run : rustc --version --verbose
4143
42- - run : pip install -e .
44+ - run : make build-dev
4345 env :
4446 RUST_BACKTRACE : 1
4547 RUSTFLAGS : ' -C instrument-coverage'
4648
47- - run : pip freeze
49+ - run : uv pip freeze
4850
49- - run : coverage run -m pytest
51+ - run : uv run coverage run -m pytest
5052
5153 - run : ls -lha
52- - run : coverage xml
54+ - run : uv run coverage xml
5355
5456 - run : coverage-prepare lcov python/pydantic_core/*.so
5557
@@ -85,24 +87,27 @@ jobs:
8587 with :
8688 key : test-v3
8789
88- - name : set up python
89- uses : actions /setup-python@v5
90+ - name : install uv
91+ uses : astral-sh /setup-uv@v3
9092 with :
91- python-version : ${{ matrix.python-version }}
92- allow-prereleases : true
93+ enable-cache : true
9394
94- - run : pip install -r tests/requirements.txt
95+ - name : install deps
96+ run : uv sync --group testing
9597
96- - run : pip install -e .
98+ - run : uv pip install -e .
9799 env :
98100 RUST_BACKTRACE : 1
99101
100- - run : pip freeze
102+ - run : uv pip freeze
101103
102- - run : pytest
104+ - run : uv run pytest
103105 env :
104106 HYPOTHESIS_PROFILE : slow
105107
108+ env :
109+ UV_PYTHON : ${{ matrix.python-version }}
110+
106111 test-os :
107112 name : test on ${{ matrix.os }}
108113
@@ -121,20 +126,21 @@ jobs:
121126 - name : cache rust
122127 uses : Swatinem/rust-cache@v2
123128
124- - name : set up python
125- uses : actions /setup-python@v5
129+ - name : install uv
130+ uses : astral-sh /setup-uv@v3
126131 with :
127- python-version : ' 3.13 '
132+ enable-cache : true
128133
129- - run : pip install -r tests/requirements.txt
134+ - name : install deps
135+ run : uv sync --group testing
130136
131- - run : pip install -e .
137+ - run : uv pip install -e .
132138 env :
133139 RUST_BACKTRACE : 1
134140
135- - run : pip freeze
141+ - run : uv pip freeze
136142
137- - run : pytest
143+ - run : uv run pytest
138144
139145 - run : cargo test
140146
@@ -145,14 +151,17 @@ jobs:
145151 steps :
146152 - uses : actions/checkout@v4
147153
148- - name : set up python
149- uses : actions /setup-python@v5
154+ - name : install uv
155+ uses : astral-sh /setup-uv@v3
150156 with :
151- python-version : ' 3.13'
157+ enable-cache : true
158+
159+ - name : install deps
160+ run : uv sync --group testing
152161
153162 - name : resolve MSRV
154163 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
156165
157166 - name : install rust MSRV
158167 uses : dtolnay/rust-toolchain@master
@@ -162,15 +171,13 @@ jobs:
162171 - name : cache rust
163172 uses : Swatinem/rust-cache@v2
164173
165- - run : pip install -r tests/requirements.txt
166-
167- - run : pip install -e .
174+ - run : uv pip install -e .
168175 env :
169176 RUST_BACKTRACE : 1
170177
171- - run : pip freeze
178+ - run : uv pip freeze
172179
173- - run : pytest
180+ - run : uv run pytest
174181
175182 - run : cargo test
176183
@@ -188,22 +195,28 @@ jobs:
188195
189196 steps :
190197 - 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
193201 with :
194- python-version : ${{ matrix.python-version }}
202+ enable-cache : true
195203
196204 - name : install rust stable
197205 uses : dtolnay/rust-toolchain@stable
198206
199207 - name : cache rust
200208 uses : Swatinem/rust-cache@v2
201209
202- - run : pip install -r tests/requirements.txt
210+ - name : install deps
211+ run : uv sync --group testing
212+
203213 - run : make build-dev
204214
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 }}
207220
208221 test-pydantic-integration :
209222 runs-on : ubuntu-latest
@@ -232,20 +245,24 @@ jobs:
232245
233246 - name : install deps
234247 run : |
235- uv sync --python 3.13 -- extra timezone
248+ uv sync --extra timezone
236249 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 '
238251 working-directory : pydantic
239252
240253 - run : uv --version && uv pip list
241254 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
244258 - run : uv run pytest --override-ini=xfail_strict=False
245259 working-directory : pydantic
246260 env :
247261 PYDANTIC_PRIVATE_ALLOW_UNHANDLED_SCHEMA_TYPES : 1
248262
263+ env :
264+ UV_PROJECT_ENVIRONMENT : ${{ github.workspace }}/.venv
265+
249266 lint :
250267 runs-on : ubuntu-latest
251268
@@ -260,32 +277,21 @@ jobs:
260277 - name : cache rust
261278 uses : Swatinem/rust-cache@v2
262279
263- - uses : actions/setup-python@v5
264- with :
265- python-version : ' 3.13'
266-
267280 # used to lint js code
268281 - uses : actions/setup-node@v4
269282 with :
270283 node-version : ' 18'
271284
272- - uses : actions/cache@v4
273- id : cache-py
274- name : cache python
285+ - name : install uv
286+ uses : astral-sh/setup-uv@v3
275287 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
287289
288- - run : pip freeze
290+ - name : install deps
291+ run : |
292+ uv sync --group linting
293+ make build-dev
294+ uv pip freeze
289295
290296 - run : make lint
291297 - run : make pyright
@@ -319,12 +325,6 @@ jobs:
319325 steps :
320326 - uses : actions/checkout@v4
321327
322- - name : set up python
323- id : setup-python
324- uses : actions/setup-python@v5
325- with :
326- python-version : ' 3.13'
327-
328328 - name : install rust nightly
329329 uses : dtolnay/rust-toolchain@nightly
330330 with :
@@ -342,7 +342,13 @@ jobs:
342342 version : ' 3.1.58'
343343 actions-cache-folder : emsdk-cache
344344
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
346352
347353 - name : build wheels
348354 run : make build-wasm
@@ -364,6 +370,9 @@ jobs:
364370 name : wasm_wheels
365371 path : dist
366372
373+ env :
374+ UV_PYTHON : 3.12
375+
367376 # https://github.com/marketplace/actions/alls-green#why used for branch protection checks
368377 check :
369378 if : always()
@@ -533,11 +542,10 @@ jobs:
533542 steps :
534543 - uses : actions/checkout@v4
535544
536- - name : set up python
537- uses : actions /setup-python@v5
545+ - name : install uv
546+ uses : astral-sh /setup-uv@v3
538547 with :
539- python-version : ${{ matrix.interpreter }}
540- allow-prereleases : true
548+ enable-cache : true
541549
542550 - name : install rust stable
543551 id : rust-toolchain
@@ -572,10 +580,9 @@ jobs:
572580
573581 - name : generate pgo data
574582 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
579586 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"'
580587
581588 - name : merge pgo data
@@ -601,6 +608,9 @@ jobs:
601608 name : pypi_files_${{ matrix.os }}_${{ matrix.interpreter }}
602609 path : dist
603610
611+ env :
612+ UV_PYTHON : ${{ matrix.interpreter }}
613+
604614 inspect-pypi-assets :
605615 needs : [build, build-sdist, build-pgo]
606616 runs-on : ubuntu-latest
@@ -667,20 +677,20 @@ jobs:
667677 if command -v apt-get &> /dev/null; then
668678 echo "installing python & pip with apt-get..."
669679 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
671681 else
672682 echo "installing python & pip with apk..."
673683 apk update
674- apk add python3 py3-pip git
684+ apk add python3 py3-pip git curl
675685 fi
676686 run : |
677687 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__)'
684694
685695 test-builds-os :
686696 name : test build on ${{ matrix.os }}
@@ -695,10 +705,10 @@ jobs:
695705 steps :
696706 - uses : actions/checkout@v4
697707
698- - name : set up python
699- uses : actions /setup-python@v5
708+ - name : install uv
709+ uses : astral-sh /setup-uv@v3
700710 with :
701- python-version : ' 3.13 '
711+ enable-cache : true
702712
703713 - name : get dist artifacts
704714 uses : actions/download-artifact@v4
@@ -707,9 +717,9 @@ jobs:
707717 merge-multiple : true
708718 path : dist
709719
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
713723
714724 release :
715725 needs : [test-builds-arch, test-builds-os, build-sdist, check]
0 commit comments