datasette-lite
datasette-lite copied to clipboard
Turn this into an offline enabled PWA
https://twitter.com/derjan/status/1521896354745921537
Is it a PWA that I can "install" and use offline?
No reason at all it shouldn't be able to do that.
For it to be useful I would need to implement "open file":
- #13
Very relevant example repository: https://github.com/mikeckennedy/pyscript-pwa-example
Here's the Service Worker that caches all of the necessary wheels: https://github.com/mikeckennedy/pyscript-pwa-example/blob/main/static/js/serviceWorker.js
I think step one here is going to be figuring out how to have Datasette Lite load all of its assets from the same domain it is hosted on, rather than pulling things from PyPI.
Could a Github Action handle the pulling of packages into a repo from a requirements file. And then use a template Github repository as a way for people to "install" a blank datasette-lite application to a new repo of their own repository that can then build a datasette-lite distribution from a relatively simple set of config files?
Yes, definitely. I think that's the way I want to go - my ideal for Datasette Lite is that it's entirely self-contained, so you can run it on a server (or on your laptop) without it loading anything at all from external servers.
I need to figure out how to have it load the various Python wheels it needs from a URL that I control first though.
Does piplite
help there? I'm struggling to keep up with all various bits of JupyterLite glue, but I think that tries various fallbacks for where to look for things...
I think I've figured out how to do it: https://pyodide.org/en/stable/usage/loading-packages.html#installing-wheels-from-arbitrary-urls
Pure Python wheels can also be installed from any URL with
micropip
,import micropip micropip.install( 'https://example.com/files/snowballstemmer-2.0.0-py2.py3-none-any.whl' )
Micropip decides whether a file is a URL based on whether it ends in ".whl" or not.
Micropip or Mambalite or picomamba or Zig.
"Better integration with conda/conda-forge for building packages" https://github.com/pyodide/pyodide/issues/795
Emscripten-forge > Adding packages: https://github.com/emscripten-forge/recipes#adding-packages
- https://github.com/emscripten-forge/recipes/tree/main/recipes/recipes_emscripten
- https://github.com/emscripten-forge/recipes/blob/main/recipes/recipes_emscripten/picomamba/recipe.yaml
- https://github.com/mamba-org/picomamba
- https://github.com/emscripten-forge/recipes/blob/main/recipes/recipes_emscripten/picomamba/recipe.yaml
"Progressive Web Apps:Going Offline" https://developers.google.com/codelabs/pwa-training/pwa03--going-offline#0 ( Sep 30, 2022 )
- https://github.com/GoogleChromeLabs/pwa-workshop-codelab