Skip to content

Commit

Permalink
Install micropip by default. Fixes #17
Browse files Browse the repository at this point in the history
  • Loading branch information
rameshvarun committed Sep 8, 2023
1 parent 9635a38 commit 119dadf
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/python-kernel/worker.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
importScripts("https://cdn.jsdelivr.net/npm/pyodide@0.23.4/pyodide.min.js");
importScripts("https://cdn.jsdelivr.net/pyodide/v0.23.4/full/pyodide.js");
declare var loadPyodide;

let onStdout: ((str) => void) | null = null;

// Start loading Pyodide asynchronously.
const loadPython = (async () => {
return await loadPyodide({
let pyodide = await loadPyodide({
stdout: (msg) => {
if (msg === "Python initialization complete") return;
if (onStdout) onStdout(msg);
},
});

// Install micropip by default. Users can install
// additional packages using `micropip.install()`.
await pyodide.loadPackage("micropip");

return pyodide;
})();

self.onmessage = async (e: MessageEvent) => {
Expand Down

0 comments on commit 119dadf

Please sign in to comment.