Compare commits

...

2 Commits

Author SHA1 Message Date
github-actions[bot]
d6b5ae8645 👥 Update FastAPI People - Contributors and Translators 2026-01-09 15:35:40 +00:00
Jonathan Ehwald
ea059d18be ⬆️ Migrate to uv 2026-01-09 16:32:16 +01:00
29 changed files with 5495 additions and 224 deletions

View File

@@ -8,7 +8,7 @@ updates:
commit-message: commit-message:
prefix: prefix:
# Python # Python
- package-ecosystem: "pip" - package-ecosystem: "uv"
directory: "/" directory: "/"
schedule: schedule:
interval: "monthly" interval: "monthly"

View File

@@ -8,9 +8,6 @@ on:
- opened - opened
- synchronize - synchronize
env:
UV_SYSTEM_PYTHON: 1
jobs: jobs:
changes: changes:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@@ -31,8 +28,8 @@ jobs:
- README.md - README.md
- docs/** - docs/**
- docs_src/** - docs_src/**
- requirements-docs.txt
- pyproject.toml - pyproject.toml
- uv.lock
- mkdocs.yml - mkdocs.yml
- mkdocs.env.yml - mkdocs.env.yml
- .github/workflows/build-docs.yml - .github/workflows/build-docs.yml
@@ -49,21 +46,20 @@ jobs:
- name: Set up Python - name: Set up Python
uses: actions/setup-python@v6 uses: actions/setup-python@v6
with: with:
python-version: "3.11" python-version-file: ".python-version"
- name: Setup uv - name: Setup uv
uses: astral-sh/setup-uv@v7 uses: astral-sh/setup-uv@v7
with: with:
version: "0.4.15"
enable-cache: true enable-cache: true
cache-dependency-glob: | cache-dependency-glob: |
requirements**.txt
pyproject.toml pyproject.toml
uv.lock
- name: Install docs extras - name: Install docs extras
run: uv pip install -r requirements-docs.txt run: uv sync --locked --no-dev --group docs
- name: Export Language Codes - name: Export Language Codes
id: show-langs id: show-langs
run: | run: |
echo "langs=$(python ./scripts/docs.py langs-json)" >> $GITHUB_OUTPUT echo "langs=$(uv run ./scripts/docs.py langs-json)" >> $GITHUB_OUTPUT
build-docs: build-docs:
needs: needs:
@@ -83,25 +79,24 @@ jobs:
- name: Set up Python - name: Set up Python
uses: actions/setup-python@v6 uses: actions/setup-python@v6
with: with:
python-version: "3.11" python-version-file: ".python-version"
- name: Setup uv - name: Setup uv
uses: astral-sh/setup-uv@v7 uses: astral-sh/setup-uv@v7
with: with:
version: "0.4.15"
enable-cache: true enable-cache: true
cache-dependency-glob: | cache-dependency-glob: |
requirements**.txt
pyproject.toml pyproject.toml
uv.lock
- name: Install docs extras - name: Install docs extras
run: uv pip install -r requirements-docs.txt run: uv sync --locked --no-dev --group docs
- name: Update Languages - name: Update Languages
run: python ./scripts/docs.py update-languages run: uv run ./scripts/docs.py update-languages
- uses: actions/cache@v4 - uses: actions/cache@v4
with: with:
key: mkdocs-cards-${{ matrix.lang }}-${{ github.ref }} key: mkdocs-cards-${{ matrix.lang }}-${{ github.ref }}
path: docs/${{ matrix.lang }}/.cache path: docs/${{ matrix.lang }}/.cache
- name: Build Docs - name: Build Docs
run: python ./scripts/docs.py build-lang ${{ matrix.lang }} run: uv run ./scripts/docs.py build-lang ${{ matrix.lang }}
- uses: actions/upload-artifact@v5 - uses: actions/upload-artifact@v5
with: with:
name: docs-site-${{ matrix.lang }} name: docs-site-${{ matrix.lang }}

View File

@@ -10,9 +10,6 @@ on:
required: false required: false
default: "false" default: "false"
env:
UV_SYSTEM_PYTHON: 1
jobs: jobs:
job: job:
if: github.repository_owner == 'fastapi' if: github.repository_owner == 'fastapi'
@@ -28,17 +25,16 @@ jobs:
- name: Set up Python - name: Set up Python
uses: actions/setup-python@v6 uses: actions/setup-python@v6
with: with:
python-version: "3.11" python-version-file: ".python-version"
- name: Setup uv - name: Setup uv
uses: astral-sh/setup-uv@v7 uses: astral-sh/setup-uv@v7
with: with:
version: "0.4.15"
enable-cache: true enable-cache: true
cache-dependency-glob: | cache-dependency-glob: |
requirements**.txt
pyproject.toml pyproject.toml
uv.lock
- name: Install Dependencies - name: Install Dependencies
run: uv pip install -r requirements-github-actions.txt run: uv sync --locked --no-dev --group github-actions
# Allow debugging with tmate # Allow debugging with tmate
- name: Setup tmate session - name: Setup tmate session
uses: mxschmitt/action-tmate@v3 uses: mxschmitt/action-tmate@v3
@@ -48,6 +44,6 @@ jobs:
env: env:
GITHUB_TOKEN: ${{ secrets.FASTAPI_PR_TOKEN }} GITHUB_TOKEN: ${{ secrets.FASTAPI_PR_TOKEN }}
- name: FastAPI People Contributors - name: FastAPI People Contributors
run: python ./scripts/contributors.py run: uv run ./scripts/contributors.py
env: env:
GITHUB_TOKEN: ${{ secrets.FASTAPI_PR_TOKEN }} GITHUB_TOKEN: ${{ secrets.FASTAPI_PR_TOKEN }}

View File

@@ -12,9 +12,6 @@ permissions:
pull-requests: write pull-requests: write
statuses: write statuses: write
env:
UV_SYSTEM_PYTHON: 1
jobs: jobs:
deploy-docs: deploy-docs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@@ -27,19 +24,18 @@ jobs:
- name: Set up Python - name: Set up Python
uses: actions/setup-python@v6 uses: actions/setup-python@v6
with: with:
python-version: "3.11" python-version-file: ".python-version"
- name: Setup uv - name: Setup uv
uses: astral-sh/setup-uv@v7 uses: astral-sh/setup-uv@v7
with: with:
version: "0.4.15"
enable-cache: true enable-cache: true
cache-dependency-glob: | cache-dependency-glob: |
requirements**.txt
pyproject.toml pyproject.toml
uv.lock
- name: Install GitHub Actions dependencies - name: Install GitHub Actions dependencies
run: uv pip install -r requirements-github-actions.txt run: uv sync --locked --no-dev --group github-actions
- name: Deploy Docs Status Pending - name: Deploy Docs Status Pending
run: python ./scripts/deploy_docs_status.py run: uv run ./scripts/deploy_docs_status.py
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COMMIT_SHA: ${{ github.event.workflow_run.head_sha }} COMMIT_SHA: ${{ github.event.workflow_run.head_sha }}
@@ -70,14 +66,14 @@ jobs:
command: pages deploy ./site --project-name=${{ env.PROJECT_NAME }} --branch=${{ env.BRANCH }} command: pages deploy ./site --project-name=${{ env.PROJECT_NAME }} --branch=${{ env.BRANCH }}
- name: Deploy Docs Status Error - name: Deploy Docs Status Error
if: failure() if: failure()
run: python ./scripts/deploy_docs_status.py run: uv run ./scripts/deploy_docs_status.py
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COMMIT_SHA: ${{ github.event.workflow_run.head_sha }} COMMIT_SHA: ${{ github.event.workflow_run.head_sha }}
RUN_ID: ${{ github.run_id }} RUN_ID: ${{ github.run_id }}
STATE: "error" STATE: "error"
- name: Comment Deploy - name: Comment Deploy
run: python ./scripts/deploy_docs_status.py run: uv run ./scripts/deploy_docs_status.py
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DEPLOY_URL: ${{ steps.deploy.outputs.deployment-url }} DEPLOY_URL: ${{ steps.deploy.outputs.deployment-url }}

View File

@@ -8,9 +8,6 @@ on:
permissions: permissions:
pull-requests: write pull-requests: write
env:
UV_SYSTEM_PYTHON: 1
jobs: jobs:
label-approved: label-approved:
if: github.repository_owner == 'fastapi' if: github.repository_owner == 'fastapi'
@@ -24,19 +21,18 @@ jobs:
- name: Set up Python - name: Set up Python
uses: actions/setup-python@v6 uses: actions/setup-python@v6
with: with:
python-version: "3.11" python-version-file: ".python-version"
- name: Setup uv - name: Setup uv
uses: astral-sh/setup-uv@v7 uses: astral-sh/setup-uv@v7
with: with:
version: "0.4.15"
enable-cache: true enable-cache: true
cache-dependency-glob: | cache-dependency-glob: |
requirements**.txt
pyproject.toml pyproject.toml
uv.lock
- name: Install GitHub Actions dependencies - name: Install GitHub Actions dependencies
run: uv pip install -r requirements-github-actions.txt run: uv sync --locked --no-dev --group github-actions
- name: Label Approved - name: Label Approved
run: python ./scripts/label_approved.py run: uv run ./scripts/label_approved.py
env: env:
TOKEN: ${{ secrets.GITHUB_TOKEN }} TOKEN: ${{ secrets.GITHUB_TOKEN }}
CONFIG: > CONFIG: >

View File

@@ -15,9 +15,6 @@ on:
required: false required: false
default: 'false' default: 'false'
env:
UV_SYSTEM_PYTHON: 1
jobs: jobs:
job: job:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@@ -32,17 +29,16 @@ jobs:
- name: Set up Python - name: Set up Python
uses: actions/setup-python@v6 uses: actions/setup-python@v6
with: with:
python-version: "3.11" python-version-file: ".python-version"
- name: Setup uv - name: Setup uv
uses: astral-sh/setup-uv@v7 uses: astral-sh/setup-uv@v7
with: with:
version: "0.4.15"
enable-cache: true enable-cache: true
cache-dependency-glob: | cache-dependency-glob: |
requirements**.txt
pyproject.toml pyproject.toml
uv.lock
- name: Install Dependencies - name: Install Dependencies
run: uv pip install -r requirements-github-actions.txt run: uv sync --locked --no-dev --group github-actions
# Allow debugging with tmate # Allow debugging with tmate
- name: Setup tmate session - name: Setup tmate session
uses: mxschmitt/action-tmate@v3 uses: mxschmitt/action-tmate@v3
@@ -52,7 +48,7 @@ jobs:
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Notify Translations - name: Notify Translations
run: python ./scripts/notify_translations.py run: uv run ./scripts/notify_translations.py
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NUMBER: ${{ github.event.inputs.number || null }} NUMBER: ${{ github.event.inputs.number || null }}

View File

@@ -10,9 +10,6 @@ on:
required: false required: false
default: "false" default: "false"
env:
UV_SYSTEM_PYTHON: 1
jobs: jobs:
job: job:
if: github.repository_owner == 'fastapi' if: github.repository_owner == 'fastapi'
@@ -28,17 +25,16 @@ jobs:
- name: Set up Python - name: Set up Python
uses: actions/setup-python@v6 uses: actions/setup-python@v6
with: with:
python-version: "3.11" python-version-file: ".python-version"
- name: Setup uv - name: Setup uv
uses: astral-sh/setup-uv@v7 uses: astral-sh/setup-uv@v7
with: with:
version: "0.4.15"
enable-cache: true enable-cache: true
cache-dependency-glob: | cache-dependency-glob: |
requirements**.txt
pyproject.toml pyproject.toml
uv.lock
- name: Install Dependencies - name: Install Dependencies
run: uv pip install -r requirements-github-actions.txt run: uv sync --locked --no-dev --group github-actions
# Allow debugging with tmate # Allow debugging with tmate
- name: Setup tmate session - name: Setup tmate session
uses: mxschmitt/action-tmate@v3 uses: mxschmitt/action-tmate@v3
@@ -48,7 +44,7 @@ jobs:
env: env:
GITHUB_TOKEN: ${{ secrets.FASTAPI_PEOPLE }} GITHUB_TOKEN: ${{ secrets.FASTAPI_PEOPLE }}
- name: FastAPI People Experts - name: FastAPI People Experts
run: python ./scripts/people.py run: uv run ./scripts/people.py
env: env:
GITHUB_TOKEN: ${{ secrets.FASTAPI_PEOPLE }} GITHUB_TOKEN: ${{ secrets.FASTAPI_PEOPLE }}
SLEEP_INTERVAL: ${{ vars.PEOPLE_SLEEP_INTERVAL }} SLEEP_INTERVAL: ${{ vars.PEOPLE_SLEEP_INTERVAL }}

View File

@@ -40,18 +40,15 @@ jobs:
- name: Set up Python - name: Set up Python
uses: actions/setup-python@v6 uses: actions/setup-python@v6
with: with:
python-version: "3.14" python-version-file: ".python-version"
- name: Setup uv - name: Setup uv
uses: astral-sh/setup-uv@v7 uses: astral-sh/setup-uv@v7
with: with:
cache-dependency-glob: | cache-dependency-glob: |
requirements**.txt
pyproject.toml pyproject.toml
uv.lock uv.lock
- name: Install Dependencies - name: Install Dependencies
run: | run: uv sync --locked --extra all
uv venv
uv pip install -r requirements.txt
- name: Run prek - pre-commit - name: Run prek - pre-commit
id: precommit id: precommit
run: uvx prek run --from-ref origin/${GITHUB_BASE_REF} --to-ref HEAD --show-diff-on-failure run: uvx prek run --from-ref origin/${GITHUB_BASE_REF} --to-ref HEAD --show-diff-on-failure

View File

@@ -15,6 +15,7 @@ jobs:
- fastapi-slim - fastapi-slim
permissions: permissions:
id-token: write id-token: write
contents: read
steps: steps:
- name: Dump GitHub context - name: Dump GitHub context
env: env:
@@ -24,19 +25,15 @@ jobs:
- name: Set up Python - name: Set up Python
uses: actions/setup-python@v6 uses: actions/setup-python@v6
with: with:
python-version: "3.10" python-version-file: ".python-version"
# Issue ref: https://github.com/actions/setup-python/issues/436 # Issue ref: https://github.com/actions/setup-python/issues/436
# cache: "pip" # cache: "pip"
# cache-dependency-path: pyproject.toml # cache-dependency-path: pyproject.toml
- name: Install build dependencies - name: Install uv
run: pip install build uses: astral-sh/setup-uv@v7
- name: Build distribution - name: Build distribution
run: uv build
env: env:
TIANGOLO_BUILD_PACKAGE: ${{ matrix.package }} TIANGOLO_BUILD_PACKAGE: ${{ matrix.package }}
run: python -m build
- name: Publish - name: Publish
uses: pypa/gh-action-pypi-publish@v1.13.0 run: uv publish
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"

View File

@@ -8,9 +8,6 @@ on:
permissions: permissions:
statuses: write statuses: write
env:
UV_SYSTEM_PYTHON: 1
jobs: jobs:
smokeshow: smokeshow:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@@ -23,14 +20,14 @@ jobs:
- uses: actions/checkout@v6 - uses: actions/checkout@v6
- uses: actions/setup-python@v6 - uses: actions/setup-python@v6
with: with:
python-version: '3.13' python-version-file: ".python-version"
- name: Setup uv - name: Setup uv
uses: astral-sh/setup-uv@v7 uses: astral-sh/setup-uv@v7
with: with:
cache-dependency-glob: | cache-dependency-glob: |
requirements**.txt
pyproject.toml pyproject.toml
- run: uv pip install -r requirements-github-actions.txt uv.lock
- run: uv sync --locked --no-dev --group github-actions
- uses: actions/download-artifact@v6 - uses: actions/download-artifact@v6
with: with:
name: coverage-html name: coverage-html
@@ -41,7 +38,7 @@ jobs:
- name: Upload coverage to Smokeshow - name: Upload coverage to Smokeshow
run: | run: |
for i in 1 2 3 4 5; do for i in 1 2 3 4 5; do
if smokeshow upload htmlcov; then if uv run smokeshow upload htmlcov; then
echo "Smokeshow upload success!" echo "Smokeshow upload success!"
break break
fi fi

View File

@@ -10,9 +10,6 @@ on:
required: false required: false
default: "false" default: "false"
env:
UV_SYSTEM_PYTHON: 1
jobs: jobs:
job: job:
if: github.repository_owner == 'fastapi' if: github.repository_owner == 'fastapi'
@@ -28,17 +25,16 @@ jobs:
- name: Set up Python - name: Set up Python
uses: actions/setup-python@v6 uses: actions/setup-python@v6
with: with:
python-version: "3.11" python-version-file: ".python-version"
- name: Setup uv - name: Setup uv
uses: astral-sh/setup-uv@v7 uses: astral-sh/setup-uv@v7
with: with:
version: "0.4.15"
enable-cache: true enable-cache: true
cache-dependency-glob: | cache-dependency-glob: |
requirements**.txt
pyproject.toml pyproject.toml
uv.lock
- name: Install Dependencies - name: Install Dependencies
run: uv pip install -r requirements-github-actions.txt run: uv sync --locked --no-dev --group github-actions
# Allow debugging with tmate # Allow debugging with tmate
- name: Setup tmate session - name: Setup tmate session
uses: mxschmitt/action-tmate@v3 uses: mxschmitt/action-tmate@v3
@@ -46,7 +42,7 @@ jobs:
with: with:
limit-access-to-actor: true limit-access-to-actor: true
- name: FastAPI People Sponsors - name: FastAPI People Sponsors
run: python ./scripts/sponsors.py run: uv run ./scripts/sponsors.py
env: env:
SPONSORS_TOKEN: ${{ secrets.SPONSORS_TOKEN }} SPONSORS_TOKEN: ${{ secrets.SPONSORS_TOKEN }}
PR_TOKEN: ${{ secrets.FASTAPI_PR_TOKEN }} PR_TOKEN: ${{ secrets.FASTAPI_PR_TOKEN }}

View File

@@ -26,7 +26,7 @@ jobs:
- name: Set up Python - name: Set up Python
uses: actions/setup-python@v6 uses: actions/setup-python@v6
with: with:
python-version: "3.10" python-version-file: ".python-version"
- name: Install build dependencies - name: Install build dependencies
run: pip install build run: pip install build
- name: Build source distribution - name: Build source distribution
@@ -40,7 +40,7 @@ jobs:
- name: Install test dependencies - name: Install test dependencies
run: | run: |
cd dist/fastapi*/ cd dist/fastapi*/
pip install -r requirements-tests.txt pip install --group tests --editable .[all]
env: env:
TIANGOLO_BUILD_PACKAGE: ${{ matrix.package }} TIANGOLO_BUILD_PACKAGE: ${{ matrix.package }}
- name: Run source distribution tests - name: Run source distribution tests

