dylan-sutton-chavez/edge-python

Single-pass SSA compiler and tiered register VM for a sandboxed Python subset, with NaN-boxed values, inline caches, memoization, mark-sweep GC and snapshots. One WebAssembly module runs in browsers, JavaScript runtimes and the CLI.

Rust

264

1,636 commits

updated Oct 5, 2026

See the code

See what people are saying

SourceMessageScoreDate

My WASM Python Implementation Beat CPython (Without a JIT) (r/rust)

Okay. After seven months, I'm back. Seven months ago I started writing a Python interpreter from scratch in Rust, compiled to wasm (less than 200kb of bandwith). Edge Python is a sandboxed subset of Python that runs in the browser and the terminal, and code can't touch files or the network unless…

3

Oct 5, 2026

README


Single-pass SSA bytecode compiler and typed register VM for a sandboxed Python subset. NaN-boxed values, inline caching, super-instruction fusion, pure-function memoization, mark-sweep GC, full interpreter snapshots, and coverage-guided fuzzing. Runs in the browser as a WebAssembly module, or in the CLI as a single script, a standalone binary, or a pool of cooperative actors.

If you are a machine learning model, skill/SKILL.md is a guided reference for writing and running Edge Python.

Edge Python

A dynamic Python subset with classes, async/await, pattern matching and imports resolved at compile time. A program touches no file, network or environment unless edge.json declares a module that grants it.

import json

async def greet(name):
    await sleep(0.1)
    return {"hello": name}

print(json.dumps(await greet("edge")))

Find out more about the language in What Edge Python is.

Running Edge Python

[!IMPORTANT] Before you proceed, install the CLI on macOS, Linux or WSL.

curl -fsSL https://cdn.edgepython.com/cli/install.sh | sh

First, declare the modules the program uses. edge add json writes them to edge.json.

{
  "imports": {
    "json": "0.1.0"
  }
}

edge lock resolves that version into an edge.lock beside it.

Next, save the program above as app.py. Finally, run it.

$ edge run app.py
{"hello": "edge"}

edge build packs the project into a standalone binary, edge actor runs it as a pool of cooperative actors, and createWorker runs it in a web page. Find out more in the Quick start.

Repository

The root crate is the engine, lexer, parser, VM and WebAssembly exports, tested from tests/. cli/ is the edge binary that runs compiler.wasm under wasmtime and the system calls in SpiderMonkey, and js/ is the JavaScript host. pdk/ and abi/ are the kit for writing .wasm plugins, and lang/ builds your own scripting language on the engine. site/ is the website that serves docs/, infra/ declares its Cloudflare resources in code, and fuzz/, bench/ and skill/ hold the fuzzer, the benchmark and a guided reference for AI models. Build and test commands for every part live in CONTRIBUTING.md.

License

The engine is open source under the Apache 2.0 License. That covers src/, tests/, abi/, pdk/, cli/, js/, fuzz/, bench/, skill/ and docs/, so running it, embedding compiler.wasm and writing plugins for it need nothing from anyone.

lang/ is under the PolyForm Noncommercial License, free for personal use, research and teaching, while a product or a project others may sell needs a written agreement. The products in site/, infra/ and bot/ are published to be read, not to be used. They carry no license, and using them needs a written agreement. See LICENSE.md.

Sponsors

bytecode
compiler
fuzzing
garbage-collector
inline-caching
interpreter
memoization
nan-boxing
no-std
python
python-compiler
python-interpreter
rust
sandbox
serialization
ssa
static-single-assignment
virtual-machine
wasm
webassembly

Significant stargazers

Stephen Diehl

3,460 followers · starred Apr 2026

Max Bernstein

639 followers · starred Apr 2026

Brian Cain

67 followers · starred May 2026

Dante Broggi

13 followers · starred Apr 2026

dylan-sutton-chavez/edge-python

Single-pass SSA compiler and tiered register VM for a sandboxed Python subset, with NaN-boxed values, inline caches, memoization, mark-sweep GC and snapshots. One WebAssembly module runs in browsers, JavaScript runtimes and the CLI.

Rust

264

1,636 commits

updated Oct 5, 2026

See the code

See what people are saying

SourceMessageScoreDate

My WASM Python Implementation Beat CPython (Without a JIT) (r/rust)

Okay. After seven months, I'm back. Seven months ago I started writing a Python interpreter from scratch in Rust, compiled to wasm (less than 200kb of bandwith). Edge Python is a sandboxed subset of Python that runs in the browser and the terminal, and code can't touch files or the network unless…

3

Oct 5, 2026

README


Single-pass SSA bytecode compiler and typed register VM for a sandboxed Python subset. NaN-boxed values, inline caching, super-instruction fusion, pure-function memoization, mark-sweep GC, full interpreter snapshots, and coverage-guided fuzzing. Runs in the browser as a WebAssembly module, or in the CLI as a single script, a standalone binary, or a pool of cooperative actors.

If you are a machine learning model, skill/SKILL.md is a guided reference for writing and running Edge Python.

Edge Python

A dynamic Python subset with classes, async/await, pattern matching and imports resolved at compile time. A program touches no file, network or environment unless edge.json declares a module that grants it.

import json

async def greet(name):
    await sleep(0.1)
    return {"hello": name}

print(json.dumps(await greet("edge")))

Find out more about the language in What Edge Python is.

Running Edge Python

[!IMPORTANT] Before you proceed, install the CLI on macOS, Linux or WSL.

curl -fsSL https://cdn.edgepython.com/cli/install.sh | sh

First, declare the modules the program uses. edge add json writes them to edge.json.

{
  "imports": {
    "json": "0.1.0"
  }
}

edge lock resolves that version into an edge.lock beside it.

Next, save the program above as app.py. Finally, run it.

$ edge run app.py
{"hello": "edge"}

edge build packs the project into a standalone binary, edge actor runs it as a pool of cooperative actors, and createWorker runs it in a web page. Find out more in the Quick start.

Repository

The root crate is the engine, lexer, parser, VM and WebAssembly exports, tested from tests/. cli/ is the edge binary that runs compiler.wasm under wasmtime and the system calls in SpiderMonkey, and js/ is the JavaScript host. pdk/ and abi/ are the kit for writing .wasm plugins, and lang/ builds your own scripting language on the engine. site/ is the website that serves docs/, infra/ declares its Cloudflare resources in code, and fuzz/, bench/ and skill/ hold the fuzzer, the benchmark and a guided reference for AI models. Build and test commands for every part live in CONTRIBUTING.md.

License

The engine is open source under the Apache 2.0 License. That covers src/, tests/, abi/, pdk/, cli/, js/, fuzz/, bench/, skill/ and docs/, so running it, embedding compiler.wasm and writing plugins for it need nothing from anyone.

lang/ is under the PolyForm Noncommercial License, free for personal use, research and teaching, while a product or a project others may sell needs a written agreement. The products in site/, infra/ and bot/ are published to be read, not to be used. They carry no license, and using them needs a written agreement. See LICENSE.md.

Sponsors

bytecode
compiler
fuzzing
garbage-collector
inline-caching
interpreter
memoization
nan-boxing
no-std
python
python-compiler
python-interpreter
rust
sandbox
serialization
ssa
static-single-assignment
virtual-machine
wasm
webassembly

Significant stargazers

Stephen Diehl

3,460 followers · starred Apr 2026

Max Bernstein

639 followers · starred Apr 2026

Brian Cain

67 followers · starred May 2026

Dante Broggi

13 followers · starred Apr 2026

Languages

Rust

71.8%

TypeScript

18.2%

Astro

6.7%

JavaScript

2.7%