-
Notifications
You must be signed in to change notification settings - Fork 48
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
jupyter_bokeh
3.0.6 (bokeh 3 and ipywidgets 8)
#178
Conversation
* v3.0.5, added support for ipywidgets>=8.0.0 * Update nodejs in CI Co-authored-by: Lev Maximov <lev.maximov@gmail.com> Co-authored-by: Mateusz Paprocki <mattpap@gmail.com>
Is there an ETA on this? What remains to be done? Is there anything I can contribute? |
Well, that was a quick turn around. Thanks! I just installed and tried running it. In Jupyter, I get what looks like a recursion error, but the chart still renders. I'm running this in VSCode. # test.ipynb
from math import pi
import ipywidgets as widgets
import pandas as pd
from bokeh.palettes import Category20c
from bokeh.plotting import figure
from bokeh.transform import cumsum
from bokeh.io import output_notebook
import jupyter_bokeh as jbk
output_notebook()
x = {
'United States': 157,
'United Kingdom': 93,
'Japan': 89,
'China': 63,
'Germany': 44,
'India': 42,
'Italy': 40,
'Australia': 35,
'Brazil': 32,
'France': 31,
'Taiwan': 31,
'Spain': 29
}
data = pd.Series(x).reset_index(name='value').rename(columns={'index': 'country'})
data['angle'] = data['value']/data['value'].sum() * 2*pi
data['color'] = Category20c[len(x)]
p = figure(height=350, title="Pie Chart", toolbar_location=None,
tools="hover", tooltips="@country: @value", x_range=(-0.5, 1.0))
p.wedge(x=0, y=1, radius=0.4,
start_angle=cumsum('angle', include_zero=True), end_angle=cumsum('angle'),
line_color="white", fill_color='color', legend_field='country', source=data)
p.axis.axis_label = None
p.axis.visible = False
p.grid.grid_line_color = None
donut_label = widgets.Label("This is a donut chart")
donut_model = jbk.BokehModel(p)
out_donut = widgets.VBox([donut_label, donut_model])
out_donut.layout.height = "400px"
out_donut ---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
File /.venv/lib/python3.10/site-packages/jupyter_bokeh/widgets.py:126, in BokehModel._sync_model(self, _, content, _buffers)
123 return
125 # Handle ModelChangedEvent
--> 126 new, old, attr = content["new"], content["old"], content["attr"]
127 submodel = self._model.select_one({"id": content["id"]})
128 descriptor = submodel.lookup(content['attr'])
KeyError: 'new'
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
File /.venv/lib/python3.10/site-packages/jupyter_bokeh/widgets.py:126, in BokehModel._sync_model(self, _, content, _buffers)
123 return
125 # Handle ModelChangedEvent
--> 126 new, old, attr = content["new"], content["old"], content["attr"]
127 submodel = self._model.select_one({"id": content["id"]})
128 descriptor = submodel.lookup(content['attr'])
KeyError: 'new'
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
File /.venv/lib/python3.10/site-packages/jupyter_bokeh/widgets.py:136, in BokehModel._sync_model(self, _, content, _buffers)
134 cb(attr, old, new)
135 elif kind == 'MessageSent':
--> 136 self._document.callbacks.trigger_json_event(content["msg_data"])
AttributeError: 'DocumentCallbackManager' object has no attribute 'trigger_json_event' I think the best thing about this is that when I try to generate a static page with jupyter dejavu --execute --template=classic test.ipynb |
Looks like my Should I open an issue or do you think this is related? |
cc @philippjfr @mattpap I believe bokeh/bokeh#11960 and bokeh/bokeh#12623 conspired to uncover this. It seems the jupyter extension should just be constructing a proper |
Would be get to get this ready for release pretty soon. Happy to help if needed. |
I am also patiently waiting for this to be released. I'm currently installing from the github branch. |
3eaad84
to
6bbaf44
Compare
@philippjfr, @hoxbro, this should be fully fixed now. I tested all combinations of triggering updates between bokeh <-> ipywidgets, also streaming and patching, and everything seems to work correctly now. |
Thanks @mattpap! |
Thanks @mattpap! |
This is a branch to prepare for 3.0.6 release, which is compatible with bokeh 3 and ipywidgets 8. I upgraded the build to webpack 5, as the previously used webpack 4 doesn't work with the current LTS of nodejs (18.x).
fixes #184