A PDF document that contains a working MicroPython (Python 3) interpreter. You type Python code in a fillable form field, press a button, and the output appears in a stack of read-only text fields that behave like a terminal.
The engine is MicroPython compiled to asm.js / plain JavaScript. The JavaScript engine inside a PDF viewer has no WebAssembly (WASM), so the C code is compiled to plain JavaScript using Emscripten.
The compiled engine is stored as a document-level JavaScript object, executed by the viewer when the PDF opens. A second runtime script handles the console and UI interactions. Global Python variables, functions, and state persist across executions within the session.
Output never leaves the document. Standard output and errors from Python are routed to the document's interactive form fields out0 ... out23.
To build from source:
./build.shTo test layout without waiting for compilation:
python3 generate.py --dummy --output out/skeleton.pdfmain.c- C bridge between MicroPython embed engine and Emscripten runtimepre.js- Output buffer capture and shims for PDF sandbox globalsruntime.js- Document-level JavaScript handling UI, button actions, and formattinggenerate.py- Standalone PDF writer without external dependenciesbuild.sh- MicroPython embed generator and Emscripten build pipeline
Works in Chromium-based browsers (Google Chrome, Microsoft Edge, Brave, Arc, Opera) and Adobe Acrobat Reader.