Skip to content

fix(ci): Exclude .venv from pyc cache cleanup#110585

Merged
mchen-sentry merged 1 commit intomasterfrom
mingchen/di-1708-ci-venv-cache-immediate-deletion-fix
Mar 13, 2026
Merged

fix(ci): Exclude .venv from pyc cache cleanup#110585
mchen-sentry merged 1 commit intomasterfrom
mingchen/di-1708-ci-venv-cache-immediate-deletion-fix

Conversation

@mchen-sentry
Copy link
Member

@mchen-sentry mchen-sentry commented Mar 12, 2026

So in action.yml we have two steps where we first:

  • restore the virtual environment form cache (action-setup-venv)
    and then immediately after
  • clears Python cache, essentially negating the first step

Deleting these forces Python to recompile every installed package on first import during every CI run, undermining the purpose of the venv cache.

We add -not -path './.venv/*' to both find commands so we only clear pycache dirs and not the venv.

The "Clear Python cache" step runs find from the repo root, which
traverses .venv/. The previous step (action-setup-venv) just restored
the venv from cache including compiled bytecode. Deleting .venv/**/*.pyc
forces Python to recompile every installed package on first import,
undermining the venv cache.
@mchen-sentry mchen-sentry requested a review from a team as a code owner March 12, 2026 21:16
@linear-code
Copy link

linear-code bot commented Mar 12, 2026

@mchen-sentry mchen-sentry merged commit 36f4854 into master Mar 13, 2026
79 checks passed
@mchen-sentry mchen-sentry deleted the mingchen/di-1708-ci-venv-cache-immediate-deletion-fix branch March 13, 2026 20:22
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.

2 participants