Description
I have the following (standard) directory layout:
├── src
│ └── packagename
│ └── ...
├── pyproject.toml
└── ruff.toml
Part from my pyproject.toml
:
[project]
name = "packagename"
requires-python = ">=3.12"
My complete ruff.toml
:
src = ["src"]
[format]
skip-magic-trailing-comma = true
line-ending = "lf"
[lint]
select = ["ALL"]
ignore = ["ANN101", "D203", "D213", "S320"]
Ruff version: 0.3.0, run with the command ruff check
in the directory of pyproject.toml
.
In the rule FA102, it is mentioned:
This rule respects the target-version setting. For example, if your project targets Python 3.10 and above, adding from future import annotations does not impact your ability to leverage PEP 604-style unions (e.g., to convert Optional[str] to str | None). As such, this rule will only flag such usages if your project targets Python 3.9 or below.
In the documentation of target-version
it is mentioned that requires-python
in pyproject.toml
is preferred over the target-version
option in ruff.toml
.
If I add target-version = "py312"
to my ruff.toml
, then there are no FA102 errors.