jtpio / ipylab

Control JupyterLab from Python Notebooks with Jupyter Widgets 🧪 ☢️ 🐍

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Integration with JupyterLite?

deeplook opened this issue · comments

I think it would be nice to run ipylab in JupyterLite, so I gave it a try, although I see no claim that ipylab should support JupyterLite. So while ipylab does install fine, it does not appear to have any effect on the (JupyterLab) interface, like in this code:

import micropip
await micropip.install('ipylab')
from ipylab import JupyterFrontEnd

app = JupyterFrontEnd()
app.commands.execute('apputils:change-theme', {'theme': 'JupyterLab Dark'})

When using widgets in a panel like this (from a standard example snippet) I get a "Loding widget..." message:

import micropip
await micropip.install("ipylab")
await micropip.install("ipywidgets")
from ipylab import Panel
from ipywidgets import IntSlider

panel = Panel()
slider = IntSlider()
panel.children = [slider]
panel

I'd appreciate any statement if this should work and I'm doing something wrong, or if JupyterLite support is considered enough of a nice to have feature in the future?

Thanks @deeplook.

Yes ipylab (latest versions) should work with JupyterLite now.

This is for example the case with this custom deployment: https://github.com/jtpio/lit

image

You might need to separate the following two statements in different cells:

app = JupyterFrontEnd()
app.commands.execute('apputils:change-theme', {'theme': 'JupyterLab Dark'})

Ok, great! Will this be deployed to https://jupyterlite.readthedocs.io, too, and when? ;)

Ah I think it's unlikely to be added to https://jupyterlite.readthedocs.io.

But you can easily make your own JupyterLite deployment and add ipylab to it (like https://github.com/jtpio/lit does).

Sorry, I didn't mean "deployed" in the sense of pre-install ipylab on https://jupyterlite.readthedocs.io, but in the sense of being able to micropip-install it there.

Right, it can be micropip installed. But the frontend extension also needs to be available, which requires adding it to the deployed website.

For example here on the demo site:

https://github.com/jupyterlite/jupyterlite/blob/21949bb8203cb4b18cc6c63cc25dd0a9cc2a45f0/examples/jupyter_lite_config.json#L4-L22

Got it, thanks!