Socket
Book a DemoInstallSign in
Socket

pyodide

Package Overview
Dependencies
Maintainers
3
Versions
66
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pyodide

The Pyodide JavaScript package

0.28.2
next
latest
Source
npmnpm
Version published
Weekly downloads
252K
-8.83%
Maintainers
3
Weekly downloads
 
Created
Source

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:

  • 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
  • Loads the CPython interpreter and the core/pyodide emscripten application which embeds the interpreter.
  • 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.

Keywords

python

FAQs

Package last updated on 19 Aug 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.