-
Notifications
You must be signed in to change notification settings - Fork 949
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
Design philosophy of ipywidgets wrt same-kernel collaboration #1881
Comments
See also the relevant discussion at jupyter/jupyter_client#263 and #1218. Basically, a change in the Jupyter protocol is the cleanest way to handle this. |
OK thanks for the comment. So it's essentially a known bug. |
After some more experimentation: import ipywidgets
w = ipywidgets.IntSlider()
w.observe(lambda d: d["owner"].send_state("value"), names=["value"])
w |
Yes. A communication from the kernel to the frontend goes to all frontends. What is missing right now in the underlying Jupyter protocol is a mirroring of communication from a single frontend back out to all frontends. What you're seeing with setting widget.value in an observer is that since the widget value didn't change, there is no communication with the frontend. Can we move this conversation on #1218? We like to keep the conversation about an issue consolidated on one issue ticket so it's easier to track things. I'll close this issue and let's move the conversation over there. |
Currently, same-kernel collaboration is not working smoothly with ipywidgets.
I start a notebook session and enter the following cell:
When I modify the cell, embed the widget state, and save the notebook, the widget will show up when I load the notebook URL in a different browser.
In the new notebook session, the widget will modify the kernel value. However, the widget in the two sessions are no longer in auto-sync with the kernel: in each session, I have to press F5 to see any updates in the kernel value that were effectuated by the other session.
I am not sure if this is a bug or a design decision. This discussion seems on-topic, but mostly talks about security and locking, which I don't care about. In my case, in each notebook session, the code cells will be hidden from the user and only the widgets are being modified.
I am thinking of rolling my own interactive widget implementation (where the kernel simply launches a websocketserver, bypassing Jupyter completely). But if it is simply an ipywidgets bug, I won't try to re-invent the wheel.
The text was updated successfully, but these errors were encountered: