Skip to content

Commit d020cb6

Browse files
committed
Fix #137 - Allow the passthrough option for the cache
1 parent 0276e9a commit d020cb6

File tree

12 files changed

+263
-183
lines changed

12 files changed

+263
-183
lines changed

docs/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/toml-BK2RWy-G.js

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/toml-BK2RWy-G.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/zip-BKVoQflw.js

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/zip-BKVoQflw.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

esm/interpreter/pyodide.js

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -86,22 +86,30 @@ export default {
8686
if (!save) storage.clear();
8787
// otherwise check if cache is known
8888
else if (packages) {
89-
packages = packages.sort();
90-
// packages are uniquely stored as JSON key
91-
const key = stringify(packages);
92-
if (storage.has(key)) {
93-
const blob = new Blob(
94-
[storage.get(key)],
95-
{ type: 'application/json' },
96-
);
97-
// this should be used to bootstrap loadPyodide
98-
options.lockFileURL = URL.createObjectURL(blob);
99-
// versions are not currently understood by pyodide when
100-
// a lockFileURL is used instead of micropip.install(packages)
101-
// https://github.com/pyodide/pyodide/issues/5135#issuecomment-2441038644
102-
// https://github.com/pyscript/pyscript/issues/2245
103-
options.packages = packages.map(name => name.split(/[>=<]=/)[0]);
89+
// packages_cache = 'passthrough' means: do not use micropip.install
90+
if (config.packages_cache === 'passthrough') {
91+
options.packages = packages;
10492
packages = null;
93+
storage.clear();
94+
}
95+
else {
96+
packages = packages.sort();
97+
// packages are uniquely stored as JSON key
98+
const key = stringify(packages);
99+
if (storage.has(key)) {
100+
const blob = new Blob(
101+
[storage.get(key)],
102+
{ type: 'application/json' },
103+
);
104+
// this should be used to bootstrap loadPyodide
105+
options.lockFileURL = URL.createObjectURL(blob);
106+
// versions are not currently understood by pyodide when
107+
// a lockFileURL is used instead of micropip.install(packages)
108+
// https://github.com/pyodide/pyodide/issues/5135#issuecomment-2441038644
109+
// https://github.com/pyscript/pyscript/issues/2245
110+
options.packages = packages.map(name => name.split(/[>=<]=/)[0]);
111+
packages = null;
112+
}
105113
}
106114
}
107115
progress('Loaded Storage');

0 commit comments

Comments
 (0)