View File

@@ -13,7 +13,7 @@ on:
- cron: "0 0 * * 1" - cron: "0 0 * * 1"
env: env:
UV_SYSTEM_PYTHON: 1 UV_NO_SYNC: true
jobs: jobs:
test: test:
@@ -44,6 +44,8 @@ jobs:
coverage: coverage coverage: coverage
fail-fast: false fail-fast: false
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
env:
UV_PYTHON: ${{ matrix.python-version }}
steps: steps:
- name: Dump GitHub context - name: Dump GitHub context
env: env:
@@ -57,17 +59,16 @@ jobs:
- name: Setup uv - name: Setup uv
uses: astral-sh/setup-uv@v7 uses: astral-sh/setup-uv@v7
with: with:
version: "0.4.15"
enable-cache: true enable-cache: true
cache-dependency-glob: | cache-dependency-glob: |
requirements**.txt
pyproject.toml pyproject.toml
uv.lock
- name: Install Dependencies - name: Install Dependencies
run: uv pip install -r requirements-tests.txt run: uv sync --locked --no-dev --group tests --extra all
- run: mkdir coverage - run: mkdir coverage
- name: Test - name: Test
if: matrix.codspeed != 'codspeed' if: matrix.codspeed != 'codspeed'
run: bash scripts/test.sh run: uv run bash scripts/test.sh
env: env:
COVERAGE_FILE: coverage/.coverage.${{ runner.os }}-py${{ matrix.python-version }} COVERAGE_FILE: coverage/.coverage.${{ runner.os }}-py${{ matrix.python-version }}
CONTEXT: ${{ runner.os }}-py${{ matrix.python-version }} CONTEXT: ${{ runner.os }}-py${{ matrix.python-version }}
@@ -79,7 +80,7 @@ jobs:
CONTEXT: ${{ runner.os }}-py${{ matrix.python-version }} CONTEXT: ${{ runner.os }}-py${{ matrix.python-version }}
with: with:
mode: simulation mode: simulation
run: coverage run -m pytest tests/ --codspeed run: uv run coverage run -m pytest tests/ --codspeed
# Do not store coverage for all possible combinations to avoid file size max errors in Smokeshow # Do not store coverage for all possible combinations to avoid file size max errors in Smokeshow
- name: Store coverage files - name: Store coverage files
if: matrix.coverage == 'coverage' if: matrix.coverage == 'coverage'
@@ -100,17 +101,16 @@ jobs:
- uses: actions/checkout@v6 - uses: actions/checkout@v6
- uses: actions/setup-python@v6 - uses: actions/setup-python@v6
with: with:
python-version: '3.11' python-version-file: ".python-version"
- name: Setup uv - name: Setup uv
uses: astral-sh/setup-uv@v7 uses: astral-sh/setup-uv@v7
with: with:
version: "0.4.15"
enable-cache: true enable-cache: true
cache-dependency-glob: | cache-dependency-glob: |
requirements**.txt
pyproject.toml pyproject.toml
uv.lock
- name: Install Dependencies - name: Install Dependencies
run: uv pip install -r requirements-tests.txt run: uv sync --locked --no-dev --group tests --extra all
- name: Get coverage files - name: Get coverage files
uses: actions/download-artifact@v6 uses: actions/download-artifact@v6
with: with:
@@ -118,15 +118,15 @@ jobs:
path: coverage path: coverage
merge-multiple: true merge-multiple: true
- run: ls -la coverage - run: ls -la coverage
- run: coverage combine coverage - run: uv run coverage combine coverage
- run: coverage html --title "Coverage for ${{ github.sha }}" - run: uv run coverage html --title "Coverage for ${{ github.sha }}"
- name: Store coverage HTML - name: Store coverage HTML
uses: actions/upload-artifact@v5 uses: actions/upload-artifact@v5
with: with:
name: coverage-html name: coverage-html
path: htmlcov path: htmlcov
include-hidden-files: true include-hidden-files: true
- run: coverage report --fail-under=100 - run: uv run coverage report --fail-under=100
# https://github.com/marketplace/actions/alls-green#why # https://github.com/marketplace/actions/alls-green#why
check: # This job does nothing and is only used for the branch protection check: # This job does nothing and is only used for the branch protection

