-
Notifications
You must be signed in to change notification settings - Fork 7
Refactored comms to add JupyterLab support #51
Conversation
parambokeh/__init__.py
Outdated
js_callback = CustomJS(code=fetch_data+self_callback) | ||
debounce=self.debounce, | ||
plot_id=self.comm.id) | ||
js_callback = CustomJS(code='\n'.join([HOLOVIEWS_PROXY, |
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.
Putting the proxy code in here will reset the comms and kernels registries after they have been set up. At minimum you'd have to ensure that it does not override them if they are already defined.
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.
Ok, I'll give that a go.
parambokeh/__init__.py
Outdated
bokeh_script, bokeh_div, _ = bokeh.embed.notebook.notebook_content(obj, target) | ||
publish_display_data(data={'text/html': encode_utf8(bokeh_div)}) | ||
publish_display_data(data={mime: '', 'application/javascript': bokeh_script}, | ||
metadata={mime: {'id': target}}) |
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.
This needs to be the self.comm.id
rather than the target.
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.
Thanks. This is what was needed to fix it.
The basics now work in both classic notebook and jupyterlab: you can display some widgets, manipulate them and use that to update parameters. I'll now look into the other uses of comms (e.g relating to |
Here is a related pyviz issue: holoviz/pyviz_comms#4 It isn't the whole story as the comms code itself references |
With the commit by @philippjfr, I believe the TODO items have been ticked off except those that require more discussion across pyviz. |
Updated the imports to use the new |
Tests are now green and I have ticked off the TODO items above. It isn't perfect but I think it is ready to review and merge before improving upon in subsequent PRs. The |
Looks good. |
This PR is still WIP and there are a lot of issues to address:
HoloViews
object to be introduced in JS which isn't appropriate for other pyviz projects.Right now the problem I am trying to address is to get comms working in jupyterlab as the parameter values are not updating.
Note that this requires the pyviz jupyterlab extension. I have the bokeh jupyterlab extension but I'm not yet sure whether or not it is actually required.