Browser Playground
Edit this pageBrowser REPL guide for the wasm playground and debug route.
The browser playground lives at /playground.
It auto-loads the website’s wasm-vm-probe bundle, pre-registers a curated stdlib subset
from /wasm/stdlib_subset_v1.json, and provides a minimal REPL-focused interface. Runtime
execution is handled in a dedicated Web Worker so command execution does not run on the page UI thread.
Quick Start
Open and run
# 1) Build browser wasm assets (repo root)
./scripts/build_wasm_website_bundle.sh
# 2) Start website dev server
pnpm --dir website dev
# 3) Open /playground, wait for runtime loaded, and run input What The Playground Loads
| Component | Behavior |
|---|---|
| Wasm runtime | The website bundle is built with wasm-vm-probe, so runtime execution is enabled in the worker. |
| Stdlib content | A curated virtual stdlib subset is registered before the REPL session starts; full CPython stdlib is not shipped in-browser. |
| Unsupported surfaces | Snippets that need missing modules or unsupported runtime capabilities return explicit stderr/blocker output. |
Available Modules
| Surface | Current scope | Notes |
|---|---|---|
| Available modules | 83 public modules | Merged from the curated website pack at
|
| Blocked modules | 7 public modules | These are rejected by the browser capability policy instead of partially working. |
Available modules (83 public modules)
__future__, abc, annotationlib, argparse, array, ast, asyncio, atexit, binascii
bisect, codecs, collections, collections.abc, contextlib, contextvars, copy, copyreg
dataclasses, datetime, decimal, difflib, dis, encodings, encodings.aliases, enum, errno
faulthandler, fractions, functools, gc, gettext, heapq, importlib, importlib.machinery
inspect, io, ipaddress, itertools, json, json.decoder, json.encoder, json.scanner, keyword
linecache, locale, marshal, math, mmap, numbers, opcode, operator, os, os.path, pathlib
platform, posix, pprint, pwd, pyexpat, random, re, reprlib, resource, select, signal, ssl
statistics, string, sysconfig, textwrap, threading, time, token, tokenize, types, typing
unicodedata, urllib, urllib.parse, uuid, warnings, weakref, zlib | Blocked public modules | Blocker key | Why blocked in browser mode |
|---|---|---|
ctypes | dynamic_library_load | Dynamic library loading is not available in the wasm host. |
numpy, scipy | dynamic_library_load | Standard distributions depend on native extension binaries. |
socket | network_sockets | Raw socket capability is unavailable in browser mode. |
subprocess, multiprocessing | process_spawn | Browser mode does not expose process creation or subprocess spawning. |
readline | interactive_terminal | The browser playground does not provide a TTY-style interactive terminal surface. |
Runtime Status Signals
| State | Meaning | What to do |
|---|---|---|
loading | The wasm bundle is still being initialized. | Wait for ready state before running snippets. |
ready | Runtime loaded, worker ready, and the curated stdlib subset has been registered. | Run snippets normally. |
error | The runtime failed to initialize. | Check browser console and confirm wasm assets are published. |
Output Shape
| Output class | Description |
|---|---|
| Input transcript | Every submitted command is echoed with >>> / … prompts. |
| stdout | Normal execution output from the wasm runtime. |
| stderr | Runtime errors, compile/syntax failures, missing-module messages, or unsupported capability messages. |
Debug Route
For low-level diagnostics and worker/state contract probing, use the unlisted
/debug route.