View File

@@ -5,9 +5,6 @@ on:
- cron: "0 12 1 * *" - cron: "0 12 1 * *"
workflow_dispatch: workflow_dispatch:
env:
UV_SYSTEM_PYTHON: 1
jobs: jobs:
topic-repos: topic-repos:
if: github.repository_owner == 'fastapi' if: github.repository_owner == 'fastapi'
@@ -23,18 +20,17 @@ jobs:
- name: Set up Python - name: Set up Python
uses: actions/setup-python@v6 uses: actions/setup-python@v6
with: with:
python-version: "3.11" python-version-file: ".python-version"
- name: Setup uv - name: Setup uv
uses: astral-sh/setup-uv@v7 uses: astral-sh/setup-uv@v7
with: with:
version: "0.4.15"
enable-cache: true enable-cache: true
cache-dependency-glob: | cache-dependency-glob: |
requirements**.txt
pyproject.toml pyproject.toml
uv.lock
- name: Install GitHub Actions dependencies - name: Install GitHub Actions dependencies
run: uv pip install -r requirements-github-actions.txt run: uv sync --locked --no-dev --group github-actions
- name: Update Topic Repos - name: Update Topic Repos
run: python ./scripts/topic_repos.py run: uv run ./scripts/topic_repos.py
env: env:
GITHUB_TOKEN: ${{ secrets.FASTAPI_PR_TOKEN }} GITHUB_TOKEN: ${{ secrets.FASTAPI_PR_TOKEN }}

