If you want to work on the core Python library that displays the live coding results, you can still do that in a GitHub codespace without installing any of your own development tools. It just takes a few minutes to start, and takes more storage space than the browser tutorial environment on GitHub's codespaces.
-
Go to the GitHub project page, and click the big green Code button.
-
In the pop up, click on the Codespaces tab.
-
In the top right of the Codespaces tab, next to the plus sign, click on the three dots, and click "New with options...".
-
Click on the dev container configurations, and choose
live-py-plugin-full. -
Click on the machine types, and choose one with at least 64GB of storage. Currently, that's the 8-core machine.
-
Click the "Create codespace" button, and wait for it to finish setting up your codespace. Then wait for it to finish up running the
postCreateCommandto install more development tools. -
When the installation is finished, click in the terminal window at the bottom, and launch the web server.
cd html ./serve.sh -
That should take a few seconds to generate the web pages, and then launch a web server on port 4000.
-
You should see a pop up that asks if you want to open port 4000 in your browser. Click the "Open in Browser" button, and you should see a copy of the current web site.
-
Switch back to the GitHub codespace tab, navigate to the
plugin/PySrc/space_tracerfolder, and make some changes to the Python source code. You can also change the unit tests undertest/PySrc/tests. -
Stop the web server by clicking in the terminal and typing Ctrl+C. Then run the tests by running
toxin the project's top directory.cd .. toxNot all versions of Python are installed by default, so you can run the tests in Python 3.12 with
tox -e py312. You can install a missing Python version with this:sudo apt update sudo apt install python3.9For some versions of Python, you might have to register the dead snakes package repository.
-
Once the tests pass, you can deploy the new Python code on your local copy of the web site.
cd html npm run build ./serve.sh -
Go back to the browser tab with the web site, and refresh the page. You should see your changes.
If you don't want to work in a dev container, you can set up all the tools to build the website on your workstation.
The first time you build, you'll need to install docker, then clone the Pyodide and Pyodide Recipes projects from GitHub.
-
Clone Pyodide into the folder where you keep your git repositories.
cd ~/git git clone --recursive https://github.com/pyodide/pyodide cd pyodide git tag # Lists all tags. Choose a recent one to checkout. git checkout tags/0.XX.0 git submodule update -
Also clone Pyodide Recipes into the pyodide folder.
git clone https://github.com/pyodide/pyodide-recipes cd pyodide-recipes git tag git checkout tags/0.XX-YYYYMMDD cd .. -
Make a patch to the pyodide project. Remove
turtle.pyfromPYZIP_EXCLUDE_FILESinMakefile.envs. -
Run the build. Setting
RUSTUP_HOMEandCARGO_HOMEmight not be needed.sudo ./run_docker RUSTUP_HOME=/usr CARGO_HOME=/usr PYODIDE_PACKAGES=tag:core make pyodide build-recipes "matplotlib,space-tracer" --recipe-dir pyodide-recipes/packages --install -
Once pyodide has been built, you can rebuild the packages like this:
sudo ./run_docker --non-interactive "pip install ./pyodide-build && pyodide build-recipes "matplotlib,space-tracer" --recipe-dir pyodide-recipes/packages --install"
After that, follow these steps for each release.
- Update the version number in
html/meta.yamland in thesrcFileslist inhtml/deploy.js. - Find the
Makefile.envsfile in the pyodide project, and removeturtle.pyfrom the list. - Run
npm run build. You should see a message that it rebuilt space tracer in pyodide.