bokeh / jupyter_bokeh

An extension for rendering Bokeh content in JupyterLab notebooks
BSD 3-Clause "New" or "Revised" License
249 stars 48 forks source link

Does not work with the latest version of ipywidgets #168

Open axil opened 1 year ago

axil commented 1 year ago

jupyter_bokeh does not work with ipywidgets >=8.0.0a0 Latest compatible version of ipywidgets is 7.7.2.

axil commented 1 year ago

Here's the relevant migration guide: https://github.com/jupyter-widgets/ipywidgets/blob/master/docs/source/migration_guides.md

Supposedly all that needs to be done is to update package.json accordingly.

axil commented 1 year ago

Tried to create a reproducible example in a Docker container. Couldn't (although it did appear in two machines, Linux and Windows). Closing as false alarm for the time being.

axil commented 1 year ago

Another bunch of tests revealed that the issue is not reproducible on Linux. It only affects Windows.

axil commented 1 year ago

I've found it out why it works on Linux: it is because it uses the global version of the notebook extension and not from the virtualenv. So it is basically the same on Windows and Linux.

Got it working with latest ipywidgets (8.0.2) by manually patching the index.js file (searched and replaced all instances of pWidget to luminoWidget and PhosphorWidget to LuminoWidget).

My suggestion is that updating package.json as described in the link above should suffice:

- "@jupyter-widgets/base": "^2 || ^3 || ^4",
+ "@jupyter-widgets/base": "^6",

Validating it I've run into the following problem:

> @bokeh/jupyter_bokeh@3.0.4 build:lib /home/axil/upyter_bokeh
> tsc

src/plugin.ts:61:14 - error TS2322: Type 'Token<IJupyterWidgetRegistry>' is not assignable to type 'Token<any>'.
  Types have separate declarations of a private property '_tokenStructuralPropertyT'.

61   requires: [IJupyterWidgetRegistry],
                ~~~~~~~~~~~~~~~~~~~~~~
axil commented 1 year ago

@mattpap I've included the change proposed above into packages.json, built the project, tested against latest ipywigets 8.0.2 (works fine) and generated the package-lock and yarn.lock files.