View File

@@ -31,9 +31,6 @@ on:
required: false required: false
default: "" default: ""
env:
UV_SYSTEM_PYTHON: 1
jobs: jobs:
langs: langs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@@ -45,20 +42,20 @@ jobs:
- name: Set up Python - name: Set up Python
uses: actions/setup-python@v6 uses: actions/setup-python@v6
with: with:
python-version: "3.11" python-version-file: ".python-version"
- name: Setup uv - name: Setup uv
uses: astral-sh/setup-uv@v7 uses: astral-sh/setup-uv@v7
with: with:
cache-dependency-glob: | cache-dependency-glob: |
requirements**.txt
pyproject.toml pyproject.toml
uv.lock
- name: Install Dependencies - name: Install Dependencies
run: uv pip install -r requirements-github-actions.txt -r requirements-translations.txt run: uv sync --locked --no-dev --group github-actions --group translations
- name: Export Language Codes - name: Export Language Codes
id: show-langs id: show-langs
run: | run: |
echo "langs=$(python ./scripts/translate.py llm-translatable-json)" >> $GITHUB_OUTPUT echo "langs=$(uv run ./scripts/translate.py llm-translatable-json)" >> $GITHUB_OUTPUT
echo "commands=$(python ./scripts/translate.py commands-json)" >> $GITHUB_OUTPUT echo "commands=$(uv run ./scripts/translate.py commands-json)" >> $GITHUB_OUTPUT
env: env:
LANGUAGE: ${{ github.event.inputs.language }} LANGUAGE: ${{ github.event.inputs.language }}
COMMAND: ${{ github.event.inputs.command }} COMMAND: ${{ github.event.inputs.command }}
@@ -84,15 +81,15 @@ jobs:
- name: Set up Python - name: Set up Python
uses: actions/setup-python@v6 uses: actions/setup-python@v6
with: with:
python-version: "3.11" python-version-file: ".python-version"
- name: Setup uv - name: Setup uv
uses: astral-sh/setup-uv@v7 uses: astral-sh/setup-uv@v7
with: with:
cache-dependency-glob: | cache-dependency-glob: |
requirements**.txt
pyproject.toml pyproject.toml
uv.lock
- name: Install Dependencies - name: Install Dependencies
run: uv pip install -r requirements-github-actions.txt -r requirements-translations.txt run: uv sync --locked --no-dev --group github-actions --group translations
# Allow debugging with tmate # Allow debugging with tmate
- name: Setup tmate session - name: Setup tmate session
uses: mxschmitt/action-tmate@v3 uses: mxschmitt/action-tmate@v3
@@ -104,8 +101,8 @@ jobs:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
- name: FastAPI Translate - name: FastAPI Translate
run: | run: |
python ./scripts/translate.py ${{ matrix.command }} uv run ./scripts/translate.py ${{ matrix.command }}
python ./scripts/translate.py make-pr uv run ./scripts/translate.py make-pr
env: env:
GITHUB_TOKEN: ${{ secrets.FASTAPI_TRANSLATIONS }} GITHUB_TOKEN: ${{ secrets.FASTAPI_TRANSLATIONS }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}

