-
-
Notifications
You must be signed in to change notification settings - Fork 3
Closed
Labels
good first issueGood for newcomersGood for newcomers
Description
If the minimum version of Python is set to 3.12+ for FastAPI projects the initial run of linting fails with a UP040 error.
just lint
mypy
Success: no issues found in 48 source files
ruff-check
UP040 Type alias `ActiveFilter` uses `TypeAlias` annotation instead of the `type` keyword
--> app/types.py:3:1
|
1 | from typing import Any, Literal, TypeAlias
2 |
3 | ActiveFilter: TypeAlias = Literal["all", "active", "inactive"]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4 | Json: TypeAlias = dict[str, Any]
|
help: Use the `type` keyword
UP040 Type alias `Json` uses `TypeAlias` annotation instead of the `type` keyword
--> app/types.py:4:1
|
3 | ActiveFilter: TypeAlias = Literal["all", "active", "inactive"]
4 | Json: TypeAlias = dict[str, Any]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: Use the `type` keyword
Found 2 errors.
No fixes available (2 hidden fixes can be enabled with the `--unsafe-fixes` option).
error: Recipe `ruff-check` failed on line 18 with exit code 1
error: Recipe `lint` failed on line 8 with exit code 1TypeAlias should be removed in favor of using type if the minimum Python version is 3.12 or greater to fix this.
The resulting types.py file should look like this for 3.12+
from typing import Any, Literal
type ActiveFilter = Literal["all", "active", "inactive"]
type Json = dict[str, Any]Metadata
Metadata
Assignees
Labels
good first issueGood for newcomersGood for newcomers