Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Turn this into an offline enabled PWA #26

Open
simonw opened this issue May 4, 2022 · 8 comments
Open

Turn this into an offline enabled PWA #26

simonw opened this issue May 4, 2022 · 8 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@simonw
Copy link
Owner

simonw commented May 4, 2022

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":

@simonw simonw added enhancement New feature or request help wanted Extra attention is needed labels May 4, 2022
@simonw
Copy link
Owner Author

simonw commented Aug 1, 2022

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
Copy link
Owner Author

simonw commented Aug 1, 2022

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.

@psychemedia
Copy link

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?

@simonw
Copy link
Owner Author

simonw commented Aug 15, 2022

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.

@psychemedia
Copy link

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

@simonw
Copy link
Owner Author

simonw commented Aug 15, 2022

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.

@westurner
Copy link

westurner commented Nov 29, 2022

@westurner
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants