simonw/micropython-wasm — reverse-engineered prompt

Reverse engineered prompt

GitHub

Build me a small experimental Python package that lets someone run MicroPython code safely inside a WebAssembly sandbox from normal Python.

I want the simple case to feel like run("print(1 + 1)") and return an object with stdout, stderr, and fuel remaining. Each normal run should start fresh, with no saved variables. Also add a session object for people who want variables, imports, functions, and classes to stick around between runs, plus a replay style session that rebuilds state from earlier successful snippets instead of keeping a live VM.

Please bundle or expect a MicroPython WASI wasm artifact, run it through Wasmtime, and keep it sandboxed. No network access. No host files unless the caller explicitly opens a directory as read only input. Add controls for memory, fuel, timeout, and max host callback result size. Let Python functions be registered so MicroPython can call back into the host through a small JSON bridge.

Include clear docs, examples, packaging, and tests for the main behavior. Look up current docs online if needed.

Want more depth? Deep Reverse