-
Notifications
You must be signed in to change notification settings - Fork 946
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
Package example notebooks in JupyterLite #3491
Conversation
Indeed, this is a known issue. I pushed a PR to nbsphinx to try to fix. It probably needs updating: spatialaudio/nbsphinx#637 |
A workaround is to not use the custom parser, and instead use the directives directly |
Oh, right, and manually override the parser for ipynb files. Nice! |
You might want to give xeus-python a try in this PR :) Using https://xeus-python-kernel.readthedocs.io/en/latest/configuration.html to pre-install ipywidgets will allow to remove the first import piplite
await piplite.install('ipywidgets') cell from the notebooks |
Good point. I hear that soon we'll be able to set up an environment soon anyway. Are there any incompatibilities still with xeus-python vs ipykernel? |
@martinRenou - I tried switching to xeus-python, but it still seems to require the importing and using piplite (in the current doc build in CI). Is there something wrong with my config now? |
xeus-python is pretty close to ipykernel now, there are no big differences that I'm aware of. But note that ipykernel is not used in JupyterLite. The default kernel in JupyterLite is named pyolite, it's backed by pyodide, not ipykernel. When it comes to differences between xeus-python and JupyterLite's default kernel "pyolite":
|
Maybe it's a cache issue? Do you not see xeus-python in the JupyterLab launcher? |
No, I don't. Here's the latest readthedocs CI build from this PR: https://ipywidgets--3491.org.readthedocs.build/en/3491/ Does the jupyterlite config look right? https://github.com/jupyter-widgets/ipywidgets/blob/d0e0c6f5b21d77322d0c0aac7db40500faf4f534/docs/source/jupyterlite_config.json |
@martinRenou - ah, got it working: I had to install jupyterlite-xeus-python |
Current state:
|
I'll give it a try locally.
Using a dev installation might be tricky indeed, but probably not impossible. I wonder if we could make this case easier on the jupyterlite-xeus-python front.
Yes. I've done it in the ipycanvas documentation: https://github.com/martinRenou/ipycanvas/blob/master/docs/jupyter-lite.json#L6, you must tell jupyterlite-sphinx that the build directory is the local one https://github.com/martinRenou/ipycanvas/blob/master/docs/conf.py#L9 for it to find this config file. |
yeah, that was the explicit goal of the build-time
In pyolite, it's now also theoretically possible to create an ipython profile, though the hard-coded path to |
I rebased and consolidated a lot of commits to clean things up a bit. |
Add back nbsphinx, with ipynb files explicitly using the jupyter_notebook renderer from nbsphinx. Update ipywidgets in jupyterlite to 7.7.0 Add xeus-python config for jupyterlite
Experimental tagging of cells to the Widget List notebook for jupyterlite.
Revert "Experimental tagging of cells to the Widget List notebook for jupyterlite." This reverts commit 29a3515.
Update docs conda env Install the dev version of ipywidgets in readthedocs
2eb68c5
to
81c345b
Compare
… with ipywidgets 8.
Interestingly, the output widget cannot capture exceptions in JupyterLite, even though it does in ipykernel: from ipywidgets import Output
out = Output(layout={'border': '1px solid red'})
display(out)
with out:
print('This output is captured')
raise Exception('This exception is captured in ipykernel, but not in pyolite') (#3417 tries to enable this in general, but it was surprising that output widgets behave like this anyway in JupyterLite) @martinRenou @jtpio @bollwyvl - is this expected? If not, I can file an issue somewhere. |
Yeah... no two |
I'm trying to skip some example notebook files. I have two attempts that are failing: First, I tried giving an array of files to jupyterlite_contents option of jupyterlite_sphinx, which is translated into command-line
(i.e., the assets in examples/images are copied to the top-level filesystem, but I'd like them to actually be a subdirectory I also tried going back to the
This preserved the examples/images directory as a subdirectory in JupyterLite, but it seems that the ignored_contents directory was ignored, i.e., I still see those files in my contents. Any suggestions on how I can ignore three specific files in my contents directory? |
Right the file hierarchy appears to be flatten when specifying multiple contents options (also noticed elsewhere). Probably this is an issue with
I would expect this to work based on the reply in jupyterlite/jupyterlite#709 (comment). Or maybe it's because it should be a list of regex and some characters must be escaped. For example like with the dynamic default: https://github.com/jupyterlite/jupyterlite/blob/fc5875f0ba8ed34c4d78f6c82d98691eab95ee8b/py/jupyterlite/src/jupyterlite/config.py#L183-L207 |
Tried out some stuff mentioned above over on #3517: |
I merged Nick's changes into this PR. Thanks Nick! |
Good luck! I don't know if that's going to work out-of-the-box... |
I think this PR is at a good place to merge, and future iteration can be on a different PR. CC @ibdafna |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excited for this one 😍
This packages many of the example notebooks in a live JupyterLite instance available from the documentation.
CC @martinRenou