A demo repository for create a Python REPL that runs in the browser.
You can try the Python REPL in your browser at the following URL: https://emscripten-forge.github.io/sample-python-repl
You will need to install micromamba to build the application.
First clone the repository:
git clone https://github.com/emscripten-forge/sample-python-repl
cd sample-python-repl
Then create a new environment that will be used for building the REPL:
# create the environment
micromamba create -n pyjs-build-env -f build-environment.yaml -y
# activate the environment
micromamba activate pyjs-build-env
In the environment, run the build script:
python build.py
This create a new environment that will include the dependencies for running the REPL in the browser (runtime).
The script also copies the relevant files to the build
folder.
You can then start an HTTP server to serve the files in the build
folder:
python -m http.server --directory build
And open the REPL in your browser at http://localhost:8000.