What is Pyodide?

Updated

Pyodide is a Python distribution for the browser and Node.js based on WebAssembly. It is a port of CPython to WebAssembly/Emscripten, which means you can run Python — and install many Python packages — directly in a web page or a Node.js process without a separate Python server. This page explains what it can do, what it supports, and how to decide whether it fits your project.

What Pyodide actually is

Pyodide is not a reimplementation of Python. It is CPython itself, compiled to WebAssembly and run through Emscripten. That distinction matters: your code runs on the real CPython runtime, so language behavior, the standard library, and error semantics stay close to what you already expect.

It ships in two main environments:

  • Browsers — Python runs inside the page, and when used in a browser it has full access to the Web APIs.
  • Node.js — the same distribution runs server-side or in tooling.

What you can install and run

Package support is the part most people care about, and Pyodide's model is straightforward:

  • Pure Python packages: any pure Python package with a wheel available on PyPI is supported, installed through micropip.
  • Packages with native extensions: many packages with C, C++, and Rust extensions have been ported for use with Pyodide.

The ported set includes general-purpose libraries such as regex, PyYAML, and cryptography, plus scientific Python packages including NumPy, pandas, SciPy, Matplotlib, and scikit-learn.

The practical rule: if a package is pure Python with a wheel, expect it to work. If it has a compiled extension, check whether it has been ported before assuming it will load.

Mixing JavaScript and Python

Pyodide provides a robust JavaScript ⟺ Python foreign function interface, so you can freely mix the two languages in your code with minimal friction. The interface covers more than simple value passing:

  • Error handling — throw an error in one language and catch it in the other.
  • async/await — asynchronous work crosses the boundary rather than being trapped on one side.
  • Web API access — Python running in a browser can reach the browser's own APIs.

This is what makes Pyodide useful beyond "run a script in a tab": you can keep your UI in JavaScript and your data or scientific logic in Python, and let them call each other.

Choosing how to use it

The right entry point depends on what you are doing:

Your situation Where to start
You want to use a hosted distribution of Pyodide Getting started documentation
You want to host Pyodide yourself Download from the releases page and serve it with a web server
You want to use Pyodide with a bundler Working with Bundlers documentation
You maintain a Python package pyodide-build documentation
You want to add a package to the distribution pyodide-build documentation
You want to experiment with or contribute to the runtime Building from source documentation

If you just want to see it work, there is a REPL you can try directly in your browser with no installation needed.

When Pyodide is the right fit

Pyodide fits well when you need Python logic to run where the user already is — in the browser or in a Node.js process — and you want to avoid a round trip to a Python backend. It is a strong match for scientific and data work in the browser, given the ported NumPy/pandas/SciPy/Matplotlib/scikit-learn stack, and for interactive teaching or demos where installation would be a barrier.

It is a weaker fit when your dependencies rely on native extensions that have not been ported, or when your workload is heavy enough that downloading a WebAssembly runtime and packages to the client is the wrong trade-off. In those cases, a conventional Python server remains the simpler choice.

To go further, start with the Getting started documentation if you are consuming Pyodide, or the pyodide-build documentation if you are packaging for it.