voila icon indicating copy to clipboard operation
voila copied to clipboard

Separate jupyter widgets manager extension

Open martinRenou opened this issue 1 year ago • 11 comments

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 of share/jupyter/labextensions. This prevents JupyterLab to load our widgets-manager and break the classic @jupyter-widgets/jupyterlab-manager

martinRenou avatar Sep 14 '23 10:09 martinRenou

Binder :point_left: Launch a Binder on branch martinRenou/voila/split_manager

github-actions[bot] avatar Sep 14 '23 10:09 github-actions[bot]

@trungleduc that works well!! Tested with jupyterlab_widgets 3.0.9 and 3.0.7.

martinRenou avatar Sep 14 '23 13:09 martinRenou

Question about the releaser, we will bump both package versions on each release or they can be released separately?

trungleduc avatar Sep 14 '23 14:09 trungleduc

By default the releaser will bump both but I guess we can configure that in our bump script if we need.

martinRenou avatar Sep 14 '23 14:09 martinRenou

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.

martinRenou avatar Sep 14 '23 15:09 martinRenou

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.

martinRenou avatar Sep 14 '23 15:09 martinRenou

how can JupyterLab activate Voila's widget manager? We checked for the app instance before doing anything

trungleduc avatar Sep 14 '23 15:09 trungleduc

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.

martinRenou avatar Sep 14 '23 17:09 martinRenou

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.

martinRenou avatar Sep 15 '23 09:09 martinRenou

Ready for review

martinRenou avatar Sep 15 '23 11:09 martinRenou

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.

martinRenou avatar Sep 15 '23 14:09 martinRenou