-
Notifications
You must be signed in to change notification settings - Fork 14
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
Add support for widgets #73
Conversation
@@ -23,7 +23,8 @@ classifiers = [ | |||
"Programming Language :: Python :: 3.11", | |||
] | |||
dependencies = [ | |||
"jupyterlab~=3.6" | |||
"jupyterlab~=3.6", | |||
"jupyterlab_widgets~=3.0" |
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.
Should it be ipywidgets
?
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.
I guess jupyterlab_widgets
is the minimal required dependency, so the sharedPackages
like @jupyter-widgets/jupyterlab-manager
defined in the package.json
don't trigger errors on page load if they are missing?
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.
Yes, that's right @jtpio.
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.
Does it actually needs any of those two?
It seems to me only the front-end would need this dependency. If ipywidgets is not installed by the user they cannot use widgets, and that's fine. If it is installed, they can.
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.
If I understood correctly, jupyterlab_widgets is a lab extension. If that's the case, we need to make sure the extension is installed, and we can only do that if we depend on its Python package.
I don't understand why the versions differ between its JS and Python packages though.
https://github.com/jupyter-widgets/ipywidgets/blob/511663a56324cea5324f49a65ebe25e2f1b04d87/python/jupyterlab_widgets/jupyterlab_widgets/_version.py#L4
https://github.com/jupyter-widgets/ipywidgets/blob/511663a56324cea5324f49a65ebe25e2f1b04d87/python/jupyterlab_widgets/package.json#L3
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.
It's the same situation as in Voila. Voila front-end requires ipywidgets JS packages (to implement our own widget manager), but the Python package does not require ipywidgets or jupyterlab_widgets.
I don't understand why the versions differ between its JS and Python packages though
Legacy? We're in the same situation in many widgets packages (like bqplot and ipyleaflet), because at some point we only bumped the Python package because there were no applied changes in the front-end code.
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.
Btw, I just tried to remove the Python dependency, but I can not.
I require IJupyterWidgetRegistry from '@jupyter-widgets/base'
as an optional token, and still, if the token is missing, the extension doesn't activate.
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.
I require IJupyterWidgetRegistry from '@jupyter-widgets/base' as an optional token, and still, if the token is missing, the extension doesn't activate.
Even if making the token optional?
Could this be part of a separate plugin just for widgets? This way it would not prevent the rest of the extension to activate.
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.
Even if making the token optional?
Yes
Could this be part of a separate plugin just for widgets? This way it would not prevent the rest of the extension to activate.
I think that might work. But I would need to create multiple plugins. We are not providing the document tracker at the moment.
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.
It's really really really annoying that a missing optional token would broke the extension. That completely defeats the purpose of optional tokens.
Awesome, thanks for fixing this! This will allow us to have jupyterlab-blockly work with ipylgbst. |
To test it, you can hardcode a widget here:
https://github.com/hbcarlos/jupyterlab-blockly/blob/be29b8b5eb5409f8a52a17731e9b8e6803787dcf/packages/blockly/src/layout.ts#L164
Then, if you press the run button, it will always generate the hardcoded widget.
Screencast.from.04-14-2023.01.22.08.PM.webm