Skip to content

Commit

Permalink
Merge branch 'main' into feat/subprocess-test-client
Browse files Browse the repository at this point in the history
  • Loading branch information
cofin authored Dec 30, 2024
2 parents 8d634eb + ebdb6e5 commit 3c59d07
Show file tree
Hide file tree
Showing 125 changed files with 6,867 additions and 5,927 deletions.
11 changes: 11 additions & 0 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -1923,6 +1923,17 @@
"contributions": [
"code"
]
},
{
"login": "ftsartek",
"name": "Jordan Russell",
"avatar_url": "https://avatars.githubusercontent.com/u/20253317?v=4",
"profile": "https://github.com/ftsartek",
"contributions": [
"doc",
"test",
"code"
]
}
],
"contributorsPerLine": 7,
Expand Down
11 changes: 8 additions & 3 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
# [Choice] Python version (use -bookworm or -bullseye variants on local arm64/Apple Silicon): 3, 3.13, 3.12, 3.11, 3.10, 3.9, 3.8, 3-bookworm, 3.13-bookworm, 3.12-bookworm, 3.11-bookworm, 3.10-bookworm, 3.9-bookworm, 3.8-bookworm, 3-bullseye, 3.11-bullseye, 3.10-bullseye, 3.9-bullseye, 3.8-bullseye, 3-buster, 3.11-buster, 3.10-buster, 3.9-buster, 3.8-buster
ARG VARIANT=3.12-bookworm
FROM python:${VARIANT}
ARG VERSION=3.12
ARG VARIANT=-bookworm
FROM python:${VERSION}${VARIANT}

ARG VERSION
ENV UV_LOCKED=1 UV_PYTHON=${VERSION}
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/

RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& apt-get purge -y fish

RUN python3 -m pip install --upgrade setuptools cython pip pdm
RUN python3 -m pip install --upgrade setuptools cython pip
4 changes: 2 additions & 2 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@
},
"forwardPorts": [8000],
"postCreateCommand": [
"pdm",
"install"
"uv",
"sync"
],
"remoteUser": "vscode"
}
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@v5
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@v5
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@v5
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@v5
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@v5
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@v5
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@v5
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
2 changes: 1 addition & 1 deletion .github/workflows/docs-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
uses: actions/checkout@v4

- name: Download artifact
uses: dawidd6/action-download-artifact@v6
uses: dawidd6/action-download-artifact@v7
with:
workflow_conclusion: success
run_id: ${{ github.event.workflow_run.id }}
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@v5
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@v5
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@v5
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 3c59d07

Please sign in to comment.