MCPcopy Index your code
hub / github.com/dylan-sutton-chavez/edge-python

github.com/dylan-sutton-chavez/edge-python @v0.2.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.2.0 ↗ · + Follow
1,510 symbols 6,543 edges 158 files 522 documented · 35%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

  <img width="300" src="https://github.com/dylan-sutton-chavez/edge-python/raw/v0.2.0/docs/public/static/banner.svg" alt="Edge Python Logo">

Single-pass SSA bytecode compiler and threaded-code stack VM for a sandboxed Python subset: NaN-boxed values, inline caching, super-instruction fusion, pure-function memoization, mark-sweep GC. Coverage-guided fuzzing; runs in the browser as a WebAssembly module.

  • Secure by default. No file, network, or environment access, unless explicitly enabled by the host.
  • Around 200 KB footprint. The full compiler and runtime ship as a single WASM binary.
  • Compile-time imports. Every module resolves at parse time, no dynamic loading, no runtime surprises.
  • No AST. Source compiles directly to bytecode in a single pass: O(n).

More about it

Repository layout

Cargo workspace; commands work from any directory.

├── cli
├── compiler
├── docs
├── host
├── runtime
├── std
├── target
├── wasm-abi
└── wasm-pdk
cargo wasm # release .wasm (the distributed artifact)
cargo build --release # host .rlib + cdylib for Rust embedders
cargo test --release --no-default-features # run the compiler test suite

--no-default-features disables the prebuilt feature, which otherwise triggers a build.rs download of compiler.wasm from the GitHub release: that download is only needed by external Rust crates that consume this library, not when developing locally.

Native modules ship via three delivery paths (CDN .wasm, host capability, JS host module), see Writing modules.

Quick start

CLI

download it to your machine (reference docs):

# Compatible with macOS, Linux and WSL
curl -fsSL https://cdn.edgepython.com/cli/install.sh | sh

edge -h # List all commands

edge hosts the runtime in a headless Chromium provisioned by install.sh (apt, dnf, pacman, zypper, apk, or brew on macOS) for serve, repl, build and uninstall.

Browser

<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <script type="module" src="https://cdn.edgepython.com/runtime/src/element.js"></script>
</head>
<body>
  <edge-python entry="./app/main.py" packages="./app/packages.json"></edge-python>
</body>
</html>

The runtime spawns a Web Worker that pre-fetches imports, dispatches native calls, and streams print() output back.

Rust host

Edge Python is a cdylib: a Rust host can instantiate compiler.wasm and call its exports directly, the same .wasm that ships to browsers; the host owns I/O. Declaring edge-python as a Cargo dependency fetches the matching release .wasm automatically, see compiler/README.md.

What it is

Edge Python targets sandboxed in-browser execution: a dynamic, multi-paradigm Python subset with classes, async/await, structural pattern matching, and compile-time module resolution. There is no bundled stdlib, modules are external artifacts.

Full language reference, scope, and what intentionally isn't supported: What Edge Python is. Architecture details: compiler/README.md.

CI/CD

One workflow .github/workflows/main.yml that runs the complete CI/CD, where each package is a steps in a composite action under .github/actions/.

On pushes to main it deploys two Cloudflare Pages projects: edge-python-cdn (the bundled package artifacts) and edge-python-docs (served at edgepython.com).

License

MIT OR Apache-2.0

Sponsors

Extension points exported contracts — how you extend this code

FromValue (Interface)
(no doc) [10 implementers]
wasm-pdk/src/lib.rs
Resolver (Interface)
Host-injected trait; resolve called once per import statement. &mut self allows internal caching. */ [3 implementers]
compiler/src/modules/packages/mod.rs
IntoValue (Interface)
(no doc) [11 implementers]
wasm-pdk/src/lib.rs

Core symbols most depended-on inside this repo

push
called by 797
compiler/src/modules/vm/helpers.rs
len
called by 410
compiler/src/modules/vm/types/mod.rs
get
called by 318
compiler/src/modules/vm/types/mod.rs
iter
called by 245
compiler/src/modules/vm/types/mod.rs
emit
called by 212
compiler/src/modules/parser/types.rs
pop
called by 175
compiler/src/modules/vm/helpers.rs
cold_type
called by 173
compiler/src/modules/vm/types/err.rs
is_heap
called by 165
compiler/src/modules/vm/types/mod.rs

Shape

Function 699
Method 672
Class 96
Enum 40
Interface 3

Languages

Rust87%
TypeScript12%
Python1%

Modules by API surface

compiler/src/modules/vm/types/mod.rs64 symbols
std/math/src/main/float.rs53 symbols
wasm-pdk/src/lib.rs47 symbols
compiler/src/modules/vm/handlers/builtin_methods/string.rs42 symbols
compiler/src/modules/parser/mod.rs37 symbols
compiler/src/modules/parser/types.rs32 symbols
compiler/src/modules/vm/ops.rs31 symbols
compiler/src/modules/vm/cache.rs28 symbols
std/re/src/main/matcher.rs26 symbols
compiler/tests/common.rs26 symbols
compiler/src/modules/vm/handlers/format.rs26 symbols
compiler/src/modules/vm/builtins/sequence.rs26 symbols

For agents

$ claude mcp add edge-python \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page