Join Transform 2021 for the most important themes in enterprise AI & Data. Learn more.

In a step toward its goal of building out a data science development stack for web browsers, Mozilla today detailed Pyodide, an experimental Python project that’s designed to perform computation without the need for a remote kernel (i.e., a program that runs and inspects code).

As staff data engineer Mike Droettboom explained in a blog post, it’s a standard Python interpreter that runs entirely in the browser. And while Pyodide isn’t exactly novel — projects like Transcrypt, Brython, Skulpt, and PyPyJs are among several efforts to bring Python to browsers — it doesn’t require a rewrite of popular scientific computing tools (like NumPy, Pandas, Scipy, and Matplotlib) to achieve adequate performance, and its ability to convert built-in data types enables interactions among browser APIs and other JavaScript libraries.

“[Pyodide uses] wrappers around a variable in the other language [called proxies],” Droettboom wrote. “[The] proxy holds on to the original JavaScript variable and calls methods on it ‘on demand.’  This means that any JavaScript variable, no matter how custom, is fully accessible from Python … [and it’s] this tight level of integration that allows a user to do their data processing in Python, and then send it to JavaScript for visualization.”


Pyodide is built on WebAssembly, a low-level programming language that runs with near-native performance, and emscripten (specifically a build of Python for emscripten dubbed “cpython-emscripten”), which comprises a compiler from C and C++ to WebAssembly and a compatibility layer. Emscripten additionally provides a virtual file system (written in JavaScript) that the Python interpreter can use, in which files disappear when the browser tab is closed.

Pyodide is impressive, but Droettboom stresses that it’s a work in progress. For instance, features like threading aren’t currently supported (but might be in the future with WebAssembly threads), while others like low-level networking sockets won’t likely ever work because of browsers’ security sandboxes. As for performance, the Python interpreter inside the JavaScript virtual machine runs between one to 12 times slower in Firefox and up to 16 times slower on Chrome — a speed usable for interactive exploration, but a good deal slower than native code.

To use Pyodide, you’ll need the compiled Python interpreter as WebAssembly, JavaScript from emscripten (which provides the system emulation), and a packaged file system containing the files required by the Python interpreter. Once all three components are downloaded, they’ll be stored in your browser’s cache, obviating the need to download them again.

Droettboom says that in the future, Pyodide will be able to load most packages directly from Python’s main community repository, PyPI, which will give it access to around 59,000 packages in total.

Pyodide’s debut comes on the heels of Mozilla’s Iodide, an “experimental tool” meant to help scientists and engineers write and share interactive documents using an iterative workflow. It’s currently in alpha and available from GitHub in open source.


VentureBeat's mission is to be a digital town square for technical decision-makers to gain knowledge about transformative technology and transact. Our site delivers essential information on data technologies and strategies to guide you as you lead your organizations. We invite you to become a member of our community, to access:
  • up-to-date information on the subjects of interest to you
  • our newsletters
  • gated thought-leader content and discounted access to our prized events, such as Transform
  • networking features, and more
Become a member