Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News Pyodide Brings Python and Its Scientific Stack to the Browser with WebAssembly

Pyodide Brings Python and Its Scientific Stack to the Browser with WebAssembly

This item in japanese

Mozilla announced that Pyodide, a project aiming at providing a full Python data science stack running entirely in the browser, has become an independent community-driven project. Pyodide leverages the CPython 3.8 interpreter compiled to WebAssembly, and thus allows using Python, NumPy, Pandas, Matplotlib, SciPy, and more in Iodide, an experimental interactive scientific computing environment for the web.

The Pyodide team originally explained the rationale behind Pyodide as follows:

When we started thinking about making the web better for scientists, we focused on ways that we could make working with Javascript better, like compiling existing scientific libraries to WebAssembly and wrapping them in easy-to-use JS APIs. […] Mozilla’s WebAssembly wizards offered a more ambitious idea: if many scientists prefer Python, meet them where they are by compiling the Python science stack to run in WebAssembly.

The Iodide playground showcases a notebook that uses Python and Python packages in a JavaScript environment and vice versa:

Iodide showcase

Pyodide may be used in any context where it is necessary to run Python inside a web browser with full access to the Web APIs. The latest release note states that Pyodide converted the Python 3.8 runtime to WebAssembly, along with the Python scientific stack including NumPy (scientific computing), Pandas (data analysis), Matplotlib (plotting library), SciPy (scientific and technical computing), and scikit-learn (machine learning). 75 packages are available at the time of the release. Pure Python wheels may also be installed from the PyPi Python package manager. Python 0.17 additionally provides transparent conversion of objects between JavaScript and Python.

Iodide was created in 2018 to create in-browser notebooks for scientific exploration and visualization in a similar vein to Jupyter:

Editing a Markdown code chunk in Iodide's Explore View

Iodide is no longer actively maintained. Pyodide can however be used in other interactive client-side notebook environments (e.g., Starboard, Basthon, JupyterLite).

The full release note and announcement are available online and contain plenty of additional illustrations and explanations. Pyodide is now an independent and community-driven open-source project distributed under the Mozilla Public License Version 2.0.

Rate this Article