WeSearch

Running Python ASGI apps in the browser via Pyodide + a service worker

Simon Willison· ·1 min read · 0 reactions · 0 comments · 13 views
#python#webassembly#datasette
⚡ TL;DR · AI summary

Datasette Lite is a browser-based version of Datasette that utilizes Pyodide in WebAssembly. The new implementation uses Service Workers to run Python ASGI apps, overcoming limitations of the previous method that did not execute JavaScript in <script> tags. The author plans to upgrade Datasette Lite after further understanding the new approach.

Key facts
Original article
Simon Willison · Simon Willison
Read full at Simon Willison →
Opening excerpt (first ~120 words) tap to expand

Datasette Lite is my version of Datasette that runs entirely in the browser using Pyodide in WebAssembly. When I first built it four years ago I used Web Workers and code that intercepts navigation operations and fetches the generated HTML by running the Python app. This worked, but had the disadvantage that any JavaScript in <script> tags would not be executed - breaking some Datasette functionality and a whole lot of Datasette plugins. This morning I set Claude Opus 4.8 the task (in Claude Code for web) of figuring out how to run Python ASGI apps in Pyodide using Service Workers instead, and it seems to work! Here's a basic ASGI FastCGI demo and here's a demo that runs Datasette 1.0a31.

Excerpt limited to ~120 words for fair-use compliance. The full article is at Simon Willison.

Anonymous · no account needed
Share 𝕏 Facebook Reddit LinkedIn Threads WhatsApp Bluesky Mastodon Email

Discussion

0 comments

More from Simon Willison