Skip to content

Unify python version used by CI. Update to 3.14.4#7571

Open
ShaharNaveh wants to merge 3 commits intoRustPython:mainfrom
ShaharNaveh:unify-python-version
Open

Unify python version used by CI. Update to 3.14.4#7571
ShaharNaveh wants to merge 3 commits intoRustPython:mainfrom
ShaharNaveh:unify-python-version

Conversation

@ShaharNaveh
Copy link
Copy Markdown
Contributor

@ShaharNaveh ShaharNaveh commented Apr 9, 2026

fix #7570

Summary by CodeRabbit

  • Chores
    • Removed hard-coded Python version across CI and switched workflows to derive the interpreter version from a repository version file.
    • Added a repository Python version file (3.14.4) and stopped ignoring such files so CI uses a single source of truth.
    • Updated CI steps to stop passing an explicit python-version input where the version is now determined dynamically.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 9, 2026

📝 Walkthrough

Walkthrough

Workflows removed hardcoded PYTHON_VERSION values and either stop passing python-version to actions/setup-python or read the version from a new .python-version file; .python-version was added to the repo and removed from .gitignore.

Changes

Cohort / File(s) Summary
Core CI workflows
​.github/workflows/ci.yaml, ​.github/workflows/cron-ci.yaml
Removed workflow-level PYTHON_VERSION env and removed python-version inputs from actions/setup-python steps; cron-ci.yaml also pins actions/setup-python to a commit SHA instead of using the env var.
Dynamic CPython selection
​.github/workflows/lib-deps-check.yaml, ​.github/workflows/update-libs-status.yaml
Removed PYTHON_VERSION env; added step to read .python-version and export it; replaced previous CPython clone logic with actions/checkout of python/cpython at ref: v${{ steps.cpython-version.outputs.version }} and updated references that used the env var.
Docs / upgrade note
​.github/workflows/upgrade-pylib.md
Bumped documented PYTHON_VERSION reference from v3.14.3 to v3.14.4.
Repository version file
.python-version, .gitignore
Added .python-version containing 3.14.4; removed .python-version entry from .gitignore so the file is tracked.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 I hopped through workflows, sniffed the breeze,
A tiny file for versions put at ease,
No scattered envs, a single cue,
3.14.4 — a carrot, fresh and new! 🥕

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the main objective: unifying Python version across CI and updating to 3.14.4, which directly matches the changeset's modifications to CI workflows and version files.
Linked Issues check ✅ Passed The PR successfully addresses issue #7570 by updating all CI workflows and tools from CPython 3.14.3 to 3.14.4, introducing a .python-version file for centralized version management, and removing hardcoded environment variables.
Out of Scope Changes check ✅ Passed All changes are directly related to the objective of updating CI and tools to target CPython 3.14.4; no unrelated modifications are present in the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

Comment @coderabbitai help to get the list of available commands and usage tips.

## Summary

Check \`scripts/update_lib\` for tools. As a note, the current latest Python version is \`${{ env.PYTHON_VERSION }}\`.
Check \`scripts/update_lib\` for tools. As a note, the current latest Python version is \`${{ steps.cpython-version.outputs.version }}\`.
<!--
Quick guideline for Copilot:
# Clone \`github.com/python/cpython\` \`${{ env.PYTHON_VERSION }}\` tag under RustPython working dir with depth 1 option; never 3.14.0 or 3.14.1 or 3.14.2
# Clone \`github.com/python/cpython\` \`${{ steps.cpython-version.outputs.version }}\` tag under RustPython working dir with depth 1 option; never 3.14.0 or 3.14.1 or 3.14.2
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/update-libs-status.yaml:
- Around line 33-37: The workflow step "Get target CPython version" fails
because it runs cat .python-version from the repository root while the code is
checked out under rustpython/, so update the command that sets version=$(cat
.python-version) to read the correct path (e.g., version=$(cat
rustpython/.python-version) or use the GitHub workspace variable) in that step
so the file is found and the CPython version is emitted to GITHUB_OUTPUT; change
the occurrence of ".python-version" in that step to "rustpython/.python-version"
(or equivalent workspace-aware path).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: c5f5c75a-6f14-46cd-a80e-6f989adb2d5e

📥 Commits

Reviewing files that changed from the base of the PR and between d5a90e5 and a96644a.

📒 Files selected for processing (7)
  • .github/workflows/ci.yaml
  • .github/workflows/cron-ci.yaml
  • .github/workflows/lib-deps-check.yaml
  • .github/workflows/update-libs-status.yaml
  • .github/workflows/upgrade-pylib.md
  • .gitignore
  • .python-version
💤 Files with no reviewable changes (2)
  • .gitignore
  • .github/workflows/ci.yaml

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

♻️ Duplicate comments (1)
.github/workflows/update-libs-status.yaml (1)

33-37: ⚠️ Potential issue | 🟠 Major

Template expansion in heredoc is still shell-injection prone.

Line 65 and Line 72 insert ${{ steps.cpython-version.outputs.version }} into an unquoted heredoc (<<EOF). If .python-version ever contains shell substitution text, bash will evaluate it while rendering the heredoc body. Please validate the version format at source (Line 33-37) before exporting it.

🔧 Minimal hardening patch
       - name: Get target CPython version
         id: cpython-version
         run: |
-          version=$(cat rustpython/.python-version)
+          version="$(tr -d '\r\n' < rustpython/.python-version)"
+          if [[ ! "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
+            echo "Invalid .python-version: $version" >&2
+            exit 1
+          fi
           echo "version=${version}" >> "$GITHUB_OUTPUT"
In bash, does a here-document with an unquoted delimiter (<<EOF) perform command substitution on content like $(...)?

Also applies to: 65-72

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/update-libs-status.yaml around lines 33 - 37, The step
with id "cpython-version" currently reads rustpython/.python-version into the
variable "version" and writes it to GITHUB_OUTPUT without validation;
validate/sanitize "version" before exporting (e.g., allow only a strict pattern
such as digits and dots or semver characters), reject or normalize any input
containing shell metacharacters like $, `, ;, |, or backslashes, and only echo
the validated value to "$GITHUB_OUTPUT"; keep the step id "cpython-version" and
the "version" variable but add a regex check and fail or sanitize on mismatch so
downstream uses (including unquoted heredocs) cannot trigger shell substitution.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In @.github/workflows/update-libs-status.yaml:
- Around line 33-37: The step with id "cpython-version" currently reads
rustpython/.python-version into the variable "version" and writes it to
GITHUB_OUTPUT without validation; validate/sanitize "version" before exporting
(e.g., allow only a strict pattern such as digits and dots or semver
characters), reject or normalize any input containing shell metacharacters like
$, `, ;, |, or backslashes, and only echo the validated value to
"$GITHUB_OUTPUT"; keep the step id "cpython-version" and the "version" variable
but add a regex check and fail or sanitize on mismatch so downstream uses
(including unquoted heredocs) cannot trigger shell substitution.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: 8295493e-fa96-47c0-8098-abc00c54e769

📥 Commits

Reviewing files that changed from the base of the PR and between a96644a and b6b006e.

📒 Files selected for processing (1)
  • .github/workflows/update-libs-status.yaml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update CI and tools to target CPython 3.14.4

2 participants