Skip to content

Commit db83e83

Browse files
authored
feat: move to uv (#24)
Move to UV. Various type improvements. Enabled 3.13 tests.
1 parent bb12099 commit db83e83

22 files changed

Lines changed: 3070 additions & 2601 deletions

.github/workflows/cd.yaml

Lines changed: 0 additions & 27 deletions
This file was deleted.

.github/workflows/ci.yaml

Lines changed: 115 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,28 @@ on:
66
branches:
77
- main
88

9+
concurrency:
10+
group: test-${{ github.head_ref }}
11+
cancel-in-progress: true
12+
13+
914
jobs:
1015
validate:
1116
runs-on: ubuntu-latest
1217
steps:
1318
- uses: actions/checkout@v4
1419

15-
- uses: actions/setup-python@v5
16-
with:
17-
python-version: "3.11"
20+
- name: Install uv
21+
uses: astral-sh/setup-uv@v6
22+
23+
- name: Set up Python
24+
run: uv python install 3.12
25+
26+
- name: Create virtual environment
27+
run: uv sync --all-extras --dev
1828

19-
- name: Install Pre-Commit
20-
run: python -m pip install pre-commit && pre-commit install
29+
- name: Install Pre-Commit hooks
30+
run: uv run pre-commit install
2131

2232
- name: Load cached Pre-Commit Dependencies
2333
id: cached-pre-commit-dependencies
@@ -27,32 +37,102 @@ jobs:
2737
key: pre-commit|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }}
2838

2939
- name: Execute Pre-Commit
30-
run: pre-commit run --show-diff-on-failure --color=always --all-files
40+
run: uv run pre-commit run --show-diff-on-failure --color=always --all-files
41+
mypy:
42+
runs-on: ubuntu-latest
43+
steps:
44+
- uses: actions/checkout@v4
3145

32-
test:
46+
- name: Install uv
47+
uses: astral-sh/setup-uv@v6
48+
49+
- name: Set up Python
50+
run: uv python install 3.13
51+
52+
- name: Install dependencies
53+
run: uv sync --all-extras --dev
54+
55+
- name: Run mypy
56+
run: uv run mypy
57+
58+
pyright:
59+
runs-on: ubuntu-latest
60+
steps:
61+
- uses: actions/checkout@v4
62+
63+
- name: Install uv
64+
uses: astral-sh/setup-uv@v6
65+
66+
- name: Set up Python
67+
run: uv python install 3.13
68+
69+
- name: Install dependencies
70+
run: uv sync --all-extras --dev
71+
72+
- name: Run pyright
73+
run: uv run pyright
74+
75+
# # TODO(cofin)
76+
# # AttributeError: 'SuiteRequirements' object has no attribute 'computed_reflects_normally'
77+
slotscheck:
3378
runs-on: ubuntu-latest
79+
steps:
80+
- uses: actions/checkout@v4
81+
82+
- name: Install uv
83+
uses: astral-sh/setup-uv@v6
84+
85+
- name: Set up Python
86+
run: uv python install 3.13
87+
88+
- name: Install dependencies
89+
run: uv sync --all-extras --dev
90+
91+
test:
92+
name: "test (${{ matrix.python-version }}"
3493
strategy:
3594
fail-fast: true
3695
matrix:
37-
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
38-
timeout-minutes: 30
39-
defaults:
40-
run:
41-
shell: bash
96+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
97+
uses: ./.github/workflows/test.yml
98+
with:
99+
coverage: ${{ matrix.python-version == '3.13' }}
100+
python-version: ${{ matrix.python-version }}
101+
codecov:
102+
needs:
103+
- test
104+
- validate
105+
runs-on: ubuntu-latest
106+
permissions:
107+
security-events: write
42108
steps:
43-
- name: Check out repository
44-
uses: actions/checkout@v4
109+
- uses: actions/checkout@v4
110+
- uses: actions/setup-python@v5
111+
with:
112+
python-version: "3.13"
45113

46-
- uses: pdm-project/setup-pdm@v4
47-
name: Set up PDM
114+
- name: Download Artifacts
115+
uses: actions/download-artifact@v4
48116
with:
49-
python-version: ${{ matrix.python-version }}
117+
name: coverage-xml
118+
path: coverage.xml
119+
merge-multiple: true
50120

51-
- name: Install dependencies
52-
run: pdm install
121+
# - name: Combine coverage files
122+
# run: |
123+
# python -Im pip install coverage covdefaults
124+
# python -Im coverage combine
125+
# python -Im coverage xml -i
53126

54-
- name: Test
55-
run: pdm run pytest -m ""
127+
# - name: Fix coverage file name
128+
# run: sed -i "s/home\/runner\/work\/advanced-alchemy\/advanced-alchemy/github\/workspace/g" coverage.xml
129+
130+
- name: Upload coverage reports to Codecov
131+
uses: codecov/codecov-action@v5
132+
with:
133+
files: coverage.xml
134+
token: ${{ secrets.CODECOV_TOKEN }}
135+
slug: litestar-org/litestar-asyncpg
56136

