Pyodide: Python for the Browser

# · 🔥 173 · 💬 81 · 2 years ago · lwn.net · lukastyrychtr · 📷
Python in the browser has long been an item on the wish list of many in the Python community. The Pyodide project provides a way to run Python in the browser by compiling the existing CPython interpreter to WebAssembly and running that binary within the browser's JavaScript environment. Most of the basic types can be relatively easily mapped between the languages, but Python treats the object and dict types as distinct, while JavaScript conflates them to a certain extent: all objects can be treated as dicts. Given the focus on large data sets in the kinds of processing often done by NumPy and the like, there is a need to provide an efficient multi-dimensional array type that can largely be shared between JavaScript and Python. Support for Python asyncio has been added, so that Python coroutines can run in the browser event loop; a JavaScript Promise can be awaited in Python and vice versa with Python awaitables. While laptops, desktops, and servers support Python just fine, many people are only using phones and tablets where Python is not really present. If Python wants to stay relevant, it needs a reasonable browser story; Pyodide may be part of the right path toward that end.
Pyodide: Python for the Browser



Send Feedback | WebAssembly Version (beta)