The Python scientific stack, compiled to WebAssembly.
While closely related to the iodide project, Pyodide may be used standalone in any context where you want to run Python inside a web browser.
Downloading pre-built versions
Pre-built versions of Pyodide are available here.
Building is easiest on Linux. For other platforms, we recommend using the Docker image (described below) to build Pyodide.
Make sure the prerequisites for emsdk are installed. Pyodide will build a custom, patched version of emsdk, so there is no need to build it yourself prior.
Additional build prerequisites are:
- A working native compiler toolchain, enough to build CPython.
- A native Python 3.7 to run the build scripts.
- lessc to compile less to css.
- ccache (optional) recommended for much faster rebuilds.
We provide a Debian-based Docker image on Docker Hub with the dependencies already installed to make it easier to build Pyodide.
From a git checkout of Pyodide, run
make deterministically stops at one point in each subsequent try, increasing
the maximum RAM usage available to the docker container might help [This is different
from the physical RAM capacity inside the system]. Ideally, at least 3 GB of RAM
should be available to the docker container to build
pyodide smoothly. These settings can
be changed via Docker Preferences [See here].
You can edit the files in your source checkout on your host machine, and then
make inside the Docker environment to test your changes.
Install the following dependencies into the default Python installation:
pip install pytest selenium pytest-instafail
The port 8000 of the docker environment and the host system are automatically
./run_docker is run.
This can be used to test the
pyodide builds running within the docker
environment using external browser programs on the host system.
To do this, simply run
This serves the
build directory of the
pyodide project on port 8000.
- To serve a different directory, use the
--build_dirargument followed by the path of the directory
- To serve on a different port, use the
--portargument followed by the desired port number
Make sure that the port passed in
--port argument is same as the one
DOCKER_PORT in the
Once the webserver is running, for simple interactive testing, visit the URL http://localhost:8000/console.html
Install the same dependencies as for testing.
Python is linted with