3
.gitignore vendored
View File

@@ -29,7 +29,4 @@ archive.zip
# macOS # macOS
.DS_Store .DS_Store
# Ignore while the setup still depends on requirements.txt files
uv.lock
.codspeed .codspeed

View File

@@ -6,6 +6,7 @@ repos:
hooks: hooks:
- id: check-added-large-files - id: check-added-large-files
args: ['--maxkb=750'] args: ['--maxkb=750']
exclude: ^uv.lock$
- id: check-toml - id: check-toml
- id: check-yaml - id: check-yaml
args: args:

1
.python-version Normal file
View File

@@ -0,0 +1 @@
3.11

View File

@@ -1,6 +1,6 @@
tiangolo: tiangolo:
login: tiangolo login: tiangolo
count: 857 count: 860
avatarUrl: https://avatars.githubusercontent.com/u/1326112?u=cb5d06e73a9e1998141b1641aa88e443c6717651&v=4 avatarUrl: https://avatars.githubusercontent.com/u/1326112?u=cb5d06e73a9e1998141b1641aa88e443c6717651&v=4
url: https://github.com/tiangolo url: https://github.com/tiangolo
dependabot: dependabot:
@@ -266,7 +266,7 @@ Nimitha-jagadeesha:
lucaromagnoli: lucaromagnoli:
login: lucaromagnoli login: lucaromagnoli
count: 3 count: 3
avatarUrl: https://avatars.githubusercontent.com/u/38782977?u=15df02e806a2293af40ac619fba11dbe3c0c4fd4&v=4 avatarUrl: https://avatars.githubusercontent.com/u/38782977?u=a09a2e916625fa035f9dfa25ebc58e07aac8ec36&v=4
url: https://github.com/lucaromagnoli url: https://github.com/lucaromagnoli
salmantec: salmantec:
login: salmantec login: salmantec

