Skip to content

Commit 0aa877d

Browse files
🔧 Drop support for Python 3.8 (#269)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent b960107 commit 0aa877d

File tree

10 files changed

+28
-28
lines changed

10 files changed

+28
-28
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ jobs:
3131
os: [ ubuntu-latest, windows-latest, macos-latest ]
3232
python-version: ["3.14"]
3333
include:
34-
- python-version: "3.8"
35-
os: windows-latest
3634
- python-version: "3.9"
3735
os: macos-latest
3836
- python-version: "3.10"
@@ -99,7 +97,7 @@ jobs:
9997
- uses: actions/checkout@v6
10098
- uses: actions/setup-python@v6
10199
with:
102-
python-version: '3.8'
100+
python-version: '3.9'
103101
- name: Setup uv
104102
uses: astral-sh/setup-uv@v7
105103
with:

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: 1 addition & 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 = "[email protected]"},
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",

src/fastapi_cli/cli.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
import logging
22
from pathlib import Path
3-
from typing import Any, List, Union
3+
from typing import Annotated, Any, Union
44

55
import typer
66
from pydantic import ValidationError
77
from rich import print
88
from rich.tree import Tree
9-
from typing_extensions import Annotated
109

1110
from fastapi_cli.config import FastAPIConfig
1211
from fastapi_cli.discover import get_import_data, get_import_data_from_import_string
@@ -78,7 +77,7 @@ def callback(
7877
setup_logging(level=log_level)
7978

8079

81-
def _get_module_tree(module_paths: List[Path]) -> Tree:
80+
def _get_module_tree(module_paths: list[Path]) -> Tree:
8281
root = module_paths[0]
8382
name = f"🐍 {root.name}" if root.is_file() else f"📁 {root.name}"
8483

src/fastapi_cli/config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import logging
22
from pathlib import Path
3-
from typing import Any, Dict, Optional
3+
from typing import Any, Optional
44

55
from pydantic import BaseModel, StrictStr
66

@@ -11,7 +11,7 @@ class FastAPIConfig(BaseModel):
1111
entrypoint: Optional[StrictStr] = None
1212

1313
@classmethod
14-
def _read_pyproject_toml(cls) -> Dict[str, Any]:
14+
def _read_pyproject_toml(cls) -> dict[str, Any]:
1515
"""Read FastAPI configuration from pyproject.toml in current directory."""
1616
pyproject_path = Path.cwd() / "pyproject.toml"
1717

src/fastapi_cli/discover.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from dataclasses import dataclass
44
from logging import getLogger
55
from pathlib import Path
6-
from typing import List, Union
6+
from typing import Union
77

88
from fastapi_cli.exceptions import FastAPICLIException
99

@@ -39,7 +39,7 @@ def get_default_path() -> Path:
3939
class ModuleData:
4040
module_import_str: str
4141
extra_sys_path: Path
42-
module_paths: List[Path]
42+
module_paths: list[Path]
4343

4444

4545
def get_module_data_from_path(path: Path) -> ModuleData:

src/fastapi_cli/utils/cli.py

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

44
from rich_toolkit import RichToolkit, RichToolkitTheme
55
from rich_toolkit.styles import TaggedStyle
@@ -20,7 +20,7 @@ def formatMessage(self, record: logging.LogRecord) -> str:
2020
return result
2121

2222

23-
def get_uvicorn_log_config() -> Dict[str, Any]:
23+
def get_uvicorn_log_config() -> dict[str, Any]:
2424
return {
2525
"version": 1,
2626
"disable_existing_loggers": False,

tests/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import sys
2-
from typing import Generator
2+
from collections.abc import Generator
33

44
import pytest
55
from typer import rich_utils

tests/test_cli_pyproject.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,10 @@
1313

1414

1515
def test_dev_with_pyproject_app_config_uses() -> None:
16-
with changing_dir(assets_path / "pyproject_config"), patch.object(
17-
uvicorn, "run"
18-
) as mock_run:
16+
with (
17+
changing_dir(assets_path / "pyproject_config"),
18+
patch.object(uvicorn, "run") as mock_run,
19+
):
1920
result = runner.invoke(app, ["dev"])
2021
assert result.exit_code == 0, result.output
2122

@@ -28,9 +29,10 @@ def test_dev_with_pyproject_app_config_uses() -> None:
2829

2930

3031
def test_run_with_pyproject_app_config() -> None:
31-
with changing_dir(assets_path / "pyproject_config"), patch.object(
32-
uvicorn, "run"
33-
) as mock_run:
32+
with (
33+
changing_dir(assets_path / "pyproject_config"),
34+
patch.object(uvicorn, "run") as mock_run,
35+
):
3436
result = runner.invoke(app, ["run"])
3537
assert result.exit_code == 0, result.output
3638

@@ -43,9 +45,10 @@ def test_run_with_pyproject_app_config() -> None:
4345

4446

4547
def test_cli_arg_overrides_pyproject_config() -> None:
46-
with changing_dir(assets_path / "pyproject_config"), patch.object(
47-
uvicorn, "run"
48-
) as mock_run:
48+
with (
49+
changing_dir(assets_path / "pyproject_config"),
50+
patch.object(uvicorn, "run") as mock_run,
51+
):
4952
result = runner.invoke(app, ["dev", "another_module.py"])
5053

5154
assert result.exit_code == 0, result.output

tests/utils.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import os
2+
from collections.abc import Generator
23
from contextlib import contextmanager
34
from pathlib import Path
4-
from typing import Generator, Union
5+
from typing import Union
56

67

78
@contextmanager

0 commit comments

Comments
 (0)