Skip to content

ci: key the venv cache on the full Python version - #248

Merged
pdelsante merged 1 commit into
developfrom
fix/venv-cache-python-version
Oct 28, 2026
Merged

pdelsante merged 1 commit into
developfrom
fix/venv-cache-python-version

Conversation

@pdelsante

Copy link
Copy Markdown
Member

Goal

Stop restoring a virtualenv that was built with a different Python patch release.

Why

The venv cache key is <ref>-venv-<requirements hash>. A venv links to its interpreter by full path (/opt/hostedtoolcache/Python/3.14.9/...). On certego/babel#33 the runner moved from 3.14.9 to 3.14.8, the cached venv was restored anyway, and Run linters failed with .venv/bin/black: cannot execute: required file not found. Rerunning the job does not help.

How

  1. restore_virtualenv and save_virtualenv read the runner's Python version (platform.python_version()) in a new step.
  2. The key becomes <ref>-venv-py<X.Y.Z>-<requirements hash>. Inputs and callers are unchanged.
  3. Updated both action READMEs, and the hardlinked copies under .github/.

Out of scope

  • The pip cache key is left as it is: wheels are not tied to the interpreter path.
  • Entries saved under the old key format just stop matching and expire, so there is no migration.

🤖 Generated with Claude Code

A restored venv links to its interpreter by full path. When the runner moves
to another patch release (3.14.9 -> 3.14.8) the venv is restored anyway and
every tool fails with 'cannot execute: required file not found'.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@pdelsante
pdelsante marked this pull request as ready for review October 28, 2026 11:33
@pdelsante
pdelsante merged commit d29337d into develop Oct 28, 2026
5 checks passed
@pdelsante
pdelsante deleted the fix/venv-cache-python-version branch October 28, 2026 11:40
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.

1 participant