Get started
Welcome
Edge Python is sandboxed Python, compiled to bytecode and run by a register VM written in Rust. One WebAssembly engine of about 250 KB runs it in browsers, in JavaScript runtimes and in the edge CLI.
The defaults deny everything. A program reaches no files, no network and no environment unless its host grants them. Imports resolve at compile time from edge.json, and a running program never loads code you did not declare.
Try it
This program asks the GitHub API about the Edge Python repository and prints three of its fields. It runs on the real engine in your browser. Edit it and run it again.
dylan-sutton-chavez/edge-python Rust main
Its edge.json declares the json package and grants the network for api.github.com alone. Any other host raises PermissionError. Every runnable example in these docs runs the same way.
Questions
Is it full Python?
A program that compiles behaves as it does in CPython, apart from the choices below. What Edge Python leaves out is missing for the sandbox, like the standard library and exec, or for the design of the engine, like id, hash and metaclasses. It fails with an error instead, at compile time whenever the compiler can see it. Limits and errors lists those errors and Design explains the memory model behind them.
Where does it behave differently on purpose?
In three places. Ints stop at 2^127. Sets iterate in hash order. Every NaN is one value.
Is there a standard library?
No bundled one. Every module is an external package that edge.json declares. Modules explains how imports resolve.
Can a program run code it builds at run time?
No. exec, eval, compile and __import__ do not exist. The set of modules is fixed when the program compiles.
Can a program reach the network or the disk?
Only what the root edge.json grants. Each grant names a module and a scope, such as one host for net or one folder for fs. System lists every scope.
Where does it run?
The JavaScript host runs it in browsers and in runtimes with the same Web APIs, such as Deno. The edge CLI runs the same engine on macOS, Linux and WSL. Rust shows how to drive compiler.wasm from Rust code.
Is there a summary for machine learning models?
Yes. A model can load skill/SKILL.md for a self-verifying summary of the language and the CLI.
Where do I ask for help?
Email c.sutton.dylan@gmail.com with questions or for help with an integration.