Skip to content

UP006 Do not work if requires-python = "== 3.11" in pyproject.toml #12088

@artefactop

Description

@artefactop
ruff version
ruff 0.4.10 (b54922fd7 2024-06-20)

According to https://docs.astral.sh/ruff/rules/non-pep585-annotation/ the rule is enabled when targeting Python 3.9 or later

Example file:

from typing import List


def passing_list(mylist: List[int]) -> None:
    pass

pyproject.toml

[project]
# Support Python 3.11.
requires-python = "== 3.11"

That version config is compliant with https://peps.python.org/pep-0508/

ruff test.py --select UP006 --config pyproject.toml
All checks passed!

pyproject.toml, but if I set ">=3.11"

[project]
# Support Python 3.11.
requires-python = ">= 3.11"
ruff check test.py --select UP006 --config pyproject.toml
test.py:4:26: UP006 [*] Use `list` instead of `List` for type annotation
Found 1 error.
[*] 1 fixable with the `--fix` option.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions