Upstream CPython 3.13
Vanilla CPython compiled with zig cc to wasm32-wasi. No Pyodide-specific patches; semantics match what python3.13 does on a normal machine. See bundled modules.
This is a personal experiment in running upstream CPython 3.13 on Cloudflare Workers via zig cc → wasm32-wasi. Cloudflare’s official Python Workers ship Pyodide and are the supported path; PyMode is not a replacement for them.
Upstream CPython 3.13
Vanilla CPython compiled with zig cc to wasm32-wasi. No Pyodide-specific patches; semantics match what python3.13 does on a normal machine. See bundled modules.
AOT host imports
pymode deploy patches host import sites (KV, R2, D1, fetch) into direct JS stubs in the wasm. Skips the JsProxy/PyProxy translation Pyodide pays per call.
Compile any C extension
Pyodide ships a curated set of compiled wheels (numpy, pandas, Pillow…). PyMode lets you build arbitrary C extensions via zig cc to wasm32-wasi when you need a package Pyodide doesn’t carry.
Wizer snapshot at deploy
The build pre-imports stdlib + your project’s modules into a memory snapshot baked into the wasm. Worker Startup Time on CF (the cost of bringing an isolate up) is typically 40–60 ms.
Request → Worker (stateless) → PythonDO (Durable Object) ↓ python.wasm (_start) ↓ on_fetch(request, env) ↓ KV / R2 / D1 / TCP ↓ Response → ClientEach request gets its own sandboxed Python runtime inside a Durable Object. The WASM stack is instrumented with Asyncify so host imports (HTTP fetch, KV reads, TCP recv) suspend and resume transparently.
HTTP Fetch
fetch("https://api.example.com") calls the host directly — no network stack in WASM.
Parallel Execution
spawn() launches child Durable Objects with separate 30s CPU budgets and 128MB memory.
Package Ecosystem
Pure-Python packages work out of the box. C/Rust extensions (numpy, pydantic_core) compile to WASM variants. AI frameworks (langchain, langgraph, instructor) tested and working.
Multi-File Projects
Standard Python imports work. Organize your project with packages, modules, and pyproject.toml.