Skip to content

target-version in ruff.toml #119

@DimitriPapadopoulos

Description

@DimitriPapadopoulos

According to the target-version documentation, ruff reads the target Python version from project.requires-python in pyproject.toml:

If you're already using a pyproject.toml file, we recommend project.requires-python instead, as it's based on Python packaging standards, and will be respected by other tools. For example, Ruff treats the following as identical to target-version = "py38":

[project]
requires-python = ">=3.8"

Since this skeleton defines requires-python in setup.cfg, not in pyproject.toml, it is not picked up. Therefore, we must redefine the minimal Python version as target-version in ruff.toml. This brings the question, are you planning on moving from setup.cfg to pyproject.toml? Alternatively, would it be possible to move the requires-python from setup.cfg to pyproject.toml?

Additionally, ruff does not read project.requires-python from pyproject.toml if a ruff.toml file exists. It is unclear at this point whether this is a bug or a feature:
astral-sh/ruff#10299

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions