This directory contains a utility for early testing of Arcade in web browsers.
An http server is provided with the server.py file. This file can be run with python server.py and will serve a local HTTP server on port 8000.
The index page will provide a list of all Arcade examples. This is generated dynamically on the fly when the page is loaded, and will show all examples in the arcade.examples package. This generates links which can be followed to open any example in the browser.
You can now test your own local scripts without restarting the server!
- Navigate to
http://localhost:8000/localin your browser - Place your Python scripts in the
local_scripts/directory - Scripts should have a
main()function as the entry point - The page will automatically list all
.pyfiles in that directory - Click any script to run it in the browser
- Edit your scripts and refresh the browser page to see changes - no server restart needed!
See local_scripts/README.md and local_scripts/example_test.py for more details and examples.
You will need to have uv installed to build the Arcade wheel. You can install it with:
When you start the server, it will automatically build an Arcade wheel and copy it into this directory. This means that if you make any changes to Arcade code, you will need to restart the server to build a new wheel with your changes.
The web server itself is built with a nice little HTTP server library named Bottle. We need to run an HTTP server locally to load anything into WASM in the browser, as it will not work if we just serve files directly due to browser security constraints. For the Arcade examples specifically, we are taking advantage of the fact that the example code is packaged directly inside of Arcade to enable executing them in the browser.
If we need to add extra code that is not part of the Arcade package, that will require extension of this server to handle packaging it properly for loading into WASM, and then serving that package.