datasette-lite icon indicating copy to clipboard operation
datasette-lite copied to clipboard

Turn this into an offline enabled PWA

Open simonw opened this issue 2 years ago • 8 comments

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

simonw avatar May 04 '22 17:05 simonw

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

simonw avatar Aug 01 '22 15:08 simonw

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.

simonw avatar Aug 01 '22 17:08 simonw

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?

psychemedia avatar Aug 15 '22 11:08 psychemedia

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.

simonw avatar Aug 15 '22 18:08 simonw

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...

psychemedia avatar Aug 15 '22 20:08 psychemedia

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.

simonw avatar Aug 15 '22 22:08 simonw

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

westurner avatar Nov 29 '22 07:11 westurner

"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

westurner avatar Nov 29 '22 07:11 westurner