Skip to content

Commit 444d594

Browse files
authored
chore: Move to uv (litestar-org#3875)
1 parent 379bca6 commit 444d594

File tree

9 files changed

+4740
-5419
lines changed

9 files changed

+4740
-5419
lines changed

.github/workflows/ci.yml

+45-80
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ on:
88
- main
99
- v1.51
1010

11+
env:
12+
UV_LOCKED: 1
13+
1114
jobs:
1215
validate:
1316
runs-on: ubuntu-latest
@@ -41,21 +44,14 @@ jobs:
4144
python-version: "3.8"
4245
allow-prereleases: true
4346

44-
- uses: pdm-project/setup-pdm@v4
45-
name: Set up PDM
47+
- name: Install uv
48+
uses: astral-sh/setup-uv@v4
4649
with:
47-
python-version: "3.8"
48-
version: "2.20.1"
49-
allow-python-prereleases: false
50-
cache: true
51-
cache-dependency-path: |
52-
./pdm.lock
53-
54-
- name: Install dependencies
55-
run: pdm install -G:all
50+
version: "0.5.4"
51+
enable-cache: true
5652

5753
- name: Run mypy
58-
run: pdm run mypy
54+
run: uv run mypy
5955

6056
pyright:
6157
runs-on: ubuntu-latest
@@ -67,21 +63,14 @@ jobs:
6763
python-version: "3.8"
6864
allow-prereleases: true
6965

70-
- uses: pdm-project/setup-pdm@v4
71-
name: Set up PDM
66+
- name: Install uv
67+
uses: astral-sh/setup-uv@v4
7268
with:
73-
python-version: "3.8"
74-
version: "2.20.1"
75-
allow-python-prereleases: false
76-
cache: true
77-
cache-dependency-path: |
78-
./pdm.lock
79-
80-
- name: Install dependencies
81-
run: pdm install -G:all
69+
version: "0.5.4"
70+
enable-cache: true
8271

8372
- name: Run pyright
84-
run: pdm run pyright
73+
run: uv run pyright
8574

8675
slotscheck:
8776
runs-on: ubuntu-latest
@@ -93,21 +82,14 @@ jobs:
9382
python-version: "3.8"
9483
allow-prereleases: false
9584

96-
- uses: pdm-project/setup-pdm@v4
97-
name: Set up PDM
85+
- name: Install uv
86+
uses: astral-sh/setup-uv@v4
9887
with:
99-
python-version: "3.8"
100-
version: "2.20.1"
101-
allow-python-prereleases: false
102-
cache: true
103-
cache-dependency-path: |
104-
./pdm.lock
105-
106-
- name: Install dependencies
107-
run: pdm install -G:all
88+
version: "0.5.4"
89+
enable-cache: true
10890

10991
- name: Run slotscheck
110-
run: pdm run slotscheck litestar
92+
run: uv run slotscheck litestar
11193

11294
test:
11395
name: "test (${{ matrix.python-version }})"
@@ -135,25 +117,22 @@ jobs:
135117
with:
136118
python-version: 3.11
137119

138-
- uses: pdm-project/setup-pdm@v4
139-
name: Set up PDM
120+
- name: Install uv
121+
uses: astral-sh/setup-uv@v4
140122
with:
141-
python-version: 3.11
142-
allow-python-prereleases: false
143-
cache: true
144-
cache-dependency-path: |
145-
./pdm.lock
123+
version: "0.5.4"
124+
enable-cache: true
146125

147126
- name: Install dependencies
148127
run: |
149-
pdm install -G:all
150-
pip install -U "${{ matrix.uvicorn-version }}"
128+
uv sync
129+
uv pip install -U "${{ matrix.uvicorn-version }}"
151130
152131
- name: Set PYTHONPATH
153132
run: echo "PYTHONPATH=$PWD" >> $GITHUB_ENV
154133

155134
- name: Test
156-
run: pdm run pytest tests -m server_integration
135+
run: uv run --no-sync pytest tests -m server_integration
157136

158137
test-platform-compat:
159138
if: github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'test platform compat')
@@ -217,25 +196,19 @@ jobs:
217196
python-version: "3.12"
218197
allow-prereleases: true
219198

220-
- uses: pdm-project/setup-pdm@v4
221-
name: Set up PDM
199+
- name: Install uv
200+
uses: astral-sh/setup-uv@v4
222201
with:
223-
python-version: "3.12"
224-
allow-python-prereleases: false
225-
cache: true
226-
cache-dependency-path: |
227-
./pdm.lock
228-
229-
- name: Install dependencies
230-
run: pdm install -G:all
202+
version: "0.5.4"
203+
enable-cache: true
231204

232205
- name: Build docs
233-
run: pdm run make docs
206+
run: uv run make docs
234207

235208
- name: Check docs links
236209
env:
237210
LITESTAR_DOCS_IGNORE_MISSING_EXAMPLE_OUTPUT: 1
238-
run: pdm run make docs-linkcheck
211+
run: uv run make docs-linkcheck
239212

240213
- name: Save PR number
241214
run: |
@@ -264,23 +237,19 @@ jobs:
264237
with:
265238
python-version: "3.12"
266239

267-
- uses: pdm-project/setup-pdm@v4
268-
name: Set up PDM
240+
- name: Install uv
241+
uses: astral-sh/setup-uv@v4
269242
with:
270-
python-version: "3.12"
271-
allow-python-prereleases: false
272-
cache: true
273-
cache-dependency-path: |
274-
./pdm.lock
275-
276-
- name: Install dependencies
277-
run: pdm install
243+
version: "0.5.4"
244+
enable-cache: true
278245

