Skip to content

Select Each Repository's Python Line From Its Root .python-version - #4472

Merged
ptr727 merged 8 commits into
developfrom
burndown/python-version-selector
Nov 26, 2026
Merged

ptr727 merged 8 commits into
developfrom
burndown/python-version-selector

Conversation

@ptr727

@ptr727 ptr727 commented Nov 26, 2026 •

Copy link
Copy Markdown
Owner

Lets each repository select its Python line with a root .python-version naming X.Y, the toolchain-version model CODESTYLE.md "Toolchain Versions" states and .NET follows through global.json. The hub's workflows read that selector before falling back to 3.14. This is the part of #4187 that needs no decision. Carrying the file as a baseline unit waits on #4471.

What changes

  • .github/actions/python-version reads the caller's root .python-version, taking the first line that is neither blank nor a comment, as uv does. With no file it falls back to 3.14 with a warning. A test holds that fallback to the Python devcontainer snippet's line. A file naming no X.Y line fails the step, so CI never runs a line the file does not name.
  • validate-task.yml defaults python-versions to empty. An explicit input still wins, then the selector, then the fallback. The test-matrix job sparse-checks out /.python-version to resolve the line. It publishes the resolved array as a versions output, which unit-test reads.
  • The lint job selects the line itself, since it already holds the tree, and only that job warns of a fallback. It reads a present .python-version whatever python-versions names, so a malformed selector fails validate before a release would read it. It also refuses an explicit python-versions whose first entry differs from that line, since the release builds on it. The test-matrix job cannot tell whether the caller holds Python, so a warning from it would reach every .NET-only caller on every run.
  • The release task's build-pypi job selects the line ahead of the hub default. It passes the line a caller's .python-version selects to the new optional python-version input of pypi-build-default, so a release builds on the line validate tested. A caller carrying no selector passes nothing, and uv chooses an interpreter its requires-python admits, as before. The release never takes the 3.14 fallback, since it cannot see a caller's validate python-versions input.
  • python.version.consistent is a by-hand letter check in spec/project-types.json that applies wherever a root .python-version is present. It holds these to the selector:
    • a build-profile directory's requires-python floor
    • the ruff, mypy, and pyright targets, which stay unset there
    • a lint-only tree's explicit targets
    • the devcontainer tag
    • the first explicit python-versions entry
  • CODESTYLE.md and the python-codestyle Skill state the selector and the settings derived from it. docs/devcontainer.md states that a repository owns its Python tag. docs/reusable-workflows.md states the new default and the migration step.
  • The hub carries a root .python-version of 3.13, so its own pytest leg stays on its hub-owned tooling line. That line matches its lint-only pyproject.toml. spec/host-tools.json, the PEP 723 headers, and the lint job's job-wide setup-uv stay at 3.13. The Windows installer is unchanged.

For the promotion's release notes

A caller passing no python-versions input and carrying no root .python-version moves from 3.13 to 3.14 once its hub pin reaches this change. That covers its unit-test leg and its lint job's Python steps. Its hub-default PyPI release build is unchanged. Its lint job warns on each such run until it carries a selector. A caller whose requires-python or locked dependencies exclude 3.14 adds a .python-version before it moves its pin. The nested check name moves from Unit test job (Python 3.13) to Unit test job (Python 3.14) with it, a name that binds no ruleset. Its Codecov flag moves from python-3.13 to python-3.14, so a .codecov.yml naming the old flag stops matching it. A caller carrying a .python-version that names no X.Y line now fails validate. A caller passing python-versions, or carrying a valid .python-version, keeps the line it names. A caller carrying a valid .python-version builds its hub-default PyPI release on that line. A caller's own build-pypi hook is unchanged.

Not in this change

Carrying .python-version as a spec/files.json baseline unit, with its catalog snippet and the Python type's requiredFiles entry. #4187 asks for intent fidelity and for the whole value to be repository-owned, and the engine cannot express both. #4471 asks which gives way, so #4187 stays open for that part.

Dropped findings

  • tests/test_release_guards.py, the step runners this change does not touch that still run their own runner (the PyPI version, publish-history, Python test step, python-versions guard, and .NET coverage cases): consolidation on text this change did not touch.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Python versions are now selected from the repository’s .python-version file for validation and PyPI builds. If the file is missing, workflows use a 3.14 fallback; an invalid version entry fails validation.
    • Python version overrides for reusable workflows are now optional, with matrix checks defaulting to the selected version.
  • Documentation
    • Updated Python version selection, workflow configuration, and development-container guidance.