View File

@@ -383,6 +383,11 @@ Joao-Pedro-P-Holanda:
count: 16 count: 16
avatarUrl: https://avatars.githubusercontent.com/u/110267046?u=331bd016326dac4cf3df4848f6db2dbbf8b5f978&v=4 avatarUrl: https://avatars.githubusercontent.com/u/110267046?u=331bd016326dac4cf3df4848f6db2dbbf8b5f978&v=4
url: https://github.com/Joao-Pedro-P-Holanda url: https://github.com/Joao-Pedro-P-Holanda
maru0123-2004:
login: maru0123-2004
count: 16
avatarUrl: https://avatars.githubusercontent.com/u/43961566?u=16ed8603a4d6a4665cb6c53a7aece6f31379b769&v=4
url: https://github.com/maru0123-2004
JaeHyuckSa: JaeHyuckSa:
login: JaeHyuckSa login: JaeHyuckSa
count: 16 count: 16
@@ -418,11 +423,6 @@ mattkoehne:
count: 14 count: 14
avatarUrl: https://avatars.githubusercontent.com/u/80362153?v=4 avatarUrl: https://avatars.githubusercontent.com/u/80362153?v=4
url: https://github.com/mattkoehne url: https://github.com/mattkoehne
maru0123-2004:
login: maru0123-2004
count: 14
avatarUrl: https://avatars.githubusercontent.com/u/43961566?u=16ed8603a4d6a4665cb6c53a7aece6f31379b769&v=4
url: https://github.com/maru0123-2004
jovicon: jovicon:
login: jovicon login: jovicon
count: 13 count: 13
@@ -1831,7 +1831,7 @@ EgorOnishchuk:
iamantonreznik: iamantonreznik:
login: iamantonreznik login: iamantonreznik
count: 2 count: 2
avatarUrl: https://avatars.githubusercontent.com/u/112612414?u=bf6de9a1ab17326fe14de0709719fff3826526d0&v=4 avatarUrl: https://avatars.githubusercontent.com/u/112612414?u=b9ba8d9b4d3940198bc3a4353dfce70c044a39b1&v=4
url: https://github.com/iamantonreznik url: https://github.com/iamantonreznik
Azazul123: Azazul123:
login: Azazul123 login: Azazul123
@@ -1851,7 +1851,7 @@ NavesSapnis:
isgin01: isgin01:
login: isgin01 login: isgin01
count: 2 count: 2
avatarUrl: https://avatars.githubusercontent.com/u/157279130?u=ddffde10876b50f35dc90d1337f507a630530a6a&v=4 avatarUrl: https://avatars.githubusercontent.com/u/157279130?u=16d6466476cf7dbc55a4cd575b6ea920ebdd81e1&v=4
url: https://github.com/isgin01 url: https://github.com/isgin01
syedasamina56: syedasamina56:
login: syedasamina56 login: syedasamina56

View File

@@ -6,44 +6,20 @@ First, you might want to see the basic ways to [help FastAPI and get help](help-
If you already cloned the <a href="https://github.com/fastapi/fastapi" class="external-link" target="_blank">fastapi repository</a> and you want to deep dive in the code, here are some guidelines to set up your environment. If you already cloned the <a href="https://github.com/fastapi/fastapi" class="external-link" target="_blank">fastapi repository</a> and you want to deep dive in the code, here are some guidelines to set up your environment.
### Virtual environment
Follow the instructions to create and activate a [virtual environment](virtual-environments.md){.internal-link target=_blank} for the internal code of `fastapi`.
### Install requirements ### Install requirements
After activating the environment, install the required packages: Create a virtual environment and install the required packages with <a href="https://github.com/astral-sh/uv" class="external-link" target="_blank">`uv`</a>:
//// tab | `pip`
<div class="termy"> <div class="termy">
```console ```console
$ pip install -r requirements.txt $ uv sync
---> 100% ---> 100%
``` ```
</div> </div>
////
//// tab | `uv`
If you have <a href="https://github.com/astral-sh/uv" class="external-link" target="_blank">`uv`</a>:
<div class="termy">
```console
$ uv pip install -r requirements.txt
---> 100%
```
</div>
////
It will install all the dependencies and your local FastAPI in your local environment. It will install all the dependencies and your local FastAPI in your local environment.
### Using your local FastAPI ### Using your local FastAPI
@@ -56,9 +32,9 @@ That way, you don't have to "install" your local version to be able to test ever
/// note | Technical Details /// note | Technical Details
This only happens when you install using this included `requirements.txt` instead of running `pip install fastapi` directly. This only happens when you install using `uv sync` instead of running `pip install fastapi` directly.
That is because inside the `requirements.txt` file, the local version of FastAPI is marked to be installed in "editable" mode, with the `-e` option. That is because `uv sync` will install the local version of FastAPI in "editable" mode by default.
/// ///

View File

@@ -123,6 +123,68 @@ all = [
[project.scripts] [project.scripts]
fastapi = "fastapi.cli:main" fastapi = "fastapi.cli:main"
[dependency-groups]
dev = [
{ include-group = "tests" },
{ include-group = "docs" },
{ include-group = "translations" },
"playwright>=1.57.0",
"prek==0.2.22",
]
docs = [
{ include-group = "docs-tests" },
"black==25.1.0",
"cairosvg==2.8.2",
"griffe-typingdoc==0.3.0",
"griffe-warnings-deprecated==1.1.0",
"jieba==0.42.1",
"markdown-include-variants==0.0.8",
"mdx-include>=1.4.1,<2.0.0",
"mkdocs-macros-plugin==1.4.1",
"mkdocs-material==9.7.0",
"mkdocs-redirects>=1.2.1,<1.3.0",
"mkdocstrings[python]==0.30.1",
"pillow==11.3.0",
"python-slugify==8.0.4",
"pyyaml>=5.3.1,<7.0.0",
"typer==0.16.0",
]
docs-tests = [
"httpx>=0.23.0,<1.0.0",
"ruff==0.14.3",
]
github-actions = [
"httpx>=0.27.0,<1.0.0",
"pydantic>=2.5.3,<3.0.0",
"pydantic-settings>=2.1.0,<3.0.0",
"pygithub>=2.3.0,<3.0.0",
"pyyaml>=5.3.1,<7.0.0",
"smokeshow>=0.5.0",
]
tests = [
{ include-group = "docs-tests" },
"anyio[trio]>=3.2.1,<5.0.0",
"coverage[toml]>=6.5.0,<8.0",
"dirty-equals==0.9.0",
"flask>=1.1.2,<4.0.0",
"inline-snapshot>=0.21.1",
"mypy==1.14.1",
"pwdlib[argon2]>=0.2.1",
"pyjwt==2.9.0",
"pytest>=7.1.3,<9.0.0",
"pytest-codspeed==4.2.0",
"pyyaml>=5.3.1,<7.0.0",
"sqlmodel==0.0.27",
"strawberry-graphql>=0.200.0,<1.0.0",
"types-orjson==3.6.2",
"types-ujson==5.10.0.20240515",
]
translations = [
"gitpython==3.1.45",
"pydantic-ai==0.4.10",
"pygithub==2.8.1",
]
[tool.pdm] [tool.pdm]
version = { source = "file", path = "fastapi/__init__.py" } version = { source = "file", path = "fastapi/__init__.py" }
distribution = true distribution = true
@@ -131,11 +193,10 @@ distribution = true
source-includes = [ source-includes = [
"tests/", "tests/",
"docs_src/", "docs_src/",
"requirements*.txt",
"scripts/", "scripts/",
# For a test # For a test
"docs/en/docs/img/favicon.png", "docs/en/docs/img/favicon.png",
] ]
[tool.tiangolo._internal-slim-build.packages.fastapi-slim.project] [tool.tiangolo._internal-slim-build.packages.fastapi-slim.project]
name = "fastapi-slim" name = "fastapi-slim"

View File

@@ -1,4 +0,0 @@
# For mkdocstrings and tests
httpx >=0.23.0,<1.0.0
# For linting and generating docs versions
ruff ==0.14.3

View File

@@ -1,21 +0,0 @@
-e .
-r requirements-docs-tests.txt
mkdocs-material==9.7.0
mdx-include >=1.4.1,<2.0.0
mkdocs-redirects>=1.2.1,<1.3.0
typer == 0.16.0
pyyaml >=5.3.1,<7.0.0
# For Material for MkDocs, Chinese search
jieba==0.42.1
# For image processing by Material for MkDocs
pillow==11.3.0
# For image processing by Material for MkDocs
cairosvg==2.8.2
mkdocstrings[python]==0.30.1
griffe-typingdoc==0.3.0
griffe-warnings-deprecated==1.1.0
# For griffe, it formats with black
black==25.1.0
mkdocs-macros-plugin==1.4.1
markdown-include-variants==0.0.8
python-slugify==8.0.4

View File

@@ -1,6 +0,0 @@
PyGithub>=2.3.0,<3.0.0
pydantic>=2.5.3,<3.0.0
pydantic-settings>=2.1.0,<3.0.0
httpx>=0.27.0,<1.0.0
pyyaml >=5.3.1,<7.0.0
smokeshow

View File

@@ -1,18 +0,0 @@
-e .[all]
-r requirements-docs-tests.txt
pytest >=7.1.3,<9.0.0
coverage[toml] >= 6.5.0,< 8.0
mypy ==1.14.1
dirty-equals ==0.9.0
sqlmodel==0.0.27
flask >=1.1.2,<4.0.0
strawberry-graphql >=0.200.0,< 1.0.0
anyio[trio] >=3.2.1,<5.0.0
PyJWT==2.9.0
pyyaml >=5.3.1,<7.0.0
pwdlib[argon2] >=0.2.1
inline-snapshot>=0.21.1
pytest-codspeed==4.2.0
# types
types-ujson ==5.10.0.20240515
types-orjson ==3.6.2

View File

@@ -1,3 +0,0 @@
pydantic-ai==0.4.10
GitPython==3.1.45
pygithub==2.8.1

View File

@@ -1,7 +0,0 @@
-e .[all]
-r requirements-tests.txt
-r requirements-docs.txt
-r requirements-translations.txt
prek==0.2.22
# For generating screenshots
playwright

5339
uv.lock generated Normal file
View File

File diff suppressed because it is too large Load Diff