Skip to content

Invalidate Python import caches after pip install#232

Open
jkurashcvx wants to merge 1 commit intomasterfrom
pycache_invalidation
Open

Invalidate Python import caches after pip install#232
jkurashcvx wants to merge 1 commit intomasterfrom
pycache_invalidation

Conversation

@jkurashcvx
Copy link
Copy Markdown

Add importlib.invalidate_caches() before pyimport checks in both the devitopro and devito-only install paths. This ensures the already-running Python interpreter sees newly pip-installed packages on disk.

This is safe: it only clears the in-process directory listing cache used by Python's import machinery. It does not affect already-loaded modules, filesystem caches, or .pyc files. The only effect is a negligible one-time cost to re-scan directories on the next import.

Add importlib.invalidate_caches() before pyimport checks in both the
devitopro and devito-only install paths. This ensures the already-running
Python interpreter sees newly pip-installed packages on disk.

This is safe: it only clears the in-process directory listing cache used
by Python's import machinery. It does not affect already-loaded modules,
filesystem caches, or .pyc files. The only effect is a negligible one-time
cost to re-scan directories on the next import.
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