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

AI-generated summary of reporting by Simon Willison’s Weblog. Read the original for the full story.

Why it matters

Running Python web apps like Datasette entirely in-browser now avoids broken JavaScript, opening the door to more fully client-side Python tools.

Read this as

Simon Willison runs Python web applications directly inside a web browser using Pyodide, a way of executing Python code within WebAssembly. His older approach used Web Workers, which broke JavaScript embedded in generated pages, including Datasette plugins. A new method using service workers, browser scripts that intercept network requests, fixes that. Live demos exist online, and Datasette Lite will be upgraded later.

Willison delegated the engineering to Claude Opus 4.8 in Claude Code for web, and it produced a working service-worker approach for running ASGI Python apps in Pyodide. This is research code on GitHub with public demos, not a product; the practical payoff arrives when Datasette Lite itself is upgraded. Competition angle: Anthropic coding agents are now shipping working infrastructure experiments, not just answering questions.

Datasette Lite (circa May 2022) used Web Workers plus navigation interception to fetch HTML generated by the Python ASGI app, but script tags in responses never executed, breaking plugins. The new approach routes the ASGI app through a service worker instead, demonstrated with FastCGI-style demos and Datasette 1.0a31 on GitHub Pages. Willison says he is still working out the mechanics before upgrading Datasette Lite.

Read the original

This summary exists to save you time, not to replace the source.

Key terms

Datasette Lite Pyodide Claude Opus 4.8 Claude Code Datasette 1.0a31

Was this summary useful?

One click, anonymous. It tells us which summaries to re-run.

Related reading