Repository navigation
Description
Update 2026-11-26 (infra move): .github/renovate/base.json is gone. The shared preset is renovate/base.json of dan-petty/infra.
Validate .github/renovate.json only. The custom manager for DEFAULT_PYTHON_VERSION is not at index 5: find it by its pattern. No tools-lock pattern exists.
Problem
The Python minor version is copied into src/ in many places:
DEFAULT_PYTHON_VERSION(defaults.py:181) and the--python-versionoption of ci/typecheck.py:21._verify_python_314_environment(ci.py:246-258), a noqa'd UP036 copy ofrequires-python, with 20 call sites and thepython_version_checkgate row (ci.py:1306-1324, :1440-1450).- Literals in kb.py:561-562,574, analysis.py:635, canary.py:534,554, metadata.py:34-35,54 and
DEFAULT_ANALYSIS_PYTHON_FLOOR(defaults.py:1359). - Seven
python:3.14-slimdefaults.
A Renovate custom manager (customManagers[5]) writes the defaults.py copy, and each such .py edit starts Fail-to-Pass. pyproject.toml (requires-python, [tool.mypy] python_version) already owns the value.
Change
- Delete
DEFAULT_PYTHON_VERSION(defaults.py:181) and the--python-versionoption of ci/typecheck.py:21. mypy reads[tool.mypy] python_version(pyproject.toml:202). - Delete
_verify_python_314_environment, its 20 call sites, thepython_version_checkgate row, messages.py:2194,2275 and the unreadmypy_checkat :2231, and errors.py:291-292. Fix docs/SDLC.md:173,206. - One helper gives the Python minor: the
requires-pythonof the reviewed project, else theRequires-Pythonof devops-cli fromimportlib.metadata, elsesys.version_info. It replaces the literals at kb.py:561-562,574, analysis.py:635, canary.py:534,554, metadata.py:34-35,54 andDEFAULT_ANALYSIS_PYTHON_FLOOR. - The seven
python:3.14-slimdefaults (defaults.py:166,784, docker.py:404, sandbox.py:121, test_cmd.py:339, docker_plans.py:97, sandbox_plans.py:15) become one default computed fromsys.version_info. The image stays a user option. - Change the tests that hard-code
3.14or--python-version 3.14: test_typecheck.py:23-24, test_ci.py:383,471-480, test_metadata.py:42,51,80,104, the implement step tests, test_language_catalogs.py:95, test_sandbox.py:47, test_sandbox_dry_run.py:123-124, test_ai_gateway_tune.py:422, test_test_runner.py:490 and test_sandbox_trace_context.py.
Renovate. Remove the src/devops_cli/config/defaults.py pattern and the DEFAULT_PYTHON_VERSION alternative of customManagers[5]. Keep its pyproject.toml pattern (a manifest). Drop the sentence 'python:3.-slim defaults under src/' from the python-runtime prBodyNotes (packageRule 18).
Risk. Low. A person who runs the source tree on an older Python without uv sees an import error and not the gate message. The sandbox defaults follow the minor of the running interpreter.
Proof
- The typecheck row of
uv run devops cipasses with no--python-version. git grep -nE 'python:3\.14-slim|"py314"|\(3, 14\)|DEFAULT_PYTHON_VERSION' origin/main -- 'src/**/*.py'returns nothing. (The pattern is limited to Python files, because a shipped Dockerfile can name a python image.)- Scoped pytest passes. docs/MCP_TOOLS.md and the MCP snapshot do not change, because the computed value equals the literal of today.
Alternatives check of 2026-11-27: not-applicable.
Class: refactor, no model call.
Tool: none found.
Proposed design
Problem statement
The Python minor version is copied into many source files, tests, a CI gate and Renovate rules. The copies drift from pyproject.toml. This change keeps one helper for the minor and one container-image default. It removes the duplicate CI gate, the --python-version option and the Renovate source edit.
Acceptance criteria
Requirement: Single Python minor helper
The project SHALL expose one helper get_project_python_version that returns the Python minor of the reviewed project, the installed package or the running interpreter.
Scenario: Reviewed project floor
- WHEN the test writes
requires-python = ">=3.13"to a temporarypyproject.tomland calls the helper on it - THEN the helper returns
3.13
Requirement: Installed package fallback
The helper SHALL use the Requires-Python value of the installed devops-cli distribution when the reviewed project gives no usable requires-python.
Scenario: Package metadata fallback
- WHEN the project file is invalid and
importlib.metadata.metadatareturnsRequires-Python: >=3.13 - THEN the helper returns
3.13
Requirement: Running interpreter fallback
The helper MUST read sys.version_info at call time and use it when the project and the package give no version.
Scenario: Interpreter fallback
- WHEN both sources fail and the test patches
sys.version_infoto major 3 and minor 13 - THEN the helper returns
3.13
Requirement: One container image default
The project SHALL compute the default container image as python:<major>.<minor>-slim from sys.version_info in one function.
Scenario: Image default from the interpreter
- WHEN the test patches
sys.version_infoto major 3 and minor 13 and callsdefault_python_image - THEN the function returns
python:3.13-slim
Requirement: Review floor from the helper
The review analysis MUST build its py<major><minor> Python floor from get_project_python_version and SHALL hold no DEFAULT_ANALYSIS_PYTHON_FLOOR constant.
Scenario: Review floor for a project on 3.13
- WHEN the test builds the analysis config of a project with
requires-python = ">=3.13" - THEN the Python floor is
py313
Requirement: No duplicated Python version literals
The Python files under src/ SHALL hold no DEFAULT_PYTHON_VERSION, DEFAULT_ANALYSIS_PYTHON_FLOOR, "py314", (3, 14) or python:3.14-slim literal.
Scenario: Source literal scan
- WHEN
git grep -nE 'DEFAULT_PYTHON_VERSION|DEFAULT_ANALYSIS_PYTHON_FLOOR|"py314"|\(3, 14\)|python:3\.14-slim' -- 'src/**/*.py'runs - THEN it returns no match
Requirement: Typecheck option removed
The typecheck command MUST NOT pass --python-version to mypy and SHALL take the version from [tool.mypy] python_version.
Scenario: Typecheck options
- WHEN the test imports
TYPECHECK_OPTIONSfromdevops_cli.ci.typecheck - THEN no entry is
--python-versionand no entry starts with--python-version=
Requirement: Python environment gate removed
The ci command MUST NOT run _verify_python_314_environment or write a python_version_check gate row.
Scenario: Removed gate scan
- WHEN
git grep -nE '_verify_python_314_environment|python_version_check' -- src/devops_cli/commands/ci.py src/devops_cli/lang/en/messages.pyruns - THEN it returns no match
Requirement: Renovate configuration valid
The Renovate configuration SHALL stay valid after it drops the src/devops_cli/config/defaults.py pattern and keeps the pyproject.toml pattern.
Scenario: Renovate config validation
- WHEN
npx --yes --package renovate renovate-config-validator --strict .github/renovate.jsonruns - THEN the validator exits 0 and reports no error
Requirement: SDLC documentation updated
docs/SDLC.md SHALL name pyproject.toml and mypy as the source of the Python minor and MUST NOT name the python_version_check gate or DEFAULT_PYTHON_VERSION.
Scenario: SDLC documentation check
- WHEN
uv run devops ci --check --only docsruns andgit grep -nE 'python_version_check|DEFAULT_PYTHON_VERSION' docs/SDLC.mdruns - THEN the docs row exits 0 and the grep returns no match
Requirement: Scoped tests pass
The changed tests SHALL pass with no hard-coded 3.14 expectation and no --python-version 3.14 argument.
Scenario: Scoped test run
- WHEN
uv run pytest tests/ci/test_typecheck.py tests/config/test_metadata.py tests/commands/test_ci.pyruns - THEN all selected tests pass
Existing Tool Considered
The alternatives check in the issue body holds the verdict (not-applicable); it names no tool. packaging is open and maintained, and pyproject.toml pins it as packaging==26.3. It covers the parse of requires-python through packaging.specifiers.SpecifierSet. It lacks the project-to-package-to-interpreter fallback, the py<major><minor> review floor and the python:<major>.<minor>-slim image default. The change adds these in src/devops_cli/config/metadata.py and src/devops_cli/config/defaults.py: about 2,000 tokens to build, about 500 tokens per later change to keep, and about 2 hours.
Key questions
- Where should the single Python minor helper live?: Extend
src/devops_cli/config/metadata.pywithget_project_python_version. The module already finds the project file, parses itsrequires-pythonand falls back to the installed distribution. (best practice) [sources: src/devops_cli/config/metadata.py:39, src/devops_cli/config/metadata.py:49, pyproject.toml]- Chosen: Extend
src/devops_cli/config/metadata.py. It already holds the project file search, the version parse and the distribution fallback, so the change adds no second loader. - Rejected: New module
src/devops_cli/config/python_version.py. It duplicates the loader, the path search and the distribution fallback. - Rejected:
src/devops_cli/review/canary.py. Its parsers serve a review tree only, and the typecheck, sandbox and analysis call sites are outside the review.
- Chosen: Extend
- How should the helper read the minor from a
requires-pythonspecifier?: Parse the specifier withpackaging.specifiers.SpecifierSetand take the lowest version of the>=or~=bounds. If it holds no lower bound, use the next source. (best practice) [sources: pyproject.toml, src/devops_cli/config/metadata.py:49]- Chosen:
packaging.specifiers.SpecifierSet. It is open, maintained and already pinned, and it handles~=,!=and compound specifiers. - Rejected: The current regular expression. It reads only a leading
>=, so~=3.14and>=3.13,<4give the wrong minor. - Rejected:
sys.version_infoonly. It ignores the Python floor that the reviewed project declares.
- Chosen:
- In which order should the helper read the Python minor?: The reviewed project's
requires-python, then theRequires-Pythonof the installed devops-cli distribution, thensys.version_inforead inside the call. (best practice) [sources: pyproject.toml, src/devops_cli/config/metadata.py:39]- Chosen: Project, package, interpreter. The reviewed project floor has priority, and the package and the interpreter are fallbacks.
- Rejected: Package, project, interpreter. A review of another project would use the devops-cli version before the project floor.
- Rejected: Interpreter, project, package. It hides the Python floor that the project declares.
- Should the ci Python environment gate stay?: No. Remove
_verify_python_314_environment, its call sites, thepython_version_checkgate row and its messages.pyproject.tomland[tool.mypy] python_versionown the value. (best practice) [sources: src/devops_cli/commands/ci.py, src/devops_cli/lang/en/messages.py, pyproject.toml]- Chosen: Remove the gate. It removes a duplicate version source and the noqa'd UP036 copy, and mypy still reads the one setting.
- Rejected: Keep a non-gating check. It still duplicates the version and still starts Fail-to-Pass on each edit.
- Rejected: Replace the gate with a helper call. It adds no gate value over
pyproject.tomland mypy.
- Should the typecheck command keep
--python-version?: No. Remove it fromTYPECHECK_OPTIONSatsrc/devops_cli/ci/typecheck.py:21. mypy reads[tool.mypy] python_versionfrompyproject.toml. (best practice) [sources: src/devops_cli/ci/typecheck.py:21, pyproject.toml, tests/ci/test_typecheck.py]- Chosen: Remove
--python-version. It leaves one version source inpyproject.toml. - Rejected: Keep the option with a helper default. It duplicates the mypy setting and gives two values that can drift.
- Chosen: Remove
- How should the seven container image defaults become one?: Add one
default_python_image()function tosrc/devops_cli/config/defaults.pythat returnspython:{sys.version_info.major}.{sys.version_info.minor}-slim. Call it at the seven former literal sites. The image stays a user option. (best practice) [sources: src/devops_cli/config/defaults.py, src/devops_cli/commands/sandbox.py, src/devops_cli/sandbox/sandbox_plans.py]- Chosen: One
default_python_image()fromsys.version_info. The image follows the running interpreter, as the issue states, and has one definition. - Rejected: One default from the helper. The image would follow the reviewed project and not the runner.
- Rejected: Keep seven literals. The literals drift and start Fail-to-Pass on each edit.
- Chosen: One
- What should happen to
DEFAULT_ANALYSIS_PYTHON_FLOORand the review literals?: Remove the constant atsrc/devops_cli/config/defaults.py:1434and build thepy<major><minor>floor from the helper insrc/devops_cli/review/analysis.py. Thepy314fallbacks insrc/devops_cli/review/canary.pyuse the same helper. (best practice) [sources: src/devops_cli/config/defaults.py:1434, src/devops_cli/review/analysis.py, src/devops_cli/review/canary.py]- Chosen: Remove the constant and derive the floor. It removes a second version source and leaves the helper as the one source.
- Rejected: Keep it as an alias. It leaves a duplicate value that can drift.
- How should the Renovate custom manager change?: Remove the
src/devops_cli/config/defaults.pypattern and theDEFAULT_PYTHON_VERSIONalternative of customManagers[5]. Keep thepyproject.tomland tools-lock patterns. Drop thepython:3.<minor>-slimsentence of packageRule 18 and theDEFAULT_PYTHON_VERSIONmentions in.github/renovate.jsonanddocs/SDLC.md. (best practice) [sources: .github/renovate.json, docs/SDLC.md]- Chosen: Keep only the manifest and tools-lock patterns.
pyproject.tomlis a manifest and already ownsrequires-python, and no source copy remains. - Rejected: Keep the
defaults.pypattern. It edits source and starts Fail-to-Pass. - Rejected: Move the pattern to packageRule 18. It keeps a source copy of the version.
- Chosen: Keep only the manifest and tools-lock patterns.
- How should the tests that hard-code
3.14change?: Derive the expected value from the helper or fromsys.version_info. The metadata tests compare with_parse_python_version, the typecheck tests assert onTYPECHECK_OPTIONS, and the sandbox tests readdefault_python_image. Add no new3.14literal. (best practice) [sources: tests/config/test_metadata.py, tests/ci/test_typecheck.py]- Chosen: Derive the expected value. The tests then follow the one version source and do not break when the minor changes.
- Rejected: Keep
3.14literals. The tests break when the Python minor changes. - Rejected: Skip the affected tests. It removes coverage of the version path.
Fit
Fits in one pull request.
Suspected block
None.
Activity
dan-petty commentedon Nov 19, 2026
Both touch the Fail-to-Pass trigger for tool version edits, but #5585 fixes the path filter while this item removes the Python version literals that start the check.devops-cli-service commentedon Nov 19, 2026
Next step: the open items close, or a person replies in a comment or edits the body. See Dependencies in the section Proposed design of the body.
devops-cli-service commentedon Nov 22, 2026
Next step: the stage job writes the plan of the item. See the section Proposed design of the body.