279246
- name: Set pythonpath
280247
run: echo "PYTHONPATH=$PWD" >> $GITHUB_ENV
281248

282249
- name: Test
283-
run: mv tests/examples/test_hello_world.py test_hello_world.py && pdm run pytest test_hello_world.py
250+
run: |
251+
mv tests/examples/test_hello_world.py test_hello_world.py
252+
uv run pytest test_hello_world.py
284253
285254
test_pydantic_1_app:
286255
name: Test Minimal Pydantic 1 application
@@ -296,26 +265,22 @@ jobs:
296265
with:
297266
python-version: "3.12"
298267

299-
- uses: pdm-project/setup-pdm@v4
300-
name: Set up PDM
268+
- name: Install uv
269+
uses: astral-sh/setup-uv@v4
301270
with:
302-
python-version: "3.12"
303-
allow-python-prereleases: false
304-
cache: true
305-
cache-dependency-path: |
306-
./pdm.lock
271+
version: "0.5.4"
272+
enable-cache: true
307273

308274
- name: Install dependencies
309275
run: |
310-
pdm install
311-
pdm run python -m ensurepip
312-
pdm run python -m pip install "pydantic==1.*"
276+
uv sync
277+
uv pip install "pydantic==1.*"
313278
314279
- name: Set pythonpath
315280
run: echo "PYTHONPATH=$PWD" >> $GITHUB_ENV
316281

317282
- name: Test
318-
run: pdm run coverage run --branch -m unittest test_apps/pydantic_1_app.py
283+
run: uv run --no-sync coverage run --branch -m unittest test_apps/pydantic_1_app.py
319284

320285
- name: Rename coverage file
321286
run: mv .coverage* .coverage.pydantic_v1

.github/workflows/docs.yml

+11-11
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ on:
88
- main
99
- v3.0
1010

11+
env:
12+
UV_LOCKED: 1
13+
1114
jobs:
1215
docs:
1316
permissions:
@@ -20,31 +23,28 @@ jobs:
2023
with:
2124
python-version: "3.12"
2225

23-
- uses: pdm-project/setup-pdm@v4
24-
name: Set up PDM
26+
- name: Install uv
27+
uses: astral-sh/setup-uv@v4
2528
with:
26-
python-version: "3.12"
27-
allow-python-prereleases: false
28-
cache: true
29-
cache-dependency-path: |
30-
./pdm.lock
29+
version: "0.5.4"
30+
enable-cache: true
3131

3232
- name: Install dependencies
33-
run: pdm sync -G:all
33+
run: uv sync
3434

3535
- name: Fetch gh pages
3636
run: git fetch origin gh-pages --depth=1
3737

3838
- name: Build release docs
39-
run: pdm run python tools/build_docs.py docs-build
39+
run: uv run python tools/build_docs.py docs-build
4040
if: github.event_name == 'release'
4141

4242
- name: Build docs (main branch)
43-
run: pdm run python tools/build_docs.py docs-build --version main
43+
run: uv run python tools/build_docs.py docs-build --version main
4444
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
4545

4646
- name: Build docs (v3.0 branch)
47-
run: pdm run python tools/build_docs.py docs-build --version 3-dev
47+
run: uv run python tools/build_docs.py docs-build --version 3-dev
4848
if: github.event_name == 'push' && github.ref == 'refs/heads/v3.0'
4949

5050
- name: Deploy

.github/workflows/publish.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@ jobs:
2121
with:
2222
python-version: "3.12"
2323

24-
- uses: pdm-project/setup-pdm@v4
25-
name: Set up PDM
24+
- name: Install uv
25+
uses: astral-sh/setup-uv@v4
2626
with:
27-
python-version: "3.12"
28-
cache: true
27+
version: "0.5.4"
28+
enable-cache: true
2929

3030
- name: Build package
31-
run: pdm build
31+
run: uv build
3232

3333
- name: Publish package distributions to PyPI
3434
uses: pypa/gh-action-pypi-publish@release/v1

.github/workflows/test.yml

+10-11
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ on:
1919
type: number
2020
default: 10
2121

22+
env:
23+
UV_LOCKED: 1
24+
2225
jobs:
2326
test:
2427
runs-on: ${{ inputs.os }}
@@ -35,29 +38,25 @@ jobs:
3538
with:
3639
python-version: ${{ inputs.python-version }}
3740

38-
- uses: pdm-project/setup-pdm@v4
39-
name: Set up PDM
41+
- name: Install uv
42+
uses: astral-sh/setup-uv@v4
4043
with:
41-
python-version: ${{ inputs.python-version }}
42-
version: ${{ inputs.python-version == '3.8' && '2.20.1' || ''}}
43-
allow-python-prereleases: false
44-
cache: true
45-
cache-dependency-path: |
46-
./pdm.lock
44+
version: "0.5.4"
45+
enable-cache: true
4746

4847
- name: Install dependencies
49-
run: pdm install -G:all
48+
run: uv sync
5049

5150
- name: Set PYTHONPATH
5251
run: echo "PYTHONPATH=$PWD" >> $GITHUB_ENV
5352

5453
- name: Test
5554
if: ${{ !inputs.coverage }}
56-
run: pdm run pytest docs/examples tests -n auto
55+
run: uv run pytest docs/examples tests -n auto
5756

5857
- name: Test with coverage
5958
if: inputs.coverage
60-
run: pdm run pytest docs/examples tests -n auto --cov
59+
run: uv run pytest docs/examples tests -n auto --cov
6160

6261
- name: Rename coverage file
6362
if: inputs.coverage

0 commit comments

Comments
 (0)