Skip to content

Commit

Permalink
chore: Move to uv (#3875)
Browse files Browse the repository at this point in the history
  • Loading branch information
provinzkraut authored Nov 27, 2024
1 parent 379bca6 commit 444d594
Show file tree
Hide file tree
Showing 9 changed files with 4,740 additions and 5,419 deletions.
125 changes: 45 additions & 80 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ on:
- main
- v1.51

env:
UV_LOCKED: 1

jobs:
validate:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -41,21 +44,14 @@ jobs:
python-version: "3.8"
allow-prereleases: true

- uses: pdm-project/setup-pdm@v4
name: Set up PDM
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
python-version: "3.8"
version: "2.20.1"
allow-python-prereleases: false
cache: true
cache-dependency-path: |
./pdm.lock
- name: Install dependencies
run: pdm install -G:all
version: "0.5.4"
enable-cache: true

- name: Run mypy
run: pdm run mypy
run: uv run mypy

pyright:
runs-on: ubuntu-latest
Expand All @@ -67,21 +63,14 @@ jobs:
python-version: "3.8"
allow-prereleases: true

- uses: pdm-project/setup-pdm@v4
name: Set up PDM
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
python-version: "3.8"
version: "2.20.1"
allow-python-prereleases: false
cache: true
cache-dependency-path: |
./pdm.lock
- name: Install dependencies
run: pdm install -G:all
version: "0.5.4"
enable-cache: true

- name: Run pyright
run: pdm run pyright
run: uv run pyright

slotscheck:
runs-on: ubuntu-latest
Expand All @@ -93,21 +82,14 @@ jobs:
python-version: "3.8"
allow-prereleases: false

- uses: pdm-project/setup-pdm@v4
name: Set up PDM
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
python-version: "3.8"
version: "2.20.1"
allow-python-prereleases: false
cache: true
cache-dependency-path: |
./pdm.lock
- name: Install dependencies
run: pdm install -G:all
version: "0.5.4"
enable-cache: true

- name: Run slotscheck
run: pdm run slotscheck litestar
run: uv run slotscheck litestar

test:
name: "test (${{ matrix.python-version }})"
Expand Down Expand Up @@ -135,25 +117,22 @@ jobs:
with:
python-version: 3.11

- uses: pdm-project/setup-pdm@v4
name: Set up PDM
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
python-version: 3.11
allow-python-prereleases: false
cache: true
cache-dependency-path: |
./pdm.lock
version: "0.5.4"
enable-cache: true

- name: Install dependencies
run: |
pdm install -G:all
pip install -U "${{ matrix.uvicorn-version }}"
uv sync
uv pip install -U "${{ matrix.uvicorn-version }}"
- name: Set PYTHONPATH
run: echo "PYTHONPATH=$PWD" >> $GITHUB_ENV

- name: Test
run: pdm run pytest tests -m server_integration
run: uv run --no-sync pytest tests -m server_integration

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

- uses: pdm-project/setup-pdm@v4
name: Set up PDM
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
python-version: "3.12"
allow-python-prereleases: false
cache: true
cache-dependency-path: |
./pdm.lock
- name: Install dependencies
run: pdm install -G:all
version: "0.5.4"
enable-cache: true

- name: Build docs
run: pdm run make docs
run: uv run make docs

- name: Check docs links
env:
LITESTAR_DOCS_IGNORE_MISSING_EXAMPLE_OUTPUT: 1
run: pdm run make docs-linkcheck
run: uv run make docs-linkcheck

- name: Save PR number
run: |
Expand Down Expand Up @@ -264,23 +237,19 @@ jobs:
with:
python-version: "3.12"

- uses: pdm-project/setup-pdm@v4
name: Set up PDM
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
python-version: "3.12"
allow-python-prereleases: false
cache: true
cache-dependency-path: |
./pdm.lock
- name: Install dependencies
run: pdm install
version: "0.5.4"
enable-cache: true

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

- name: Test
run: mv tests/examples/test_hello_world.py test_hello_world.py && pdm run pytest test_hello_world.py
run: |
mv tests/examples/test_hello_world.py test_hello_world.py
uv run pytest test_hello_world.py
test_pydantic_1_app:
name: Test Minimal Pydantic 1 application
Expand All @@ -296,26 +265,22 @@ jobs:
with:
python-version: "3.12"

- uses: pdm-project/setup-pdm@v4
name: Set up PDM
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
python-version: "3.12"
allow-python-prereleases: false
cache: true
cache-dependency-path: |
./pdm.lock
version: "0.5.4"
enable-cache: true

- name: Install dependencies
run: |
pdm install
pdm run python -m ensurepip
pdm run python -m pip install "pydantic==1.*"
uv sync
uv pip install "pydantic==1.*"
- name: Set pythonpath
run: echo "PYTHONPATH=$PWD" >> $GITHUB_ENV

- name: Test
run: pdm run coverage run --branch -m unittest test_apps/pydantic_1_app.py
run: uv run --no-sync coverage run --branch -m unittest test_apps/pydantic_1_app.py

- name: Rename coverage file
run: mv .coverage* .coverage.pydantic_v1
Expand Down
22 changes: 11 additions & 11 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ on:
- main
- v3.0

env:
UV_LOCKED: 1

jobs:
docs:
permissions:
Expand All @@ -20,31 +23,28 @@ jobs:
with:
python-version: "3.12"

- uses: pdm-project/setup-pdm@v4
name: Set up PDM
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
python-version: "3.12"
allow-python-prereleases: false
cache: true
cache-dependency-path: |
./pdm.lock
version: "0.5.4"
enable-cache: true

- name: Install dependencies
run: pdm sync -G:all
run: uv sync

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

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

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

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

- name: Deploy
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ jobs:
with:
python-version: "3.12"

- uses: pdm-project/setup-pdm@v4
name: Set up PDM
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
python-version: "3.12"
cache: true
version: "0.5.4"
enable-cache: true

- name: Build package
run: pdm build
run: uv build

- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
Expand Down
21 changes: 10 additions & 11 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ on:
type: number
default: 10

env:
UV_LOCKED: 1

jobs:
test:
runs-on: ${{ inputs.os }}
Expand All @@ -35,29 +38,25 @@ jobs:
with:
python-version: ${{ inputs.python-version }}

- uses: pdm-project/setup-pdm@v4
name: Set up PDM
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
python-version: ${{ inputs.python-version }}
version: ${{ inputs.python-version == '3.8' && '2.20.1' || ''}}
allow-python-prereleases: false
cache: true
cache-dependency-path: |
./pdm.lock
version: "0.5.4"
enable-cache: true

- name: Install dependencies
run: pdm install -G:all
run: uv sync

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

- name: Test
if: ${{ !inputs.coverage }}
run: pdm run pytest docs/examples tests -n auto
run: uv run pytest docs/examples tests -n auto

- name: Test with coverage
if: inputs.coverage
run: pdm run pytest docs/examples tests -n auto --cov
run: uv run pytest docs/examples tests -n auto --cov

- name: Rename coverage file
if: inputs.coverage
Expand Down
Loading

0 comments on commit 444d594

Please sign in to comment.