Closed sdbbs closed 2 years ago
@philippjfr it looks like you removed the BokehModel
import from __init__.py
in 8f21a150e21ea88747e0e0c994299f1a1bb5e4d4 Was that intentional? (Should the import be restored, or should the notebook be updated?)
That was indeed intentional but I should have updated the docs. The reason why I removed the import is that importing the module will register the Bokeh extension, which means you may be pointlessly loading an extra JS bundle.
Actually not sure that even makes sense and I'm just confused. I think the import should be restored after all.
@sdbbs would you like to submit the small PR to restore the import to __init__.py
We are in the middle of a release of the main project at the moment so it would in fact be a big assistance.
Hi all,
Thanks for the feedback!
would you like to submit the small PR to restore the import to init.py
I wouldn't mind, but just to make sure I am not misunderstood, I do not mind the import being where it is; I'm a first-time user, so it's not like I'm used to anything.
All I think is needed, is that jupyter_widgets.ipynb
is updated with the correct import, since this file serves as the documentation at the moment - so I made this PR:
https://github.com/bokeh/jupyter_bokeh/pull/138
Does that look OK to you all?
@sdbbs the import was moved in error, it would be better to restore it and leave the notebook as it has always been, if for no other reason than to reduce the potential future support burden of an unplanned breaking change.
Hi @bryevdv
the import was moved in error, it would be better to restore it and leave the notebook as it has always been
Ah, OK, I see - thanks!
I'm not sure I have the entire development ecosystem, but I looked into 8f21a15, and as far as I could see, it was only about restoring a single line of code; this is the way I tested on my headless server:
$ git clone https://sdbbs@github.com/sdbbs/jupyter_bokeh.git jupyter_bokeh_git
...
$ cd jupyter_bokeh_git/
jupyter_bokeh_git$ git checkout -b sdbbs-restore-import
jupyter_bokeh_git$ nano jupyter_bokeh/__init__.py # edit the change here
jupyter_bokeh_git$ ln -s ../package.json jupyter_bokeh/
jupyter_bokeh_git$ mkdir jupyter_bokeh/labextension
jupyter_bokeh_git$ ln -s ../../package.json jupyter_bokeh/ labextension/
jupyter_bokeh_git$ python3
Python 3.8.10 (default, Jun 2 2021, 10:49:15)
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import jupyter_bokeh as jbk
>>> jbk.BokehModel(None)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "~/Jupyter/jupyter_bokeh_git/jupyter_bokeh/widgets.py", line 69, in __init__
assert isinstance(model, LayoutDOM)
AssertionError
Since now I got AssertionError
complaining that the model
is not isinstance
-- instead of the previous AttributeError: module 'jupyter_bokeh' has no attribute 'BokehModel'
-- I'm assuming it is fine?
EDIT: and the pull request is:
https://github.com/bokeh/jupyter_bokeh/pull/139
Hope this works out ...
Closing since the PR was merged
Hi all,
Thanks for a great library.
All I want to do is, to put a bokeh plot inside ipywidgets (HBox, VBox) in Jupyter notebook.
So, I installed
jupyter_bokeh
, and I'm trying to follow the (as of now latest) https://github.com/bokeh/jupyter_bokeh/blob/e3ef4c9/examples/jupyter_widgets.ipynb :However, I'm doing this quick test:
Looking through the source, I believe this should be:
Please update your documentation - and thanks again!