Skip to content

Commit ef5339f

Browse files
committed
fix: pin the Black target version to the minimum supported Python
Black infers its target versions from `requires-python`. Because that bound is open-ended (`>=3.11`), it expanded to every version Black knows about, including py315: target_version: ['py311', 'py312', 'py313', 'py314', 'py315'] Black's safety check re-parses its output with the stdlib `ast` module using the highest target version, which no interpreter from 3.11 to 3.14 can do. That made every lint job emit: Warning: Python 3.14 cannot parse code formatted for Python 3.15. Formatting was never affected, since Black only emits syntax common to all targets and so was already formatting for the 3.11 floor; `--diff` output is byte-identical between py311 and py315. What was lost is the AST equivalence check that guards against Black corrupting code. Pinning the floor explicitly restores that check and silences the warning with no formatting change. This needs bumping alongside any future increase to `requires-python`. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01X5qn7KvBztnwaRTFoL9KNo
1 parent a536e3a commit ef5339f

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ module-root = ""
4141
source-exclude = ["**/*_test.py"]
4242
wheel-exclude = ["**/*_test.py"]
4343

44+
[tool.black]
45+
target-version = ["py311"]
46+
4447
[tool.pytest.ini_options]
4548
norecursedirs = [
4649
"node_modules"

0 commit comments

Comments
 (0)