Datasette Lite: a server-side Python web application running in a browser
simonwillison.net
simonwillison.net
Or if you have a SQLite database hosted online somewhere with open CORS headers you can feed it the URL using ?url=... - like this:
https://simonw.github.io/datasette-lite/?url=https%3A%2F%2Fc...
I put together a Pyodide-based web app where users need a few indexed queries from a 600mb SQLite database but it isn't very practical for them to download the whole thing into the browser. I would datasettify it and access it by API, if I wasn't relying on a pyodide library that needs direct SQLite access.
My initial hunch is that this will be really difficult - probably require a fork of something like https://github.com/coleifer/pysqlite3 then compiled for WebAssembly.
I'm confident it's feasible, but I don't have the skills to figure it out myself.
My app (similar to Simon's, a lite mode of a data IDE): https://app.datastation.multiprocess.io.
My code: https://github.com/multiprocessio/datastation/blob/main/shar....
https://pyodide.org/en/stable/usage/webworker.html
Edit: typo
Really impressive app though, great job.
Stop using compile-to-browser junk and be a browser "native" instead.
Simon is in the 99th percentile (PR=0.998, n>25,000+) of GitHub users by followers.
Thanks for such great tools, Simon!
[1]: https://github.com/andrewmcwattersandco/github-statistics
github-users.tzst - 96MB
Uncompressed:
github-users.db - 992MB
Loading...
distutils already loaded from default channel
Loading micropip, pyparsing, packaging
Loaded micropip, pyparsing, packaging
Loading ssl, openssl
Loaded ssl, openssl
distutils already loaded from default channel
pyparsing already loaded from default channel
Loading setuptools
Loaded setuptoolsIt runs everything in a web worker at the moment, not sure if there are optimizations I could make by running more of them in parallel?
It doesn't exactly run a localhost server. It uses a mechanism from Datasette's internals that lets you simulate an HTTP request through the Datasette application and get back the result. Then it sends that result back as a message from the worker to the parent page.
It's using this API here for that: https://docs.datasette.io/en/stable/internals.html#datasette...
It seems like a client-side non-JS server backend would be incredibly useful. Just drop the service worker in and point it at your data source.
I opened an issue about that here: https://github.com/pyodide/pyodide/issues/2432
https://en.wikipedia.org/wiki/Commodore_Datasette
I hadn't heared of datasette.io before. Looks like an interesting product.
Short version: I want people to be able to use my software if they don't have the ability to spin up a Python web server.