fix: disable packages cache when local wheels are detected#184
Open
Archmonger wants to merge 1 commit into
Open
fix: disable packages cache when local wheels are detected#184Archmonger wants to merge 1 commit into
Archmonger wants to merge 1 commit into
Conversation
When local .whl files are specified in the packages list, their dependencies fail to resolve on subsequent page loads because micropip.freeze() stores stale references in IndexedDB. This change automatically sets packages_cache to "never" when local wheels are detected (paths starting with ./, ../, /, emfs://, file://, or URLs ending in .whl). Users can still opt into caching with packages_cache = "all".
Archmonger
marked this pull request as ready for review
July 20, 2026 01:15
Open
3 tasks
Contributor
|
I think we should freeze the VFS into IndexedDB instead of using micropip because this problem has been coming up so many times already ... but this seems sensible, will have a look but I am on vacation right now, not sure if I'll manage before the 27th 'cause it needs a release via PyScript. |
| // or URLs ending in .whl. When local wheels are present, disable IndexedDB | ||
| // caching unless the user explicitly sets packages_cache = "all". | ||
| // See https://github.com/pyscript/pyscript/issues/2282 | ||
| if (packages && packages.some(pkg => /^(?:\.{1,2}\/|\/|emfs:\/\/|file:\/\/)/.test(pkg) || /\.whl(?:\?|$)/.test(pkg))) { |
Contributor
There was a problem hiding this comment.
/^(?:\.{1,2}\/|\/|(?:emfs|file):\/\/)/.test(pkg)
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.
Description
Fixes pyscript/pyscript#2282
When local .whl files are specified in the
packageslist, their dependencies fail to resolve on subsequent page loads becausemicropip.freeze()stores stale absolute or virtual filesystem references in IndexedDB. On the next page load, the frozen lockfile is restored instead of runningmicropip.install(), causingModuleNotFoundErrorfor the wheel's dependencies.Somewhat of a band-aid, based on the following response:
Solution
This change automatically sets
packages_cacheto'never'when local wheels are detected in the packages array. Local wheels are identified by:./,../,/,emfs://,file://.whlUsers can still explicitly opt into caching with
packages_cache = "all".Related
"packages"to a localwheelcauses dependency resolution failure pyscript#2282