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

Ipywidget comm breaks when a new ipywidget is rendered #4091

Merged
merged 2 commits into from
Nov 18, 2022

Conversation

govinda18
Copy link
Contributor

Fixes #4088

This commit drops explicitly calling ipywidget.comm.open() as it causes a protocol version mismatch issue - reproducer in the referenced issue. When opening a new comm, as per the docs, we need to pass data and meta data. So the w.comm.open() call should be something like:

metadata = {"version": "2.0.0"}
data = {"state": w.get_state()}
w.comm.open(data=data, metadata=metadata)

This seems to fix the error but the widgets still do not update. This is because when we create a new comm, ipywidgets seems to create a new model reference. In my understanding, we need not explicitly open a comm to the frontend as the kernel will automatically reconstruct an existing comm. If for some reason we do want to open a comm, then ipywidgets bokeh needs to be updated so that the view uses the correct model.

@codecov
Copy link

codecov bot commented Nov 8, 2022

Codecov Report

Merging #4091 (395a2b3) into master (a1fc86d) will increase coverage by 0.01%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master    #4091      +/-   ##
==========================================
+ Coverage   83.58%   83.59%   +0.01%     
==========================================
  Files         223      223              
  Lines       33243    33231      -12     
==========================================
- Hits        27785    27780       -5     
+ Misses       5458     5451       -7     
Flag Coverage Δ
ui-tests 37.57% <ø> (ø)
unitexamples-tests 74.67% <ø> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
panel/pane/ipywidget.py 50.00% <ø> (+1.11%) ⬆️
panel/io/state.py 69.65% <0.00%> (-0.35%) ⬇️
panel/tests/util.py 91.17% <0.00%> (-0.09%) ⬇️
panel/io/jupyter_server_extension.py 0.00% <0.00%> (ø)
panel/tests/ui/widgets/test_tabulator.py 99.07% <0.00%> (+0.10%) ⬆️
panel/pane/idom.py 28.36% <0.00%> (+0.19%) ⬆️
panel/tests/conftest.py 88.79% <0.00%> (+0.38%) ⬆️
panel/io/callbacks.py 79.41% <0.00%> (+0.57%) ⬆️
panel/command/convert.py 32.35% <0.00%> (+0.92%) ⬆️
panel/tests/command/test_serve.py 83.95% <0.00%> (+1.02%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@philippjfr
Copy link
Member

Thanks @govinda18. Would love to sync with you some time to survey the current issues with ipywidgets + bokeh/panel and then make a plan for resolving them.

@govinda18
Copy link
Contributor Author

govinda18 commented Nov 8, 2022

Thanks @govinda18. Would love to sync with you sometime to survey the current issues with ipywidgets + bokeh/panel and then make a plan for resolving them.

Surely, feel free to send an invite to totla@deshaw.com.

@govinda18
Copy link
Contributor Author

@philippjfr let me know whenever you are free to catch up. My colleague @mlucool would also love to join at udoff@deshaw.com.

Also, let me know if you have any feedback on the PR.

@philippjfr
Copy link
Member

Together with bokeh/ipywidgets_bokeh#69 this fixes the issue.

@philippjfr philippjfr merged commit ffb4bf5 into holoviz:master Nov 18, 2022
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.

Panel ipywidgets interaction stops working after a new ipywidget is mounted on the page
2 participants