Pyodide is one of the hidden gems of the Python ecosystem. It's SO good at what it does, and it's nearly 8 years old now so it's pretty mature.<p>I love using Pyodide to build web UIs for trying out new Python libraries. Here's one I built a few weeks ago to exercise my pure-Python SQLite AST parser, for example: <a href="https://tools.simonwillison.net/sqlite-ast" rel="nofollow">https://tools.simonwillison.net/sqlite-ast</a><p>It's also pretty easy[1] to get C or Rust libraries that have Python bindings compiled to a WebAssembly wheel that Pyodide can then load.<p>Here's a bit of a nutty example - the new Monty Python-like sandbox library (written in Rust) compiled to WASM and then loaded in Pyodide in the browser: <a href="https://simonw.github.io/research/monty-wasm-pyodide/pyodide-demo.html" rel="nofollow">https://simonw.github.io/research/monty-wasm-pyodide/pyodide...</a><p>[1] OK, Claude Code knows how to do it.
There's also xeus-cpp which is cpp based on wasm. Xeus-cpp and pyodide are the backends for Jupyterlite [1] kernels in browser.<p>It's actually a very good way to teach coding in python/c++(11, 17 or even 23), or explore language features or your own library within browser and allow students to execute code by hosting just some static html pages and some assets without any backend.<p>1. <a href="https://jupyter.org/try-jupyter/lab/" rel="nofollow">https://jupyter.org/try-jupyter/lab/</a>
It works surprisingly well in terms of writing python for native execution, and then trying to share on the web and having it Just Work TM. Unfortunately, when I want python it's because I want numpy, scipy and friends, and once you bring them on board pyodide load times are long. As an example comparison: a face turning octahedron puzzle in python + pyodide, loads in 10 seconds <a href="https://cubes.hgreer.com/fto.html" rel="nofollow">https://cubes.hgreer.com/fto.html</a> . Meanwhile, a megaminx puzzle in javascript (statically generated by python) loads in 200 ms <a href="https://cubes.hgreer.com/ssg/output.html" rel="nofollow">https://cubes.hgreer.com/ssg/output.html</a>
Anyone using it with nodejs to make a sandbox for code agents?
I've done some experiments along those lines with Pyodide in Deno: <a href="https://til.simonwillison.net/deno/pyodide-sandbox" rel="nofollow">https://til.simonwillison.net/deno/pyodide-sandbox</a>
ChatGPT's Canvas uses Pyodide for sandboxing, but it's not designed for coding agents. Node.js environment is usually better for agents. Pyodide restricts server-side functionality, and fetching external URLs often needs proxying due to sandbox. By the way, pyodide is still good option for interactive visualizer or deploying small webapps require data processing.
For that purpose I think most people are using bubblewrap or seatbelt/sandbox-exec with CPython.
no but it works great in conjunction with observable and d3js for pretty interactives!
[dead]