Skip to content

[3.13] Lint: Create a project-wide .ruff.toml settings file (GH-133124) #137670

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: 3.13
Choose a base branch
from

Conversation

webknjaz
Copy link
Contributor

@webknjaz webknjaz commented Aug 12, 2025

(cherry picked from commit fe3c7e1)


📚 Documentation preview 📚: https://cpython-previews--137670.org.readthedocs.build/

@webknjaz
Copy link
Contributor Author

@encukou this is synching more linting config changes.

Ref: #137641 (comment)

@@ -0,0 +1 @@
extend = "../../.ruff.toml" # Inherit the project-wide settings
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we include the other stuff from main?

https://github.com/python/cpython/blob/main/Tools/build/.ruff.toml

Suggested change
extend = "../../.ruff.toml" # Inherit the project-wide settings
extend = "../../.ruff.toml" # Inherit the project-wide settings
[per-file-target-version]
"deepfreeze.py" = "py311" # requires `code.co_exceptiontable`
"stable_abi.py" = "py311" # requires 'tomllib'
[format]
preview = true
docstring-code-format = true
[lint]
select = [
"C4", # flake8-comprehensions
"E", # pycodestyle
"F", # pyflakes
"I", # isort
"ISC", # flake8-implicit-str-concat
"LOG", # flake8-logging
"PGH", # pygrep-hooks
"PT", # flake8-pytest-style
"PYI", # flake8-pyi
"RUF100", # Ban unused `# noqa` comments
"UP", # pyupgrade
"W", # pycodestyle
"YTT", # flake8-2020
]
ignore = [
"E501", # Line too long
"F541", # f-string without any placeholders
"PYI024", # Use `typing.NamedTuple` instead of `collections.namedtuple`
"PYI025", # Use `from collections.abc import Set as AbstractSet`
"UP038", # Use `X | Y` in `isinstance` call instead of `(X, Y)`
]
[lint.per-file-ignores]
"{check_extension_modules,freeze_modules}.py" = [
"UP031", # Use format specifiers instead of percent format
]
"generate_{re_casefix,sre_constants,token}.py" = [
"UP031", # Use format specifiers instead of percent format
]

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, maybe. I just wanted to keep the backport atomic and as close as possible to the specific PR.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We haven't backported Tools/build/.ruff.toml previously, I would suggest @webknjaz you just delete it from this PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could do that or actually look into backporting the rest in a follow-up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants