Skip to content

Latest commit

 

History

History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

Edge Python Host

Official JS modules for Edge Python exposing host APIs (DOM, network, storage and more) to Python scripts. Each capability is a plain ESM registered with createWorker via mainThreadModules, no .wasm, no Rust, no custom embedder.

Layout

├── dom
│   └── src
│       ├── index.js
│       └── main
├── network
│   └── src
│       ├── index.js
│       └── main
├── storage
│   └── src
│       ├── index.js
│       └── main
├── time
│   └── src
│       ├── index.js
│       └── main
└── tests

One folder per capability. Each ships a <name>/<name>.json corpus; the shared runner in tests/ walks for them and drives every case through headless Chromium.

Usage

<script type="module">
    import { createWorker } from "https://cdn.edgepython.com/runtime/src/index.js";
    import { dom } from "./dom/src/index.js";

    const worker = await createWorker({
        wasmUrl: "https://cdn.edgepython.com/compiler.wasm",
        mainThreadModules: { dom },
    });
    await worker.run(await (await fetch("./script.py")).text());
</script>

Packages

Folder Description
dom Browser DOM access, see dom/README.md
network HTTP fetch, WebSocket, SEE, see network/README.md
storage localStorage, sessionStorage, IndexedDB, see storage/README.md
time Clocks, sleep, calendar formatting, see time/README.md

Development

Requires Deno v2 and Playwright's Chromium.

# Lint one capability
cd host/<capability> && deno lint src/

# Install Chromium (once)
deno run -A npm:playwright install --with-deps chromium

# Test one capability (from host/)
cd host && HOSTCAP=<capability> deno test --allow-all tests/

<capability> is one of dom, network, storage, time.

License

MIT OR Apache-2.0