ptr727 and others added 3 commits November 25, 2026 18:33
The fleet default moves into a carried .python-version baseline, as .NET's
line lives in global.json. CI reads each caller's own selector, then falls
back to 3.14 with a warning, and a PyPI release builds on the same line.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The carried baseline unit waits on #4471. A selector naming no X.Y line
now fails rather than falls back, and both selection tests share one runner.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The release build cannot see a caller's python-versions input, so it takes
the line only where .python-version selects one. The step runners in the
release guards share one helper that keeps stderr.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ptr727 ptr727 added the comments Permits the comment lines the pull request adds or edits, which the prose gate otherwise refuses label Nov 26, 2026
Copilot AI lite review requested due to automatic review settings November 26, 2026 03:12
@ptr727

ptr727 commented Nov 26, 2026

Copy link
Copy Markdown
Owner Author

A recorded local strict-review pass covers head 5633ee25fc7505553ab2295560eff1e06e53ce6b, the content this pull request carries at that commit against develop, and it recorded 1 finding.

@coderabbitai

coderabbitai Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The change adds a root Python version selector and uses it to resolve Python versions for validation and PyPI builds. It also adds version consistency rules, updates supporting guidance, and expands release-guard tests.

Changes: Python Version Selection

Layer / File(s) Summary
Define the version source and consistency rules
.python-version, .github/actions/python-version/action.yml, spec/project-types.json, .agents/skills/python-codestyle/*, CODESTYLE.md, docs/devcontainer.md
The root .python-version sets Python 3.13. A new action parses its first nonblank, noncomment line or uses the 3.14 fallback when the file is absent. The project-type check and guidance describe related version settings.
Resolve Python versions for validation
.github/workflows/validate-task.yml, docs/reusable-workflows.md, tests/test_release_guards.py
The validation workflow resolves effective versions from the input or selector, publishes them for downstream jobs, and checks that lint versions match the selected line. Tests cover selection, validation, and matrix behavior.
Pass the selected version to PyPI builds
.github/actions/pypi-build-default/action.yml, .github/workflows/build-release-task.yml, tests/test_release_guards.py
When the caller has no build-pypi hook, the release workflow selects a Python version and passes it to the hub PyPI build action. The action leaves interpreter selection to uv when its input is empty.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related issues

  • Issue 4187 — This PR implements the .python-version selector and validation and release workflow wiring described in the issue; the carried-unit portion remains deferred.
Merge Risk: Minimal · up to 0e09d · assessed changes only

Path filters excluded changed files. This rating applies only to the assessed changes.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the main change: the Python version line used by the hub workflows is now selected from each repository's root .python-version file. The raw summary confirms this in the validator, lin…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: the Python version line used by the hub workflows is now selected from each repository's root .python-version file. The raw summary confirms this in the validator, lint job, PyPI build, and the new python-version action. Commit and documentation changes support the same theme. The title is specific and does not describe unrelated work.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 5ff2f7a and 0e09dd8.

Files ignored due to path filters: 5

  • .claude-plugin/fleet-skills/.source-digests/python-codestyle is excluded by !.claude-plugin/fleet-skills/**
  • .claude-plugin/fleet-skills/skills/python-codestyle/SKILL.md is excluded by !.claude-plugin/fleet-skills/**
  • .claude-plugin/fleet-skills/skills/python-codestyle/references/code-style.md is excluded by !.claude-plugin/fleet-skills/**
  • .github/skills/python-codestyle/SKILL.md is excluded by !.github/skills/**
  • .github/skills/python-codestyle/references/code-style.md is excluded by !.github/skills/**
Files selected for processing: 12

  • .agents/skills/python-codestyle/SKILL.md
  • .agents/skills/python-codestyle/references/code-style.md
  • .github/actions/pypi-build-default/action.yml
  • .github/actions/python-version/action.yml
  • .github/workflows/build-release-task.yml
  • .github/workflows/validate-task.yml
  • .python-version
  • CODESTYLE.md
  • docs/devcontainer.md
  • docs/reusable-workflows.md
  • spec/project-types.json
  • tests/test_release_guards.py

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

The release reads .python-version regardless, so the lint job now reads
it too and fails a malformed one before a release would.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Two moderate workflow issues remain because validation and release can resolve different Python versions, allowing pull-request checks to pass while the release uses a malformed or mismatched selector.

2 open issues
What changed in this PR

This pull request makes Python version selection repository-owned through a root .python-version file and updates validation, linting, and default PyPI builds to follow that selection.

Changes:

  • Adds Python selector parsing with validation and a 3.14 fallback.
  • Updates reusable workflows and default PyPI builds to use selected Python versions.
  • Adds consistency checks, documentation, tests, and synchronized Python coding skills.
  • Identifies a mismatch when explicit python-versions input conflicts with or bypasses the root selector during release.
File Description
tests/​test_release_guards.py Adds tests for Python selector behavior, workflow wiring, fallback handling, and release guards.
spec/​project-types.json Defines the python.version.consistent project consistency rule.
docs/​reusable-workflows.md Documents selector-based validation defaults, matrix behavior, and fallback handling.
docs/​devcontainer.md Documents repository ownership of the Python devcontainer version.
CODESTYLE.md Adds guidance for the Python version selector and derived toolchain settings.
.python-version Selects Python 3.13 for the hub repository.
.github/​workflows/​validate-task.yml Resolves Python versions for validation, linting, and unit-test jobs using explicit inputs or the repository selector.
.github/​workflows/​build-release-task.yml Selects and forwards the Python version used by the default PyPI build.
.github/​skills/​python-codestyle/​SKILL.md Updates the generated Python coding skill with selector guidance.
.github/​skills/​python-codestyle/​references/​code-style.md Updates the generated Python code-style reference with selector-related guidance.
.github/​actions/​python-version/​action.yml Implements root .python-version parsing, fallback behavior, warnings, and malformed-input validation.
.github/​actions/​pypi-build-default/​action.yml Adds an optional Python version input for default PyPI builds.
.claude-plugin/​fleet-skills/​skills/​python-codestyle/​SKILL.md Updates the generated Claude Python coding skill.
.claude-plugin/​fleet-skills/​skills/​python-codestyle/​references/​code-style.md Updates the generated Claude Python code-style reference.
.claude-plugin/​fleet-skills/​.source-digests/​python-codestyle Refreshes the source digest for the generated Python skill.
.agents/​skills/​python-codestyle/​SKILL.md Updates the authored Python coding skill with selector guidance.
.agents/​skills/​python-codestyle/​references/​code-style.md Updates the authored Python code-style reference.

Review effort: Lite

Comment thread .github/workflows/validate-task.yml Resolved
@ptr727

ptr727 commented Nov 26, 2026

Copy link
Copy Markdown
Owner Author

A recorded local strict-review pass covers head 658a1d9a3382bc4796c5fb3c258580f3bee7366b, the content this pull request carries at that commit against develop, and it recorded 0 findings.

ptr727 and others added 2 commits November 25, 2026 19:21
The release builds on the line .python-version selects, so validate now
refuses to test a different line first.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The runner takes a step's script text, so the lint resolve and matrix-file
tests use it rather than their own copies.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.89%. Comparing base (b38e084) to head (0e09dd8).
⚠️ Report is 359 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #4472      +/-   ##
===========================================
- Coverage    81.60%   78.89%   -2.72%     
===========================================
  Files           26       49      +23     
  Lines         9070    16709    +7639     
===========================================
+ Hits          7402    13182    +5780     
- Misses        1668     3527    +1859     
Flag Coverage Δ
python-3.13 78.89% <ø> (-2.72%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ptr727

ptr727 commented Nov 26, 2026

Copy link
Copy Markdown
Owner Author

A recorded local strict-review pass covers head 97199af88265f871e7f2a30b545839a83a6f88b0, the content this pull request carries at that commit against develop, and it recorded 3 findings.

ptr727 and others added 2 commits November 25, 2026 19:34
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ptr727

ptr727 commented Nov 26, 2026

Copy link
Copy Markdown
Owner Author

A recorded local strict-review pass covers head 0e09dd811c41c42d1d939c048b8d396672a0e2c9, the content this pull request carries at that commit against develop, and it recorded 0 findings.

@ptr727

ptr727 commented Nov 26, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@ptr727

ptr727 commented Nov 26, 2026

Copy link
Copy Markdown
Owner Author

/review

@coderabbitai

coderabbitai Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@ptr727
ptr727 merged commit 2fdc720 into develop Nov 26, 2026
14 checks passed
@ptr727
ptr727 deleted the burndown/python-version-selector branch November 26, 2026 04:08
ptr727 added a commit that referenced this pull request Nov 26, 2026
…s, Environment Secret Audit, and macOS Bash Floor (#4485)

Promotes the 26 pull requests that landed on develop since the last
promotion (#4428), from the away-mode backlog burndown run.

- #4447: Bump markdownlint-cli2-action from 25.0.0 to 25.1.0.
- #4449: Have the agent open and drive the promotion after an audit's
file fix merges.
- #4453: Pass over a signal handled as the prose gate's first handler
starts.
- #4456: Record a managed copy for claude and codex in install-agents
and report any other copy as a stray.
- #4457: Name the PowerShell suppression form and correct the Python CI
backstop text.
- #4458: Read the metrics report's reviewed heads from the gate's one
filter (part of #3880, completed by #4481).
- #4460: Cross-check Python directories against Dependabot's pip and uv
entries (items 2 and 3 of #2286, which stays open for item 1).
- #4461: Pin the Docker lint images by digest through a
Dependabot-tracked manifest.
- #4464: State the platform weighting and correct the hook-promotion
worked example.
- #4463: Key Qodo findings without links or commit hashes and ask
dismissal by title and location.
- #4465: Hand a caller's hook-input to the validate and resolve-upstream
hooks.
- #4466: Require an empty workflow-level permissions block on
entry-point callers.
- #4467: Remove the npm and bun upgrade paths no managed tool reaches.
- #4469: Add a hub-hosted script that enables a clone's hook framework
once.
- #4472: Select each repository's Python line from its root
`.python-version` (the part of #4187 needing no decision; #4187 stays
open).
- #4479: Report dotnet and powershell as unmanaged while Microsoft's
feed is unconfigured.
- #4477: Bound the shell trap's child wait and give the heading search a
file.
- #4480: Check deployment environment secret and variable names in the
audit.
- #4478: Add a macOS bash 4.4 floor with a platform-scoped host tool
entry.
- #4481: Build the gate's comment readers on one trusted-comment reader.
- #4484: Record the measured absence of a git floor for
`--end-of-options`.
- #4496: Narrow the Qodo acknowledgment key's normalization to a link
and a hash after `commit`.
- #4500: Pass over a signal handled as the hook enabler's first handler
starts.
- #4502: Pin the GitHub host for every `gh` child the hub's Python
scripts start.
- #4503: Write the Docker pull retry once, with one backoff schedule.
- #4505: Pin the repo gate's `gh` read and parse the Docker pin manifest
once.

## Release notes for callers

- #4472: A caller passing no `python-versions` input and carrying no
root `.python-version` moves from Python 3.13 to 3.14 for its
`unit-test` leg and its `lint` job's Python steps once its hub pin
reaches this change. Its nested check name moves from `Unit test job
(Python 3.13)` to `Unit test job (Python 3.14)`, and its Codecov flag
from `python-3.13` to `python-3.14`, so a `.codecov.yml` naming the old
flag stops matching. Its `lint` job warns on each run until it carries a
selector. A caller whose `requires-python` or locked dependencies
exclude 3.14 adds a `.python-version` before moving its pin. A
`.python-version` naming no `X.Y` line, or an explicit `python-versions`
whose first entry differs from the file's line, now fails validate.
- #4479: The Linux `install-tools.sh --json` report schema moves from 1
to 2, because a not-installed `dotnet` or `powershell` can now read
`unmanaged` with `installed: null`. A hand-installed amd64 `powershell`
with no Microsoft feed now reads `unmanaged`. The Windows `-Json` report
stays at schema 1.
- #4466: Each entry-point caller must declare an empty workflow-level
`permissions: {}` block. A site repository's `deploy-site.yml` carrying
only job-level blocks now reports this as drift, and the fix belongs to
that repository.
- #4461: Dependabot's docker ecosystem listing tags on mirror.gcr.io for
the shellcheck and shfmt lines is unconfirmed until its first docker run
for that directory.
- #4478: macOS now has a bash 4.4 floor, met by Homebrew's bash ahead of
the system bash on `PATH`. Not yet verified on a native macOS host.
- #4480: The audit gains the `secrets.environments` check. Registry
`environments[]` entries may now declare their secret and variable
names.
- #4463 and #4496: The Qodo acknowledgment key changed. A
`fleet-finding-ack` already posted on a still-open pull request stops
matching its finding once a caller's hub pin reaches this change. Post
it again, since `merge` refuses until then.
- #4502: Every `gh` child the Python scripts under the hub's `scripts/`
and `spec/` start now runs with `GH_HOST=github.com`, so an exported
`GH_HOST` no longer moves their reads and writes. #4505 pins the repo
gate's own `gh_read` the same way. The `gh-write-guard` hook (#4501) and
the shell and PowerShell scripts are unchanged.
- #4503: The `validate-task.yml` EditorConfig, shell, and PowerShell
lint steps now pull their images through `docker_lint.py --pull`, with
one retry schedule of 3 attempts waiting 15s, then 30s. The
`docker-lint-pins` action gains a `docker-lint` output naming that
script at the calling workflow's own ref. A caller pinned before this
change keeps its inline retry.
- #4505: The `docker-lint-pins` action now reads the pin manifest
through `docker_lint.py --pin` rather than `sed`, so its step runs
`python3`. It now refuses an empty tag or a stage named twice, which the
old `sed` accepted, and on a failure it writes no outputs and one
`::error::` annotation carrying the reason.
- A fleet resync is owed, because carried text changed: AGENTS.md,
GOVERNANCE.md, CODESTYLE.md, and several skills.

## Findings from the local strict review

The attested local pass on c25ec49 (`main...develop`) raised five
findings. Their outcomes:

- Tracked: the hub's own `dependabot.ecosystems` DRIFT on `/tests` is
the question #4459 holds, so it changes nothing here.
- Fixed by #4500: `scripts/enable_hooks.py` `on_signal` now passes over
a signal handled as its first handler starts.
- Fixed by #4503: the bounded Docker pull retry is now written once,
`scripts/docker_lint.py` `pull_image`, with one schedule.
- Fixed by #4502: `spec/audit_environments.py` `names()` is gone, and
both environment readers read through `spec/resolve_secrets.py`
`read_names`.
- Release note: the Qodo acknowledgment key change from #4463 and #4496
is stated under "Release notes for callers" above.

The attested local pass on f93f34a (`main...develop`) raised 57
findings. Their outcomes:

- Declined, 52 `prose_lint` `comment-added` lines: each comment was
added by a feature pull request carrying the `comments` label (#4456,
#4461, #4463, #4465, #4467, #4472, #4480), and the promotion re-carries
them without that label.
- Tracked: `spec/audit_dependabot.py:93`, the hub's own `/tests` pip
drift, is the question #4459 holds.
- Tracked: the nested-signal guard missing at
`scripts/docker_lint.py:416`, `scripts/backlog_metrics.py:1290`, and
`catalog/snippets/hub_fetch_run.py:193` is the class #4452 holds.
- Release note: the Qodo key change at
`scripts/pr_review_answers.py:158` is stated above.
- Fixed by #4505: `.github/actions/repo-gate/repo_gate.py` `gh_read` now
starts its `gh api` child under `gh_env()`, which pins
`GH_HOST=github.com`.
- Fixed by #4505: `scripts/docker_lint.py` `read_pins` is now the pin
manifest's one parser. The repo gate dropped `SHELLCHECK_PIN`, and the
`docker-lint-pins` action dropped its `sed` for `docker_lint.py --pin`.

The attested local pass on 3183644 (`main...develop`) raised 53
findings. Their outcomes:

- Declined, 51 `prose_lint` `comment-added` lines: the same comments the
pass on f93f34a named, less the `docker-lint-pins` `action.yml` line
#4505 removed, each added by a feature pull request carrying the
`comments` label.
- Tracked: the nested-signal guard missing at
`scripts/docker_lint.py:448`, `scripts/backlog_metrics.py:1290`,
`scripts/pr_review.py:2174`, and `catalog/snippets/hub_fetch_run.py:193`
is the class #4452 holds.
- `introduced`, design, `scripts/docker_lint.py:856`: `resolve_digest`
runs one more `docker image inspect` per linter to read a digest the pin
manifest's tag-and-digest reference already gives, since #4461 pins
every image, and it takes `RepoDigests[0]`, which can name another
repository holding the same image. Deferred to #4508 by the maintainer's
decision, which is this finding's outcomes.

Fixes #3468
Fixes #3880
Fixes #4408
Fixes #2070
Fixes #4473
Fixes #4474
Fixes #2594
Fixes #4327
Fixes #4450
Fixes #1783
Fixes #3325
Fixes #3917
Fixes #4448
Fixes #1164
Fixes #1613
Fixes #1727
Fixes #4403
Fixes #4407
Fixes #4158
Fixes #4210
Fixes #4429
Fixes #4406
Fixes #4488
Fixes #4498
Fixes #4489
Fixes #4499
Fixes #4504

🤖 Generated with [Claude Code](https://claude.com/claude-code)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comments Permits the comment lines the pull request adds or edits, which the prose gate otherwise refuses

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants