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

Allow/default to disabling all CDN operations #45

Closed
bollwyvl opened this issue Apr 15, 2021 · 8 comments
Closed

Allow/default to disabling all CDN operations #45

bollwyvl opened this issue Apr 15, 2021 · 8 comments
Labels
performance Gotta go fast
Projects
Milestone

Comments

@bollwyvl
Copy link
Collaborator

Thanks again for getting this going.

As I've hinted at over on #41, a huge benefit of static sites is that they can be, well static. By this I mean: once you get a build working and put someplace, it will work, provided some future browser hasn't disabled a critical API, even if that someplace is a USB stick or DVD in a computer that can't access the internet.

I don't think it's reasonable in the long term to trust any of the major CDNs to necessarily be around in five years, much less bespoke ones like mathjax and pyodide. Further, CDNs are a source of lapses in user privacy and can be abused/disabled to affect harm/censorship by any number of agents.

I would be tempted to give a pass to content-addressable systems (e.g. git, fossil, bittorent, hypercore, ipfs) that can be verifiably cached, locally, and differentiably updated, but for now I think part of being able to fully realize the potential of this system is its ability to generate archival-grade content that can be used without access to The Internet, even if that isn't the default mode of operation.

The Challenges

Right now, this looks like:

  • mathjax:
  • pyodide:
    • sticky indeed!
      • import pandas, matplotlib actually only pulls 32mb of data, which honestly is within the range of "sane," i'd say, to distribute as an sdist... and even a whl, if it doesn't get duplicated.
        • over on ipydrawio, i've done some of the dirty work to get path-perfect things in place with !!file-loader!, so it's definitely doable to make something that quacks like their CDN.

Once it is working, "offline," keeping it that way is always going to be a challenge... I've had some luck with gross /etc/hosts stuff in VM testing, but perhaps there are better, browser-based ways to do it now.

@jtpio
Copy link
Member

jtpio commented Apr 15, 2021

Thanks!

Right this should be able to run offline. Especially when publishing assets via GitHub releases (https://github.com/jtpio/jupyterlite/issues/16). Folks should just be able to download the tarball, run python -m http.server and have things work out of the box.

https://github.com/jtpio/jupyterlite/pull/26 tried to incrementally improve this for Pyodide, by making it possible to configure the URL via a page config option.

@jtpio
Copy link
Member

jtpio commented Jul 12, 2021

We are also now installing traitlets and ipython in the worker initialization script:

await pyodide.runPythonAsync(`
import micropip
await micropip.install([
'traitlets',
'${_widgetsnbextensionWheelUrl}',
'${_nbformatWheelUrl}',
'${_ipykernelWheelUrl}'
])
await micropip.install([
'${_pyoliteWheelUrl}'
]);
await micropip.install('ipython');
import pyolite
`);

Ideally this should be made configurable so a JupyterLite website can fully work offline with extra requests to PyPI. For now the workaround for an offline mode is to preload the packages so they are cached in the browser.

Also related to jupyterlite/pyodide-kernel#60 and #225

@bollwyvl
Copy link
Collaborator Author

Whew! With #419 in, we're really just down to calling out to CDN for pyodide. As discussed on #310, the full pyodide distribution is 178mb: we don't even really want this in our tests, etc. Instead, I'm thinking, this would go well on the demo site... or perhaps a separate one altogther, e.g. reproducibility-demo.

@bollwyvl bollwyvl mentioned this issue Nov 29, 2021
9 tasks
bollwyvl added a commit to bollwyvl/jupyterlite that referenced this issue Dec 3, 2021
jtpio added a commit that referenced this issue Dec 6, 2021
@bollwyvl
Copy link
Collaborator Author

bollwyvl commented Dec 6, 2021

Well, we don't have a packaged solution for a fully-self-hosted solution, but with #425 and #427 in, it is now possible to configure a jupyter lite that doesn't create any third-party requests 🎉 !

@jtpio
Copy link
Member

jtpio commented Dec 6, 2021

Thanks @bollwyvl for working on this!

As part of #393 we could have an how-to guide showing how to use these, and how to generate a site that works offline.

@jtpio
Copy link
Member

jtpio commented Jun 21, 2022

Well, we don't have a packaged solution for a fully-self-hosted solution

Maybe the available options and flags are enough for now?

As part of #393 we could have an how-to guide showing how to use these, and how to generate a site that works offline.

There is now some documentation to configure this in https://jupyterlite.readthedocs.io/en/latest/howto/configure/advanced/offline.html.

@jtpio
Copy link
Member

jtpio commented Dec 21, 2022

@jtpio jtpio closed this as completed Dec 21, 2022
MVP automation moved this from Backlog to Done Dec 21, 2022
@jtpio jtpio added this to the 0.1.0 milestone Dec 21, 2022
@bollwyvl
Copy link
Collaborator Author

bollwyvl commented Dec 21, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance Gotta go fast
Projects
No open projects
MVP
Done
Development

No branches or pull requests

2 participants