Standalone in-browser Python playground: multi-file editor, tiny Linux-like shell, Pyodide in a Web Worker.
No LTI launch. No grading. Work is saved only in localStorage in this browser.
See DESIGN.md for architecture and goals.
Serve this directory over HTTP (Web Workers and ES modules-adjacent fetches require a real origin; file:// will not work reliably).
Examples:
# from this directory
python3 -m http.server 8765
# open http://localhost:8765/Or place the folder under your course / Tsugi mod/ tree and open its URL.
- Open the page — no login required.
- Edit
main.pyor create more files (+ / rename / delete). - Press Run, or type
python main.pyin the shell. - When
input()runs, answer in the shell (the$prompt becomes the Python prompt). - Use
ls,rm,help, etc. - Reload the page; the workspace restores from localStorage.
| Command | Purpose |
|---|---|
help |
List commands |
ls |
List files |
rm <file...> |
Delete file(s) (cannot remove the last file) |
upload |
Open a file picker to upload into the workspace |
download <file> |
Download a file to your computer |
pwd / cd |
Working directory (flat workspace root) |
python <file.py> |
Run a file |
echo / clear |
Niceties |
Pipes, redirects, globs, and a Python REPL are not supported.
- Workspace key:
pythonshell-workspace-v1(seewindow.PYTHONSHELL.storageKey). - Clearing site data, using another browser, or private mode can lose work.
- Reset workspace clears localStorage for this tool and restores defaults:
main.py,about.txt,romeo.txt, andmbox-short.txt(fromstatic/files/).
- Put a long TTL on
/static/*(Cloudflare or similar). - Leave
index.htmllightly cached or bypassed so clients see updatedworkerUrl?v=Nvalues. - After editing
static/worker/, run./scripts/bump-worker-cache.sh.
- Pyodide 0.27.5 (CDN on first load; then browser-cached).
- Always runs in a Web Worker; infinite loops time out and the worker is replaced.
- Ace editor (vendored under
static/js/vendor/ace/).
PythonShell forks slimmed runtime ideas from PythonGrader. It does not share code at runtime and does not grade assignments. Use PythonGrader for scored exercises.