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
postCreateCommand
to 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_tracer
folder, 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
tox
in the project's top directory.cd .. tox
Not all versions of Python are installed by default, so you can run the tests in Python 3.10 with
tox -e py310
. You can install a missing Python version with this:sudo apt update sudo apt install python3.9
For 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 web site on your workstation.
The first time you build, you'll need to clone the Pyodide project from GitHub, and install Docker. After that, follow these steps for each release.
- Update the version number in
html/meta.yaml
and in thesrcFiles
list inhtml/deploy.js
. - Find the
remove_modules.txt
file in the pyodide project, and removeturtle.py
from the list. - Run
npm run build
. You should see a message that it rebuilt space tracer in pyodide.