jupyterlite / demo

JupyterLite demo deployed to GitHub Pages 🚀
https://jupyterlite.github.io/demo
357 stars 193 forks source link

Provide example of how to add your own extension to the distribution #67

Open psychemedia opened 2 years ago

psychemedia commented 2 years ago

The JupyterLite demo currently shows how to add custom content to the site, as well as additional app config settings.

It would be useful for a documented demo of how to add a custom extension, eg from a pre-built wheel.

psychemedia commented 2 years ago

A good example extension for this might be https://github.com/jupyterlab-contrib/jupyterlab-filesystem-access eg in context of https://github.com/jupyterlite/jupyterlite/pull/603 .

jtpio commented 2 years ago

Looks like it's already documented in the README?

https://github.com/jupyterlite/demo#deploy-a-new-version-of-jupyterlite

image

psychemedia commented 2 years ago

I tried that locally, adding jupyterlab_filesystem_access to my requirements.txt and running jupyter lite build --contents content, then eg jupyter lite serve --port 8002 but I don't see the extension working in JupyterLite? So I figured there's maybe a step I'm missing?

psychemedia commented 2 years ago

I also note the README for the jupyterlab_filesystem_access suggests "[t]he main motivation for this extension is to give access to local files in JupyterLite" so it might be appropriate to give a Github Pages / JupyterLite demo there, along with minimum docs for what folk need to do to enable the extension in their own JupyterLite distribution?

psychemedia commented 2 years ago

Hmm... so when I add the files to requirements in a demo Github repo site, it works. Does the JupyterLite builder pick up extensions that are installed in a base JupyterLab environment? Could it be looking to the wrong path on my local install for what extensions to include?

jtpio commented 2 years ago

I tried that locally, adding jupyterlab_filesystem_access to my requirements.txt and running jupyter lite build --contents content, then eg jupyter lite serve --port 8002 but I don't see the extension working in JupyterLite? So I figured there's maybe a step I'm missing?

You need to reinstall the dependencies so they are part of the environment.

JupyterLite picks them up from the env prefix by default, see the docs: https://jupyterlite.readthedocs.io/en/latest/configuring.html#environment-extensions

it might be appropriate to give a Github Pages / JupyterLite demo there

There is one: https://jupyterlab-filesystem-access.readthedocs.io/en/latest/#try-it-online

Does the JupyterLite builder pick up extensions that are installed in a base JupyterLab environment?

Yes they need to be installed, see the docs: https://jupyterlite.readthedocs.io/en/latest/configuring.html#environment-extensions Or you use direct links to the tarballs / wheels with ignore_sys_prefix, like in https://github.com/jupyterlite/jupyterlite/tree/main/examples

psychemedia commented 2 years ago

JupyterLite picks them up from the env prefix by default, see the docs:

yes, that's what I'm having the issue with locally. My local JupyterLab install is running with extensions and they are not being picked up by JupyterLab. I think there are several paths that extension can sit on and JupyterLite build does not seem to inspect them all?