Edge Python ships no bundled stdlib (see What it is), every module is external. This page is the catalog of the official, ready-to-use packages maintained alongside the compiler. You don’t have to write these yourself, import them and go. To build your own, see Writing modules. There are two families, matching two of the three delivery paths:Documentation Index
Fetch the complete documentation index at: https://edgepython.com/llms.txt
Use this file to discover all available pages before exploring further.
Standard packages are host-agnostic (they run wherever WASM runs). Host libraries are browser-only, they reach
document / window / localStorage, surfaces that don’t exist in a non-browser host.
Standard packages
Language-agnostic.wasm plugins over the WASM module ABI. Import by bare name (the browser runtime resolves the official ones by default, see Defaults), by URL, or via a packages.json alias; the host fetches the .wasm and treats its exports as native bindings.
json
JSON serialization and deserialization, full CPython json.loads / json.dumps kwargs parity (object_hook, parse_float, indent, sort_keys, ensure_ascii, default, and more).
.wasm is served from https://std.edgepython.com/json.wasm. Full API: std/json/README.md.
jsonis an external package, but the browser runtime resolves it by default. It isn’t compiled intocompiler_lib.wasm, it’s this.wasmpackage. In the browser runtime you can writefrom json import ...with nopackages.json(a built-in default, fetched lazily on first import). Other hosts, ordefaults: false, need it declared (alias or URL) like any other module.
re
Regular expressions, a CPython re subset on a compact backtracking engine. Unicode aware \d \w \s and (?i) without shipping Unicode tables, plus capture groups, backreferences, lookahead, and fixed width lookbehind. A step budget raises RuntimeError on catastrophic backtracking instead of hanging, so a degrading pattern is reported rather than freezing the worker.
match, search, fullmatch, findall, groups, span, sub; flags go inline ((?i), (?s), (?m)). Pre-built .wasm is served from https://std.edgepython.com/re.wasm. Full API: std/re/README.md.
math
CPython-style math, scalar transcendentals on libm (no platform libc) with CPython domain errors (sqrt(-1) raises ValueError: math domain error). Module constants pi, e, tau, inf, nan; integer helpers factorial, gcd, lcm, isqrt, comb, perm; tuple returns modf, frexp; variadic hypot and gcd. A packed-f64 batch path (sqrt_all, fsum_all, and friends) processes a whole bytes buffer in one host crossing for bulk work.
i128, so factorial, comb, perm, and lcm raise ValueError past that range, and there is no complex / cmath. Pre-built .wasm is served from https://std.edgepython.com/math.wasm. Full API: std/math/README.md.
Host libraries
Plain-JS capabilities that run on the browser’s main thread, registered declaratively via thehost field of packages.json (with the <edge-python> element), programmatically via createWorker({ hostModules }), or resolved by default with no config at all (see Defaults). No .wasm, no Rust, no build step. Each call defers to the main thread over postMessage (around 0.1 to 0.4 ms); Python sees a synchronous call. The ESM loads lazily, the first time a run imports it.
dom
Full browser DOM surface: queries, mutation, events, forms, files, observers, animations, layout, media, SVG, dialog, fullscreen, pointer lock.
query, query_all, create_element, append_child, set_text, set_html, set_attribute, add_class, set_style, rect, bind_event, form_data, validity, get_files, file_read_text, observe_intersection, animate, media_play, show_modal. Full API: host/dom/README.md.
network
HTTP fetch, WebSocket, and Server-Sent Events. HTTP calls suspend the coroutine and compose with gather / with_timeout; WS/SSE stream events through receive().
fetch, fetch_text, fetch_json, abort_request, ws_open, ws_send, ws_close, ws_state, sse_open, sse_close, sse_state. Full API: host/network/README.md.
storage
Persistent client-side storage: localStorage, sessionStorage, IndexedDB. KV handlers are synchronous; IndexedDB handlers suspend like network’s fetch.
local_get/set/remove/clear/keys, session_* (same surface), idb_open, idb_put, idb_get, idb_delete, idb_keys, idb_close. Full API: host/storage/README.md.
time
Wall and monotonic clocks, sleep, and calendar formatting, a sandbox-friendly subset of CPython’s time. Clock reads are synchronous; sleep suspends the coroutine like network’s fetch, composing with gather / with_timeout. A struct_time crosses as a JSON nine-tuple string, decode it with json to read fields.
time, time_ns, monotonic, monotonic_ns, perf_counter, perf_counter_ns, sleep, gmtime, localtime, mktime, strftime, strptime, asctime, ctime, timezone, altzone, daylight, tzname. CPU, thread, and POSIX clocks (process_time, clock_gettime, tzset, the CLOCK_* constants) are intentionally out of scope. Full API: host/time/README.md.
How to load them
| You have… | Do |
|---|---|
| Any official package, browser runtime | Just from <name> import ..., the runtime resolves the official std/host packages by default. Declare it only to pin a different version, or opt out with defaults: false |
A standard .wasm package (e.g., json) | Quoted URL from "https://.../json.wasm" import ..., or a packages.json imports alias |
A host library (e.g., dom, network, storage), <edge-python> element | Add it to the host field of packages.json |
A host library, programmatic createWorker | Pass its URL in hostModules (lazy) or an in-memory factory in mainThreadModules (eager) |
imports for worker-side .py / .wasm modules, host for main-thread libraries. See Imports for resolution semantics and the full packages.json schema, and the runtime README for <edge-python> attributes and createWorker options.
Defaults
The browser runtime ships a built-in base manifest, so the official packages resolve by bare name with nopackages.json at all: the std .wasm packages (json, re, math) and the host libraries (dom, network, storage, time). Three rules:
- Lazy. A default is fetched only when a run actually imports it. Unused defaults never hit the network.
- Overridable. Your
packages.json(orimports/hostModules) wins for the same name, so you can pin a specific version or URL. - Opt-out. Pass
defaults: falsetocreateWorkerto disable the base manifest entirely (e.g. offline or non-browser embedders).
compiler_lib.wasm stays hermetic and resolves bare names only through the manifest the host provides. Non-browser hosts decide their own defaults, if any.
See also
- Imports, import syntax,
packages.json, integrity verification. - Writing modules, build your own package (the three delivery paths).
- WASM module ABI, the contract standard
.wasmpackages implement.