Running the full server-side Datasette Python app in the browser with service workers and Pyodide
Datasette Lite is a port of the Datasette Python application, now running directly in the browser using WebAssembly and Pyodide. A recent rewrite of Datasette Lite utilizes service workers, making it nearly equivalent to the server-side application. Users can access Datasette Lite at lite.datasette.io, where they can load specific Datasette references, plugins, and SQLite versions through a URL. This feature enables sharing demos of work-in-progress features or bug reproductions without the need for a separate web server.
Following the link to lite.datasette.io, users are greeted with a page that displays the Datasette application running with the datasette-maplibre plugin. This plugin enables the loading of an SQLite database from a specified URL and the display of GeoJSON shapes as maps and table data. The URL arguments serve various purposes: &install=datasette-maplibre installs the plugin, &url=https://.../demo.db loads the SQLite database, &metadata=https://.../metadata.yml adds HTML descriptions to tables and the Datasette homepage, and #/demo/capitals_and_countries%23map=0/4.2/180&color=continent navigates to a specific location within Datasette.
This technique for building URL-addressable software with Pyodide Python environments was previously discussed in a blog post from last year. Datasette Lite has been utilized in the Datasette development process, and examples showcasing its functionality, such as a pagination bug fix, are available. The rewrite of Datasette Lite, which was initially launched as a joke in 2022, now employs a service worker-based approach for improved functionality and reliability.
Written by urgent.news from Simon Willison's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.
This story
This is one outlet's version. Read the fullest account.