Diggy Newsletter #4

Howdy! Hope you are staying safe and sane during these times.

It took me longer to write this update, and here’s why. For the last weeks, I’ve been working like a beaver on async functionality for a WASM kernel, and I’ll be frank with you. It’s hard. I feel that I’ve almost reached the point when I’m hitting a nasty wall and need to take a little step back. While it feels great to drive an experimental project on cutting-edge technologies and run Python reactively in the browser without relying on server-side code; in reality, it’s a rabbit’s hole.

Emscripten (a compiler toolkit to WebAssembly) already supports asyncify, allowing one to yield results to the Javascript event loop and handle events. It works like described in most cases, but I do want to make Python notebooks reactive, which means that whenever a variable changes, it essentially becomes an asynchronous call. I’m not taking a shortcut by using a custom syntax, it must be vanilla Python. This is where things get tricky. I’m not giving up yet and also exploring other options.

Anyway, I recently released a few enhancements to the Diggy:

Also, I’d like to give a shout out to Nicky van Foreest who is working on Queueing Theory and Simulation course and recommended Diggy as one of the tools that could help students run Python to work on exercises. Check it out, I think it’s cool: https://github.com/ndvanforeest/queueing_book

What’s next? I’m exploring Firecracker micro VMs to initialize Python kernels. I really like it so far, and I’m getting promising results. Firecracker VMs have a tiny footprint and can be initialized in less than a second. It is comparable to what it takes right now to initialize a WASM kernel in the browser.

What is a Firecracker? Simply put, it’s a lightweight VM, which is how AWS runs Lambda, function-as-a-service platform. Firecracker is optimized for a) speed and b) security. Firecracker VM implements the minimal number of concepts required to run a Linux instance.

While this may sound boring, er, yet another platform that runs containers under the hood, I see this as a much bigger and exciting opportunity to help people learn Python in a browser, and keep it as close as possible to something they can run locally. I expect that other languages could be supported much easier in Firecracker than in WASM. One can run a native binary in a micro VM instead of churning through cross-compilation to a web assembly, which also opens a few doors to other experiments.

Cheers. Stay safe and healthy and all that!

Kirill