voila
voila copied to clipboard
Separate jupyter widgets manager extension
References
A robust fix for https://github.com/voila-dashboards/voila/issues/1392
Code changes
- Move the Voila jupyter-widgets manager into a separate federated extension. This should have the byproduct to properly share the
@jupyter-widgets/base
package in the federated extension logic, instead of having Voila ship its own copy of this package. - Install voila-specific labextensions under
share/jupyter/voila/labextensions
instead ofshare/jupyter/labextensions
. This prevents JupyterLab to load our widgets-manager and break the classic@jupyter-widgets/jupyterlab-manager
@trungleduc that works well!! Tested with jupyterlab_widgets 3.0.9 and 3.0.7.
Question about the releaser, we will bump both package versions on each release or they can be released separately?
By default the releaser will bump both but I guess we can configure that in our bump script if we need.
The test failure is legit. This new manager breaks jupyterlab because it says it provides the IJupyterWidgetRegistry
token (so it overwrites the one from ipywidgets), but it fails saying we need a VoilaApp. This is all very weak.
This new manager breaks jupyterlab because it says it provides the IJupyterWidgetRegistry token (so it overwrites the one from ipywidgets), but it fails saying we need a VoilaApp
Because our extension needs a Voila app, I think we should separate the labextensions specific to Voila from the labextensions for other applications and lab-remixes in the path.
So Voila would look into /share/jupyter/labextensions
for classic lab-extensions, and /share/jupyter/voila/labextensions
for labextensions very specific to Voila. Opinions @jtpio @trungleduc ?
That way we're not breaking JupyterLab with our very specific extension.
how can JupyterLab activate Voila's widget manager? We checked for the app instance before doing anything
JupyterLab sees the Voila's widget manager provides the token IJupyterWidgetRegistry
so it tries to activate it and that fails. And it does not fallback to the usual widget manager, the Voila one shadows it.
It seems depending on @voila-dashboards/voila
in a labextension for Voila breaks the labextension with package @jupyterlab/filebrowser is not in the shared scope
so we need to remove it.
I see @trungleduc did the same in https://github.com/voila-dashboards/voila-topbar and need to work with (app as any)
instead of importing the type of VoilaApp
.
Let's open an issue later for this.
Ready for review
As discussed with @trungleduc this will be too much of a change for a patch release. @trungleduc found a simpler fix and will come up with another PR.
Though I'd like that we consider these changes in a 0.6.x release, as scoping labextensions specific to Voila may make sense in some cases.