Source time Edition date
Running the full server-side Datasette Python app in the browser with service workers and Pyodide
用服务工作线程和 Pyodide 在浏览器中运行完整的服务端 Datasette Python 应用
Simon Willison gets Datasette running fully client-side via service workers and Pyodide, but users must accept slow first loads because a full Python runtime lands in the browser.
Judgment
Developers filing Datasette bug reports or plugin demos should link a lite.datasette.io URL instead of standing up a server, though they trade a slow first load and CORS-hosted database files for a version-pinned, /app/<session>/ reproduction.
Basis
Simon Willison says the rewrite is "almost indistinguishable from the real server-side application," and that loading pinned references, plugins and SQLite versions makes it a strong way to link demos or bug reproductions "without needing to spin up a full web server." The mechanism: a service worker registered for the whole lite.datasette.io domain intercepts page and asset requests; the parent page makes a random session ID and prefixes every hidden load with /app/<session>/, so the worker can route each tab's requests back to a web worker running its own Dedasette instance. That prefix exists because one shared worker would otherwise collapse every tab into a single instance regardless of ?install= plugins. A web worker is still required because, per Willison, Pyodide in a service worker "would not be able to maintain state beyond around 30 seconds, depending on the browser." The first 2022 version was "a hack": Datasette ran in a Pyodide web worker and HTML was injected via innerHTML, so any JavaScript feature broke. URLs take ?install= (repeatable), &url= for an SQLite file with open CORS headers (he uses Gists), &metadata=, and a fragment hash. He already uses it in Datasette's own issue tracker: a pagination bug demo at ?ref=1.0a42 shows an empty second page, and ?ref=1.0a43 shows the fix. The system began as a May AI research spike on Claude Opus 4.8 and shipped in November after Claude Fable 5.2.
- Browser tab (iframe)page request
- Service workerroute by session
- Web worker: Pyodideboots Datasette
- Datasette instance
Unclear The source never quantifies the "short loading screen," nor says what several concurrent Pyodide instances cost in memory per tab.
Next Open the ?ref=1.0a42 and ?ref=1.0a43 scores links in two separate tabs and confirm each resolves to its own /app/<session>/ instance.