Skip to content
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

Improvements for ipywidgets support #1389

Merged
merged 4 commits into from
Jun 9, 2020
Merged

Improvements for ipywidgets support #1389

merged 4 commits into from
Jun 9, 2020

Conversation

philippjfr
Copy link
Member

Previously we had supported using ipywidgets in the notebook (using the regular Jupyter CommManager) and on the server using ipywidgets_bokeh. I had however overlooked the case where you start a server inside the notebook, e.g. when using .show(). This PR provides a custom IPyKernel to be used in such scenarios, when rendering a plot with .show() the kernel on each Comm is updated to point to this custom kernel allowing communication on the server even when it has been launched inside a notebook.

msg = self.msg(msg_type, content=content, parent=parent, header=header, metadata=metadata)
msg['channel'] = stream.channel

doc = self._document
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would add:

@property
def document(self):
    return curdoc()

in ipywidgets_bokeh and override it here with self._document. Similar thing can be done with even trigger, and all this code duplication could be avoided.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right I was going to make a PR on ipywidgets_bokeh to reduce code duplication.

@philippjfr
Copy link
Member Author

@mattpap I've pushed this PR: bokeh/ipywidgets_bokeh#13 which will allow me to reduce code duplication here. For now I'll merge and will remove the code duplication once a new ipywidgets_bokeh release is available.

@philippjfr philippjfr merged commit 6a8455b into master Jun 9, 2020
@philippjfr philippjfr deleted the ipywidget_show branch June 9, 2020 12:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants