Skip to content

Commit 929d136

Browse files
authored
Merge branch 'main' into main
2 parents ef77856 + 9bf206e commit 929d136

File tree

18 files changed

+271
-76
lines changed

18 files changed

+271
-76
lines changed

.github/workflows/pre-commit.yml

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
name: pre-commit
2+
3+
on:
4+
pull_request:
5+
types:
6+
- opened
7+
- synchronize
8+
9+
env:
10+
# Forks and Dependabot don't have access to secrets
11+
HAS_SECRETS: ${{ secrets.PRE_COMMIT != '' }}
12+
13+
jobs:
14+
pre-commit:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Dump GitHub context
18+
env:
19+
GITHUB_CONTEXT: ${{ toJson(github) }}
20+
run: echo "$GITHUB_CONTEXT"
21+
- uses: actions/checkout@v5
22+
name: Checkout PR for own repo
23+
if: env.HAS_SECRETS == 'true'
24+
with:
25+
# To be able to commit it needs to fetch the head of the branch, not the
26+
# merge commit
27+
ref: ${{ github.head_ref }}
28+
# And it needs the full history to be able to compute diffs
29+
fetch-depth: 0
30+
# A token other than the default GITHUB_TOKEN is needed to be able to trigger CI
31+
token: ${{ secrets.PRE_COMMIT }}
32+
# pre-commit lite ci needs the default checkout configs to work
33+
- uses: actions/checkout@v5
34+
name: Checkout PR for fork
35+
if: env.HAS_SECRETS == 'false'
36+
with:
37+
# To be able to commit it needs the head branch of the PR, the remote one
38+
ref: ${{ github.event.pull_request.head.sha }}
39+
fetch-depth: 0
40+
- name: Set up Python
41+
uses: actions/setup-python@v6
42+
with:
43+
python-version: "3.14"
44+
- name: Setup uv
45+
uses: astral-sh/setup-uv@v7
46+
with:
47+
cache-dependency-glob: |
48+
requirements**.txt
49+
pyproject.toml
50+
uv.lock
51+
- name: Install Dependencies
52+
run: |
53+
uv venv
54+
uv pip install -r requirements.txt
55+
- name: Run prek - pre-commit
56+
id: precommit
57+
run: uvx prek run --from-ref origin/${GITHUB_BASE_REF} --to-ref HEAD --show-diff-on-failure
58+
continue-on-error: true
59+
- name: Commit and push changes
60+
if: env.HAS_SECRETS == 'true'
61+
run: |
62+
git config user.name "github-actions[bot]"
63+
git config user.email "github-actions[bot]@users.noreply.github.com"
64+
git add -A
65+
if git diff --staged --quiet; then
66+
echo "No changes to commit"
67+
else
68+
git commit -m "🎨 Auto format"
69+
git push
70+
fi
71+
- uses: pre-commit-ci/lite-action@v1.1.0
72+
if: env.HAS_SECRETS == 'false'
73+
with:
74+
msg: 🎨 Auto format
75+
- name: Error out on pre-commit errors
76+
if: steps.precommit.outcome == 'failure'
77+
run: exit 1
78+
79+
# https://github.com/marketplace/actions/alls-green#why
80+
pre-commit-alls-green: # This job does nothing and is only used for the branch protection
81+
if: always()
82+
needs:
83+
- pre-commit
84+
runs-on: ubuntu-latest
85+
steps:
86+
- name: Dump GitHub context
87+
env:
88+
GITHUB_CONTEXT: ${{ toJson(github) }}
89+
run: echo "$GITHUB_CONTEXT"
90+
- name: Decide whether the needed jobs succeeded or failed
91+
uses: re-actors/alls-green@release/v1
92+
with:
93+
jobs: ${{ toJSON(needs) }}

.github/workflows/smokeshow.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ env:
1313

1414
jobs:
1515
smokeshow:
16-
if: ${{ github.event.workflow_run.conclusion == 'success' }}
1716
runs-on: ubuntu-latest
1817
steps:
1918
- name: Dump GitHub context
@@ -23,17 +22,15 @@ jobs:
2322
- uses: actions/checkout@v6
2423
- uses: actions/setup-python@v6
2524
with:
26-
python-version: '3.9'
25+
python-version: '3.13'
2726
- name: Setup uv
2827
uses: astral-sh/setup-uv@v7
2928
with:
30-
version: "0.4.15"
31-
enable-cache: true
3229
cache-dependency-glob: |
3330
requirements**.txt
3431
pyproject.toml
3532
- run: uv pip install -r requirements-github-actions.txt
36-
- uses: actions/download-artifact@v6
33+
- uses: actions/download-artifact@v7
3734
with:
3835
name: coverage-html
3936
path: htmlcov

.github/workflows/test.yml

Lines changed: 8 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -30,28 +30,18 @@ jobs:
3030
matrix:
3131
os: [ ubuntu-latest, windows-latest, macos-latest ]
3232
python-version: ["3.14"]
33-
pydantic-version: ["v2"]
3433
include:
35-
- python-version: "3.8"
36-
pydantic-version: "v1"
37-
os: windows-latest
3834
- python-version: "3.9"
39-
pydantic-version: "v2"
4035
os: macos-latest
4136
- python-version: "3.10"
42-
pydantic-version: "v1"
4337
os: ubuntu-latest
4438
- python-version: "3.11"
45-
pydantic-version: "v2"
4639
os: windows-latest
4740
- python-version: "3.12"
48-
pydantic-version: "v1"
4941
os: macos-latest
5042
- python-version: "3.13"
51-
pydantic-version: "v1"
5243
os: ubuntu-latest
5344
- python-version: "3.13"
54-
pydantic-version: "v2"
5545
os: windows-latest
5646
fail-fast: false
5747
runs-on: ${{ matrix.os }}
@@ -81,21 +71,16 @@ jobs:
8171
limit-access-to-actor: true
8272
- name: Install Dependencies
8373
run: uv pip install -r requirements-tests.txt
84-
- name: Install Pydantic v1
85-
if: matrix.pydantic-version == 'v1'
86-
run: uv pip install "pydantic<2.0.0"
87-
- name: Lint
88-
run: bash scripts/lint.sh
8974
- run: mkdir coverage
9075
- name: Test
9176
run: bash scripts/test.sh
9277
env:
93-
COVERAGE_FILE: coverage/.coverage.${{ runner.os }}-py${{ matrix.python-version }}-pydantic-${{ matrix.pydantic-version }}
94-
CONTEXT: ${{ runner.os }}-py${{ matrix.python-version }}-pydantic-${{ matrix.pydantic-version }}
78+
COVERAGE_FILE: coverage/.coverage.${{ runner.os }}-py${{ matrix.python-version }}
79+
CONTEXT: ${{ runner.os }}-py${{ matrix.python-version }}
9580
- name: Store coverage files
96-
uses: actions/upload-artifact@v5
81+
uses: actions/upload-artifact@v6
9782
with:
98-
name: coverage-${{ runner.os }}-${{ matrix.python-version }}-pydantic-${{ matrix.pydantic-version }}
83+
name: coverage-${{ runner.os }}-${{ matrix.python-version }}
9984
path: coverage
10085
include-hidden-files: true
10186

@@ -110,7 +95,7 @@ jobs:
11095
- uses: actions/checkout@v6
11196
- uses: actions/setup-python@v6
11297
with:
113-
python-version: '3.8'
98+
python-version: '3.9'
11499
- name: Setup uv
115100
uses: astral-sh/setup-uv@v7
116101
with:
@@ -120,22 +105,22 @@ jobs:
120105
requirements**.txt
121106
pyproject.toml
122107
- name: Get coverage files
123-
uses: actions/download-artifact@v6
108+
uses: actions/download-artifact@v7
124109
with:
125110
pattern: coverage-*
126111
path: coverage
127112
merge-multiple: true
128113
- run: uv pip install -r requirements-tests.txt
129114
- run: ls -la coverage
130115
- run: coverage combine coverage
131-
- run: coverage report
132116
- run: coverage html --title "Coverage for ${{ github.sha }}"
133117
- name: Store coverage HTML
134-
uses: actions/upload-artifact@v5
118+
uses: actions/upload-artifact@v6
135119
with:
136120
name: coverage-html
137121
path: htmlcov
138122
include-hidden-files: true
123+
- run: coverage report --fail-under=100
139124

140125
# https://github.com/marketplace/actions/alls-green#why
141126
check: # This job does nothing and is only used for the branch protection

.pre-commit-config.yaml

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# See https://pre-commit.com for more information
22
# See https://pre-commit.com/hooks.html for more hooks
3-
default_language_version:
4-
python: python3.10
53
repos:
64
- repo: https://github.com/pre-commit/pre-commit-hooks
75
rev: v6.0.0
@@ -13,13 +11,18 @@ repos:
1311
- --unsafe
1412
- id: end-of-file-fixer
1513
- id: trailing-whitespace
16-
- repo: https://github.com/astral-sh/ruff-pre-commit
17-
rev: v0.14.6
14+
- repo: local
1815
hooks:
19-
- id: ruff
20-
args:
21-
- --fix
22-
- id: ruff-format
23-
ci:
24-
autofix_commit_msg: 🎨 [pre-commit.ci] Auto format from pre-commit.com hooks
25-
autoupdate_commit_msg: ⬆ [pre-commit.ci] pre-commit autoupdate
16+
- id: local-ruff-check
17+
name: ruff check
18+
entry: uv run ruff check --force-exclude --fix --exit-non-zero-on-fix
19+
require_serial: true
20+
language: unsupported
21+
types: [python]
22+
23+
- id: local-ruff-format
24+
name: ruff format
25+
entry: uv run ruff format --force-exclude --exit-non-zero-on-format
26+
require_serial: true
27+
language: unsupported
28+
types: [python]

pdm_build.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import os
2-
from typing import Any, Dict
2+
from typing import Any
33

44
from pdm.backend.hooks import Context
55

@@ -9,12 +9,12 @@
99
def pdm_build_initialize(context: Context):
1010
metadata = context.config.metadata
1111
# Get custom config for the current package, from the env var
12-
config: Dict[str, Any] = context.config.data["tool"]["tiangolo"][
12+
config: dict[str, Any] = context.config.data["tool"]["tiangolo"][
1313
"_internal-slim-build"
1414
]["packages"].get(TIANGOLO_BUILD_PACKAGE)
1515
if not config:
1616
return
17-
project_config: Dict[str, Any] = config["project"]
17+
project_config: dict[str, Any] = config["project"]
1818
# Override main [project] configs with custom configs for this package
1919
for key, value in project_config.items():
2020
metadata[key] = value

pyproject.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description = "Run and manage FastAPI apps from the command line with FastAPI CL
55
authors = [
66
{name = "Sebastián Ramírez", email = "tiangolo@gmail.com"},
77
]
8-
requires-python = ">=3.8"
8+
requires-python = ">=3.9"
99
readme = "README.md"
1010
license = "MIT"
1111
license-files = ["LICENSE"]
@@ -24,7 +24,6 @@ classifiers = [
2424
"Framework :: FastAPI",
2525
"Intended Audience :: Developers",
2626
"Programming Language :: Python :: 3 :: Only",
27-
"Programming Language :: Python :: 3.8",
2827
"Programming Language :: Python :: 3.9",
2928
"Programming Language :: Python :: 3.10",
3029
"Programming Language :: Python :: 3.11",
@@ -47,6 +46,9 @@ standard = [
4746
standard-no-fastapi-cloud-cli = [
4847
"uvicorn[standard] >= 0.15.0",
4948
]
49+
new = [
50+
"fastapi-new >= 0.0.2 ; python_version >= '3.10'",
51+
]
5052

5153
[project.urls]
5254
Homepage = "https://github.com/fastapi/fastapi-cli"

release-notes.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,42 @@
44

55
### Internal
66

7+
* ⬆ Bump actions/upload-artifact from 5 to 6. PR [#259](https://github.com/fastapi/fastapi-cli/pull/259) by [@dependabot[bot]](https://github.com/apps/dependabot).
8+
* ⬆ Bump actions/download-artifact from 6 to 7. PR [#260](https://github.com/fastapi/fastapi-cli/pull/260) by [@dependabot[bot]](https://github.com/apps/dependabot).
9+
* 👷 Add pre-commit workflow. PR [#266](https://github.com/fastapi/fastapi-cli/pull/266) by [@YuriiMotov](https://github.com/YuriiMotov).
10+
11+
## 0.0.20
12+
13+
### Features
14+
15+
* ✨ Add --reload-dir option to dev command. PR [#267](https://github.com/fastapi/fastapi-cli/pull/267) by [@patrick91](https://github.com/patrick91).
16+
17+
## 0.0.19
18+
19+
### Breaking Changes
20+
21+
* 🔧 Drop support for Python 3.8. PR [#269](https://github.com/fastapi/fastapi-cli/pull/269) by [@patrick91](https://github.com/patrick91).
22+
23+
## 0.0.18
24+
25+
### Features
26+
27+
* ➕ Add `fastapi-new` in `new` optional dependency group. PR [#241](https://github.com/fastapi/fastapi-cli/pull/241) by [@savannahostrowski](https://github.com/savannahostrowski).
28+
29+
### Fixes
30+
31+
* 🐛 Fix log alignment when pressing Ctrl+C to stop server. PR [#253](https://github.com/fastapi/fastapi-cli/pull/253) by [@savannahostrowski](https://github.com/savannahostrowski).
32+
33+
## 0.0.17
34+
35+
### Upgrades
36+
37+
* ➖ Drop support for Pydantic v1. PR [#268](https://github.com/fastapi/fastapi-cli/pull/268) by [@patrick91](https://github.com/patrick91).
38+
39+
### Internal
40+
41+
* 👷 Configure coverage, error on main tests, don't wait for Smokeshow. PR [#265](https://github.com/fastapi/fastapi-cli/pull/265) by [@YuriiMotov](https://github.com/YuriiMotov).
42+
* 👷 Run Smokeshow always, even on test failures. PR [#264](https://github.com/fastapi/fastapi-cli/pull/264) by [@YuriiMotov](https://github.com/YuriiMotov).
743
*[pre-commit.ci] pre-commit autoupdate. PR [#247](https://github.com/fastapi/fastapi-cli/pull/247) by [@pre-commit-ci[bot]](https://github.com/apps/pre-commit-ci).
844
* ⬆ Bump ruff from 0.14.5 to 0.14.6. PR [#245](https://github.com/fastapi/fastapi-cli/pull/245) by [@dependabot[bot]](https://github.com/apps/dependabot).
945
* ⬆ Bump actions/checkout from 5 to 6. PR [#248](https://github.com/fastapi/fastapi-cli/pull/248) by [@dependabot[bot]](https://github.com/apps/dependabot).

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
-r requirements-tests.txt
44

5-
pre-commit >=2.17.0,<5.0.0
5+
prek>=0.2.24,<1.0.0

src/fastapi_cli/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.0.16"
1+
__version__ = "0.0.20"

0 commit comments

Comments
 (0)