#wasm

waynerad@diasp.org

Pyodide + JupyterLite. This is pretty impressive -- check out my screenshot.

Pyodide is Python running in your web browser -- more specifically, it is a port of CPython to WebAssembly, using Emscripten, which is a compiler toolchain based on LLVM (the compiler toolchain used by Apple languages and Rust) that compiles to WebAssembly. JupyterLite, in turn, enables Python Jupyter notebooks to run insider your browser. The "notebook" interface was pioneered by Mathematica in 1988 and is based on the the idea of creating a document that contains explanatory text, software code, and visualizations, all in the same document, in such a way that the computer actually runs the code and produces the visualizations. The document is divided into "cells" where each cell is text or code along with output produced by the code, such as a visualization.

As you can see, I imported SymPy (symbolic math system for Python) and asked it to figure out a few integrals. Remember, the ** operator means exponentiation in Python, not ^ like you may be used to.

The thing that really amazes me about this is, this is all running in the browser -- and not "in the browser" in the sense of, connecting to a server and running Python and Jupyter on the server and displaying the results in a browser -- no, once all the code is downloaded, everything you see is running in the browser. Python is running in the browser, SymPy is running in the browser, all the calculations to determine the integrals I asked for are done in the browser, and all the code for the "notebook" display and that generates the nice mathematical notation is running in the browser. Yes, I checked in Chrome developer tools and verified no network requests are being made -- everything really is running in the browser.

Try it yourself.

#solidstatelife #python #jupyter #wasm

https://jupyterlite.github.io/demo/lab/index.html