mirror of
https://github.com/pyscript/pyscript.git
synced 2025-12-19 18:27:29 -05:00
* patched an issue with wasmoon randomly asking to resolve proxy references * simplified pyodide and micropython dance by grouping their common utilities together * created an integration test around a worker to main thread input between MicroPython and Lua * commented some weird bugs / funny behaviors around both MicroPython and Pyodide * other minor clean ups
39 lines
1013 B
JavaScript
39 lines
1013 B
JavaScript
import { fetchPaths, stdio } from "./_utils.js";
|
|
import {
|
|
run,
|
|
runAsync,
|
|
runEvent,
|
|
runWorker,
|
|
runWorkerAsync,
|
|
writeFile,
|
|
} from "./_python.js";
|
|
|
|
const type = "pyodide";
|
|
|
|
// REQUIRES INTEGRATION TEST
|
|
/* c8 ignore start */
|
|
export default {
|
|
type: [type, "py"],
|
|
module: (version = "0.22.1") =>
|
|
`https://cdn.jsdelivr.net/pyodide/v${version}/full/pyodide.mjs`,
|
|
async engine({ loadPyodide }, config) {
|
|
const { stderr, stdout, get } = stdio();
|
|
const runtime = await get(loadPyodide({ stderr, stdout }));
|
|
if (config.fetch) await fetchPaths(this, runtime, config.fetch);
|
|
if (config.packages) {
|
|
await runtime.loadPackage("micropip");
|
|
const micropip = await runtime.pyimport("micropip");
|
|
await micropip.install(config.packages);
|
|
micropip.destroy();
|
|
}
|
|
return runtime;
|
|
},
|
|
run,
|
|
runAsync,
|
|
runEvent,
|
|
runWorker,
|
|
runWorkerAsync,
|
|
writeFile,
|
|
};
|
|
/* c8 ignore stop */
|