Cheese with Holes (Emmental) - Developing
Cheese with Holes (Emmental) - Developing
Useful note with basic structure, but still has holes to fill.
Click the cheese icon to learn more

Python Web Workers

Author: guiferviz Created: Last Modified:

This Cheese Byte shows an example of how to run Python inside a MDX note using a Web Worker, so heavy execution does not block the UI or freeze the main thread.

The runner tries to auto-install packages when it detects missing imports (if they are available in the Pyodide index), and then executes the code.

Also, if your script uses waits such as await asyncio.sleep, the worker can yield control and report real-time memory usage (WASM heap) back to the main thread.