README.md

beautifulsoup4-4.12.3-py3-none-any.whl

certifi-2024.12.14-py3-none-any.whl

charset_normalizer-3.3.2-py3-none-any.whl

console.html

contourpy-1.3.0-cp312-cp312-pyodide_2024_0_wasm32.whl

cycler-0.12.1-py3-none-any.whl

ffi.d.ts

fonttools-4.51.0-py3-none-any.whl

idna-3.7-py3-none-any.whl

joblib-1.4.0-py3-none-any.whl

kiwisolver-1.4.5-cp312-cp312-pyodide_2024_0_wasm32.whl

matplotlib-3.8.4-cp312-cp312-pyodide_2024_0_wasm32.whl

matplotlib_pyodide-0.2.3-py3-none-any.whl

micropip-0.8.0-py3-none-any.whl

mpmath-1.3.0-py3-none-any.whl

numpy-2.0.2-cp312-cp312-pyodide_2024_0_wasm32.whl

openblas-0.3.26.zip

package.json

packaging-24.2-py3-none-any.whl

pandas-2.2.3-cp312-cp312-pyodide_2024_0_wasm32.whl

pillow-10.2.0-cp312-cp312-pyodide_2024_0_wasm32.whl

pyodide-lock.json

pyodide.asm.js

pyodide.asm.wasm

pyodide.d.ts

pyodide.js

pyodide.js.map

pyodide.mjs

pyodide.mjs.map

pyparsing-3.1.2-py3-none-any.whl

python_dateutil-2.9.0.post0-py2.py3-none-any.whl

python_stdlib.zip

pytz-2024.1-py2.py3-none-any.whl

regex-2024.9.11-cp312-cp312-pyodide_2024_0_wasm32.whl

requests-2.31.0-py3-none-any.whl

scikit_learn-1.6.1-cp312-cp312-pyodide_2024_0_wasm32.whl

scipy-1.14.1-cp312-cp312-pyodide_2024_0_wasm32.whl

six-1.16.0-py2.py3-none-any.whl

soupsieve-2.5-py3-none-any.whl

sympy-1.13.3-py3-none-any.whl

threadpoolctl-3.5.0-py3-none-any.whl

tiktoken-0.8.0-cp312-cp312-pyodide_2024_0_wasm32.whl

urllib3-2.2.3-py3-none-any.whl

Pyodide JavaScript package

npm

Usage

Download and extract Pyodide packages from Github releases (pyodide-build-*.tar.bz2). The version of the release needs to match exactly the version of this package.

Then you can load Pyodide in Node.js as follows,

// hello_python.js
const { loadPyodide } = require("pyodide");

async function hello_python() {
  let pyodide = await loadPyodide({
    indexURL: "<pyodide artifacts folder>",
  });
  return pyodide.runPythonAsync("1+1");
}

hello_python().then((result) => {
  console.log("Python says that 1+1 =", result);
});
$ node hello_python.js
Python says that 1+1= 2

Or you can use the REPL. To start the Node.js REPL with support for top level await, use node --experimental-repl-await:

$ node --experimental-repl-await
Welcome to Node.js v18.5.0.
Type ".help" for more information.
> const { loadPyodide } = require("pyodide");
undefined
> let pyodide = await loadPyodide();
undefined
> await pyodide.runPythonAsync("1+1");
2

Details

The JavaScript code in this package is responsible for the following tasks:

  1. Defines the public JavaScript API
    • Package loading code to allow loading of other Python packages.
    • Can load micropip to bootstrap loading of pure Python wheels
  2. Loads the CPython interpreter and the core/pyodide emscripten application which embeds the interpreter.
  3. Injects the js/pyodide JavaScript API into sys.modules. This is the final runtime dependency for core/pyodide & py/pyodide, so after this step the interpreter is fully up and running.