57137
build-docs:
58138
needs:
@@ -63,26 +143,26 @@ jobs:
63143
- name: Check out repository
64144
uses: actions/checkout@v4
65145

66-
- name: Set up Python
67-
uses: actions/setup-python@v5
68-
with:
69-
python-version: "3.11"
146+
- name: Install uv
147+
uses: astral-sh/setup-uv@v6
70148

71-
- uses: pdm-project/setup-pdm@v4
72-
name: Set up PDM
73-
with:
74-
python-version: "3.11"
149+
- name: Set up Python
150+
run: uv python install 3.13
75151

76152
- name: Install dependencies
77-
run: pdm install -G:all
153+
run: uv sync --all-extras --dev
78154

79155
- name: Build docs
80-
run: pdm run make docs
156+
run: uv run make docs
81157

82-
- name: Save PR number
158+
- name: Check docs links
83159
env:
84-
PR_NUMBER: ${{ github.event.number }}
85-
run: echo $PR_NUMBER > .pr_number
160+
LITESTAR_DOCS_IGNORE_MISSING_EXAMPLE_OUTPUT: 1
161+
run: uv run make docs-linkcheck
162+
163+
- name: Save PR number
164+
run: |
165+
echo "${{ github.event.number }}" > .pr_number
86166
87167
- name: Upload artifact
88168
uses: actions/upload-artifact@v4
@@ -91,3 +171,4 @@ jobs:
91171
path: |
92172
docs/_build/html
93173
.pr_number
174+
include-hidden-files: true

.github/workflows/docs-preview.yaml

Lines changed: 0 additions & 72 deletions
This file was deleted.

.github/workflows/docs.yaml

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,41 +6,44 @@ on:
66
push:
77
branches:
88
- main
9+
# Allows you to run this workflow manually from the Actions tab
10+
workflow_dispatch:
911

1012
jobs:
11-
docs:
13+
build_and_deploy:
1214
permissions:
1315
contents: write
16+
pages: write
17+
id-token: write
18+
environment:
19+
name: github-pages
20+
url: ${{ steps.deployment.outputs.page_url }}
1421
runs-on: ubuntu-latest
1522
steps:
1623
- uses: actions/checkout@v4
1724

18-
- uses: actions/setup-python@v5
19-
with:
20-
python-version: "3.11"
25+
- name: Install uv
26+
uses: astral-sh/setup-uv@v6
2127

22-
- uses: pdm-project/setup-pdm@v4
23-
name: Set up PDM
24-
with:
25-
python-version: "3.11"
26-
allow-python-prereleases: true
27-
cache: true
28+
- name: Set up Python
29+
run: uv python install 3.13
2830

2931
- name: Install dependencies
30-
run: pdm install -G:docs
32+
run: uv sync --all-extras --dev
3133

32-
- name: Fetch gh pages
33-
run: git fetch origin gh-pages --depth=1
34-
35-
- name: Build release docs
36-
run: pdm run python tools/build_docs.py docs-build
34+
- name: Build Release Documentation
35+
run: uv run python tools/build_docs.py docs-build --version latest
3736
if: github.event_name == 'release'
3837

39-
- name: Build dev docs
40-
run: pdm run python tools/build_docs.py docs-build
41-
if: github.event_name == 'push'
38+
- name: Build Documentation
39+
run: uv run python tools/build_docs.py docs-build --version latest
40+
if: github.event_name != 'release'
4241

43-
- name: Deploy
44-
uses: JamesIves/github-pages-deploy-action@v4
42+
- name: Upload artifact
43+
uses: actions/upload-pages-artifact@v3
4544
with:
46-
folder: docs-build
45+
path: docs-build/
46+
47+
- name: Deploy to GitHub Pages
48+
id: deployment
49+
uses: actions/deploy-pages@v4

.github/workflows/publish.yaml

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,17 @@ jobs:
1515
- name: Check out repository
1616
uses: actions/checkout@v4
1717

18-
- uses: actions/setup-python@v5
19-
with:
20-
python-version: "3.11"
18+
- name: Install uv
19+
uses: astral-sh/setup-uv@v6
2120

22-
- uses: pdm-project/setup-pdm@v4
23-
name: Set up PDM
24-
with:
25-
python-version: "3.11"
26-
allow-python-prereleases: true
27-
cache: true
21+
- name: Set up Python
22+
run: uv python install 3.13
23+
24+
- name: Install dependencies
25+
run: uv sync --all-extras
2826

2927
- name: Build package
30-
run: pdm build
28+
run: uv build
3129

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

0 commit comments

Comments
 (0)