Huge #python WebAssembly news tucked away in this post: https://www.anaconda.com/blog/pyscript-updates-bytecode-alliance-pyodide-and-micropython

"When you apply MicroPython to Wasm in its default configuration, something new and exciting emerges: With a total size of 303KB, this new runtime loads instantly and starts executing MicroPython logic in less than 100ms."

That means the cost of running Python on a web page is now equivalent to serving up a large hero image!

Anaconda | PyScript Updates: Bytecode Alliance, Pyodide, and…

Earlier this year we unveiled PyScript to enable users to create Python applications in the browser. In order for PyScript to succeed, we at Anaconda must make strategic investments in both the project itself and its core technology dependencies, such as WebAssembly (Wasm) and the fantastic Pyodide…

Anaconda

I built Datasette Lite using Python in WebAssembly through Pyodide, and it worked amazingly well - but does come with a significant loading time because regular cPython compiled to WebAssembly is a big dependency to load https://simonwillison.net/2022/May/4/datasette-lite/

Dropping that down to ~300KB of MicroPython would be a huge performance win

Challenge: Datasette needs sqlite3, which isn't included with MicroPython. I wonder how hard it would be to compile this module to WASM too? https://github.com/spatialdude/usqlite

Datasette Lite: a server-side Python web application running in a browser

Datasette Lite is a new way to run Datasette: entirely in a browser, taking advantage of the incredible Pyodide project which provides Python compiled to WebAssembly plus a whole suite …

@simon I'm definitely not discouraging here, but expect a bit of turbulence with Micropython if you're not doing the most basic things.

My experience is on microcontrollers (ESP32), but there's certainly a "doesn't work this way in cPython" learning curve—or at least there was for me.

Old, unstated #projects entry: https://github.com/scoates/pynel

GitHub - scoates/pynel: Pynel: WS2812B LED Panel controller

Pynel: WS2812B LED Panel controller. Contribute to scoates/pynel development by creating an account on GitHub.

GitHub
@simon (I expect most of these will get smoothed over with time, but here's an example of a Micropython-specific logic branch https://github.com/scoates/pynel/blob/c6997b2cb88f6ab0076e9c6e5431e4c5863193ae/pynel/board/img.py#L9 )
pynel/img.py at c6997b2cb88f6ab0076e9c6e5431e4c5863193ae · scoates/pynel

Pynel: WS2812B LED Panel controller. Contribute to scoates/pynel development by creating an account on GitHub.

GitHub

@sean @simon Not sure if they will: MicroPython aims for small memory footprint primarily. Most of its targets have under 100 K RAM, total.

It also has a tiny dev team (2, at the core who can accept PRs) who are flat out working on contract jobs and perhaps day jobs too. It's a great project, but it might be a difficult culture fit

@simon Have definitely seen people porting SQLite to WASM. It's an exciting, strange new world!
@mogul yeah I use the Python sqlite3 module for https://lite.datasette.io/ and it works flawlessly... but it's a pretty heavy download because you get all of CPython compiled to WASM first. I'd love to do the same trick against a much smaller MicroPython WASM build.
Datasette

@simon sqlite team is working on a wasm port. more info here: https://sqlite.org/wasm/doc/tip/about.md
sqlite3 wasm docs: About the sqlite3 WASM/JS Subproject

@simon It could also be interesting to try RustPython.
Definitely not as lightweight as MicroPython, but maybe smaller than CPython?
https://github.com/RustPython/RustPython
GitHub - RustPython/RustPython: A Python Interpreter written in Rust

A Python Interpreter written in Rust. Contribute to RustPython/RustPython development by creating an account on GitHub.

GitHub

@simon Many many years ago (when I worked with building site with Zope) I once discussed with a college about Python running in the browser with a <script> tag.

We of course didn't get it working, but we did embed python on a page and run via RPC - that idea was quickly shut down.

@simon A game-changer in the medium term.
@simon But what if I want my website under 14 kB in size? https://endtimes.dev/why-your-website-should-be-under-14kb-in-size/
Why your website should be under 14kB in size | endtimes.dev

@simon wait holy shit what
@simon Simon I cannot wait to show you (it's on my list of "big goals" 😆) the very cool WASM + glitch work we've been doing (with an eye toward python 👀)
@simon Simon I cannot wait to show you (it's on my list of "big goals" 😆) the very cool WASM + glitch work we've been doing (with an eye toward python 👀)
@keith I am SO interested in anything involving WASM and Python! Long time massive Glitch fan too (and I'm excited about Fastly's WASM stuff)
@simon that’s awesome. i will have to remember this exists if i ever get into python again
@simon I think this video has more details from Damien: https://youtu.be/re4gN46FR90