Question
In a project of mine I upgraded from python 3.14 to 3.15.0b1.
I also changed the target in ruff.toml
target-version = "py315"
These are my rules, I haven't change anything there for the python upgrade:
target-version = "py315"
line-length = 180
[lint]
select = [
"F", # Pyflakes
"E", # Pycodestyle Error
"W", # Pycodestyle Warning
"UP", # Pyupgrade
"B", # Bugbear
"SIM", # Simplify
"I", # Isort
"RET", # Return (Guard clauses)
"FBT", # Boolean Trap
"C4", # Comprehensions
# "ANN", # Annotations (No Any)
"ERA", # Eradicate (Commented-out code)
"PIE", # Pie
"PLR", # Pylint Refactor
"PLE", # Pylint Error
"EM", # Error Message (Enforce variables for strings),
"TD006",
]
ignore = [
"ARG", # creates too many false positive :( (esp. on method overwrites)
"D", # No docstrings
"RET504", # Allow variable assignment before return (Debuggable)
"B028", # changes code behavior
"FBT001", # might be a bit too pedantic
"PLR0913", # I support the idea but dealing with playwright does make it usable
"ERA001", # can be meaningful to document intent
"EM102",
"EM101", # too verbose, esp. with AI code generation
"PLR2004", # too strict
]
# see: https://github.com/astral-sh/ruff/issues/22620#issue-3821861117
extend-unsafe-fixes = [
"F541", # f"Hello {name}" intended, but f"Hello name" written, would be "fixed" into "Hello name"
]
[lint.isort]
combine-as-imports = true
lines-after-imports = 2
[lint.flake8-annotations]
# Forbid 'Any' for regular args (ANN401), but allow for variadic pass-throughs
allow-star-arg-any = true
[lint.flake8-unused-arguments]
# Support the underscore approach for forced API/Inheritance arguments
ignore-variadic-names = true
[lint.flake8-bugbear]
extend-immutable-calls = [
"fastapi.Depends",
"fastapi.Query",
"click.option",
]
[format]
quote-style = "double"
indent-style = "space"
skip-magic-trailing-comma = false
Now it warns in my code base:
just check
uv lock --check
Resolved 81 packages in 5ms
ruff check .
warning: Support for Python 3.15 is under development and may be unstable. Enable `preview` to remove this warning.
I001 [*] Import block is un-sorted or un-formatted
--> cli/src/single_test/collector.py:1:1
|
1 | / import os
2 | | import re
3 | | import subprocess
4 | | import sys
5 | | import tomllib
6 | | from collections.abc import Iterator
7 | | from concurrent.futures import ThreadPoolExecutor, as_completed
8 | | from pathlib import Path
9 | |
10 | | from single_test.packages import load_packages
| |______________________________________________^
|
help: Organize imports
Found 1 error.
[*] 1 fixable with the `--fix` option.
error: recipe `check` failed on line 39 with exit code 1
and wants to fix it as such:
import os
import re
import subprocess
import sys
from collections.abc import Iterator
from concurrent.futures import ThreadPoolExecutor, as_completed
from pathlib import Path
import tomllib
from single_test.packages import load_packages
_TEST_ID_RE = re.compile(r"^\S+::\S")
...
Is it wanted behavior to have tomlib in its own import block? IIANM, only non-standard libraries should have their own import section, no?
Is this a bug? Did I configure ruff incorrectly for python 3.15?
The code linted before (target 3.14) just wine with one sorted import block like so:
import os
import re
import subprocess
import sys
import tomllib
from collections.abc import Iterator
from concurrent.futures import ThreadPoolExecutor, as_completed
from pathlib import Path
from single_test.packages import load_packages
...
Version
ruff 0.15.12
Question
In a project of mine I upgraded from python 3.14 to 3.15.0b1.
I also changed the target in
ruff.tomltarget-version = "py315"
These are my rules, I haven't change anything there for the python upgrade:
Now it warns in my code base:
and wants to fix it as such:
Is it wanted behavior to have tomlib in its own import block? IIANM, only non-standard libraries should have their own import section, no?
Is this a bug? Did I configure ruff incorrectly for python 3.15?
The code linted before (target 3.14) just wine with one sorted import block like so:
Version
ruff 0.15.12