Running Python ASGI apps in the browser via Pyodide + a service worker
Simon Willison · Simon Willison · 2026-05-30
Simon Willison uses Claude Opus 4.8 in Claude Code for Web to implement a Service Worker-based approach for running Python ASGI apps inside the browser via Pyodide, fixing a longstanding limitation of his Datasette Lite project where JavaScript in script tags would not execute.
Appears in
Extraction
Topics: pyodidewebassemblyservice-workerspython-in-browserdatasette
Claims
- Replacing Web Workers with Service Workers in a Pyodide-based browser setup enables JavaScript inside script tags to execute correctly, unlike the previous Web Worker approach.
- Claude Opus 4.8 running inside Claude Code for Web successfully solved the Service Worker integration problem without requiring the developer to fully understand the implementation upfront.
- The new Service Worker approach works for both a minimal ASGI demo and a full Datasette 1.0a31 deployment running entirely in the browser.
- Simon Willison plans to migrate Datasette Lite from its original Web Worker implementation to the new Service Worker approach.
Key quotes
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!
had the disadvantage that any JavaScript in <script> tags would not be executed - breaking some Datasette functionality and a whole lot of Datasette plugins.