Python Worker Message Handler Executes Python code blocks using Pyodide (WebAssembly Python).
Workflow:
- Receives execution context (code, dependencies, settings).
- Initializes Pyodide and auto-loads required packages.
- Resolves data dependencies from IndexedDB.
- Converts JavaScript data to Python-compatible formats (Lists, Dicts, NumPy arrays).
- Binds data to the Python global scope as
data. - Wraps and executes the user's Python code, capturing stdout/stderr.
- Converts the Python result back to JavaScript.
- Stores the result in IndexedDB and sends completion status.
- Source: