Repository navigation
ci: keep the venv cache valid across runners - #36
Merged
Merged
Conversation
notdodo
force-pushed
the
ci/fix-venv-cache
branch
from
November 15, 2026 10:07
1c806e7 to
be2ee8c
Compare
The cached .venv linked to a uv-managed interpreter that setup-uv did not restore, so on a cache hit uv deleted and recreated the venv with only the default groups, and the skipped install step left mypy without the redaction extra. Enable setup-uv cache-python so the interpreter is restored with the venv, cache .venv and .mypy_cache per Python version and uv.lock, and always run task install so any partial restore self-heals. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
notdodo
force-pushed
the
ci/fix-venv-cache
branch
from
November 15, 2026 10:07
be2ee8c to
6097b78
Compare
notdodo
added a commit
that referenced
this pull request
Nov 15, 2026
## Problem Python 3.15 CI takes about 14 minutes whenever `uv.lock` changes, which includes every Dependabot PR and #37: - The venv cache key and setup-uv's own cache key both include the lockfile hash, and neither has a fallback. A changed lockfile misses both. - There are no 3.15 wheels yet for numpy, pydantic-core, thinc and others, so a miss means compiling all of them from source. - setup-uv's Python cache misses too. A restored venv whose interpreter is missing gets deleted and rebuilt, which is the same failure #36 fixed for exact hits. ## Fix - `restore-keys: python-<ver>-venv-` on the venv cache. A lockfile change now restores the latest venv for that Python version, `task install` applies only the changed packages, and the result is saved under the new key. - `uv python install <ver>` runs before `task install`, so the restored venv always has its interpreter. ## Validation - actionlint and zizmor are clean. - This PR doesn't change `uv.lock`, so its run is an exact cache hit. The fallback path gets its real test when #37, which does change the lockfile, is updated from `main` after this merges. Its 3.15 job should drop from about 14 minutes to roughly 1. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.








Problem
The
.venvcache added in #35 breaks CI on any PR whoseuv.lockalready has a cache entry (#31 is failing because of it):python-versiononly selects the interpreter. The actual Python download happens duringuv sync, intouv-python-dir, and that directory wasn't cached..venvwas restored but its interpreter wasn't.uv runloggedIgnoring existing virtual environment linked to non-existent Python interpreter, deleted the venv, and recreated it with only the default groups, dropping theredactionextra.mypyfailed with 11import-not-founderrors for presidio.Fix
cache-python: trueon setup-uv: the uv-managed interpreter is cached and restored, so the restored.venvlinks to a Python that exists..venvand.mypy_cacheare still cached, keyed per Python version anduv.lock, as upstream did. The~/.local/.cache/uvpath is dropped because it isn't the uv cache directory under setup-uv, which caches wheels itself.task installalways runs. On a valid restored venv it's a no-op of about a second. If a restore is ever partial, it repairs the venv, so CI never runs silently without theredactionextra.uv buildand all action versions.Validation
🤖 Generated with Claude Code