From ef5339ff7bd056cd99be5ad3a1e00dc8cabbd70c Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 13 Aug 2026 16:31:29 +0000 Subject: [PATCH] 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 Claude-Session: https://claude.ai/code/session_01X5qn7KvBztnwaRTFoL9KNo --- pyproject.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 7ea9de9a..2797790c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -41,6 +41,9 @@ module-root = "" source-exclude = ["**/*_test.py"] wheel-exclude = ["**/*_test.py"] +[tool.black] +target-version = ["py311"] + [tool.pytest.ini_options] norecursedirs = [ "node_modules"