Running the full server-side Datasette Python app in the browser with service workers and Pyodide
Python web apps can now run fully in-browser as shareable, URL-configured demo and bug-reproduction environments, removing the need to host servers.
Simon Willison has rebuilt Datasette Lite, a version of his data-browsing tool Datasette that runs entirely inside a web browser instead of on a server. A web technology called service workers, which intercept web requests, plus WebAssembly-based Python (Pyodide), makes it behave almost identically to the real server version. Users can load any SQLite database, CSV, or JSON file, pick plugins and one of over 100 SQLite versions, all via a single link. Anyone sharing data demos or reproducing software bugs benefits, since no server setup is needed.
Willison shipped a service-worker-based rewrite of Datasette Lite that runs the full Python app in the browser, usable now at lite.datasette.io for zero-cost demo and bug-reproduction links. The pattern is not Datasette-specific: any Python app could work, opening a cheap way to deliver preview environments without hosting infrastructure. Caveats: it needs CORS-enabled file hosting, and PostgreSQL or MySQL in WebAssembly remain immature. Teams maintaining Python products face rising user expectations for linkable, browser-run demos.
The rewrite replaces the original Pyodide web worker plus innerHTML hack (which broke script tags and JS/CSS loading) with a service worker on lite.datasette.io that intercepts requests; a parent page opens an iframe whose requests carry a /app/<session>/ prefix. Session IDs route each tab to a dedicated web worker instance because service workers cannot hold Pyodide state beyond roughly 30 seconds. URL parameters support ?install=, ?url=, ?ref=, ?sqlite= and ?metadata=. 163 pysqlite3 WebAssembly wheels were compiled for versions back to SQLite 3.25.