{"slug": "running-python-asgi-apps-in-the-browser-via-pyodide-a-service-worker", "title": "Running Python ASGI apps in the browser via Pyodide + a service worker", "summary": "Simon Willison successfully ran Python ASGI applications in a web browser using Pyodide and Service Workers, overcoming a four-year limitation in his Datasette Lite project where JavaScript in `<script>` tags would not execute. The new approach, developed with Claude Opus 4.8, enables full Datasette functionality and plugin support in the browser environment. Willison plans to upgrade Datasette Lite to use this Service Worker-based method once he fully understands the implementation.", "body_md": "**Research:** [Running Python ASGI apps in the browser via Pyodide + a service worker](https://github.com/simonw/research/tree/main/pyodide-asgi-browser#readme)\n\n[Datasette Lite](https://lite.datasette.io/) is my version of Datasette that runs entirely in the browser using Pyodide in WebAssembly.\n\nWhen I first built it [four years ago](https://simonwillison.net/2022/May/4/datasette-lite/) I used Web Workers and code that intercepts navigation operations and fetches the generated HTML by running the Python app.\n\nThis worked, but had the disadvantage that any JavaScript in `<script>`\n\ntags would not be executed - breaking some Datasette functionality and a whole lot of Datasette plugins.\n\nThis morning I [set Claude Opus 4.8 the task](https://github.com/simonw/research/pull/112) (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](https://simonw.github.io/research/pyodide-asgi-browser/) and here's [a demo that runs Datasette 1.0a31](https://simonw.github.io/research/pyodide-asgi-browser/datasette.html).\n\nI'm still getting my head around exactly how it works, but once I've done that I plan to upgrade Datasette Lite itself.\n\nTags: [javascript](https://simonwillison.net/tags/javascript), [python](https://simonwillison.net/tags/python), [datasette](https://simonwillison.net/tags/datasette), [asgi](https://simonwillison.net/tags/asgi), [service-workers](https://simonwillison.net/tags/service-workers), [pyodide](https://simonwillison.net/tags/pyodide), [datasette-lite](https://simonwillison.net/tags/datasette-lite), [claude-code](https://simonwillison.net/tags/claude-code)", "url": "https://wpnews.pro/news/running-python-asgi-apps-in-the-browser-via-pyodide-a-service-worker", "canonical_source": "https://simonwillison.net/2026/May/30/pyodide-asgi-browser/#atom-everything", "published_at": "2026-05-30 21:02:16+00:00", "updated_at": "2026-05-30 21:12:00.634063+00:00", "lang": "en", "topics": ["ai-tools", "ai-products"], "entities": ["Pyodide", "Datasette Lite", "Datasette", "Claude Opus 4.8", "Claude Code", "Simon Willison", "WebAssembly", "ASGI"], "alternates": {"html": "https://wpnews.pro/news/running-python-asgi-apps-in-the-browser-via-pyodide-a-service-worker", "markdown": "https://wpnews.pro/news/running-python-asgi-apps-in-the-browser-via-pyodide-a-service-worker.md", "text": "https://wpnews.pro/news/running-python-asgi-apps-in-the-browser-via-pyodide-a-service-worker.txt", "jsonld": "https://wpnews.pro/news/running-python-asgi-apps-in-the-browser-via-pyodide-a-service-worker.jsonld"}}