Skip to content

Field requires-python is disregarded when config lives outside pyproject.toml #16662

@ofek

Description

@ofek

Summary

Create a directory with the following files:

pyproject.tomlruff.tomltest.py
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "dda"
version = "0.0.1"
requires-python = ">=3.12"

# Comment this out
[tool.ruff.lint]
select = ["I001"]
ignore = ["T201"]
# Uncomment
# [lint]
# select = ["I001"]
# ignore = ["T201"]
from __future__ import annotations

import tomllib

import requests


def main():
    print(tomllib)
    print(requests)


if __name__ == "__main__":
    main()

Then run ruff check . and notice success. Then use the dedicated ruff.toml config file instead and notice that it tries to re-sort the imports because it did not properly read the version from pyproject.toml.

Version

0.9.9

Metadata

Metadata

Assignees

No one assigned

    Labels

    configurationRelated to settings and configuration

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions