bokeh / jupyter_bokeh

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

Add support for jupyter wigets #71

Closed mattpap closed 4 years ago

mattpap commented 4 years ago

TODO:

maartenbreddels commented 4 years ago

Great to see this, have you thought about embedding in static html pages, e.g. nbconvert, when creating a static webpage in the classical notebook, and even for voila? e.g.: https://github.com/maartenbreddels/ipyvolume/blob/fbd1ba04030aa13fdfc1b4a51331691492aa03a1/js/webpack.config.js#L70

This gets uploaded to a CDN, and when a widget is created, it will fetch this from a CDN (unpkg by default). based on the model_module_name.

mattpap commented 4 years ago

have you thought about embedding in static html pages

Yes, though I didn't have a chance up until now to see if this works, and testing in voila reveals that it doesn't. Thanks for the suggestion. With the additional bundle it works now.

mattpap commented 4 years ago

@philippjfr, when testing this in voila, currently there is no npm package uploaded, so you will have to link or copy dist/index.js to voila's static directory under voila/jupyterlab_bokeh.js. One caveat is that voila logs one static directory to the console, but uses a different one (base directory of the notebook). I'm not sure if this is a bug or bad configuration on my side. Maybe there is a better way to test this altogether.

philippjfr commented 4 years ago

How did you test and install it without a setup.py?

maartenbreddels commented 4 years ago

I think you should put it in $prefix/share/jupyter/voila/templates/default/static for testing.

philippjfr commented 4 years ago

I've now managed to get things working in JupyterLab but am still struggling to get the extension to work in classic notebook or voila. Pretty sure it's something I'm doing wrong but I won't be able to test this more until later (on a plane and my laptop is dying).

mattpap commented 4 years ago

I renamed the module and npm package, and published to npm (as @bokeh/jupyter_bokeh). This should make it easier to test things, given how jupyter lab and voila work. I did throughout testing in jupyter lab/notebook and voila, and everything seems to work fine (up to known issues with output_notebook()). I will publish conda and pip packages tomorrow.

bryevdv commented 4 years ago

Thank you @mattpap please also try to provide some minimal examples and instruction to use for those of us that have not been trying this work out already.

mattpap commented 4 years ago

I updated the README.md with basic setup and there are a few notebooks in test_cases/ (jupyter_widgets and jupyter_sliders are primarily relevant). voila isn't documented yet, but using it is as simple as:

conda install voila
voila test_cases/jupyter_widgets.ipynb
philippjfr commented 4 years ago

I can confirm this works for me in JLab, the classic notebook and Voila now. Happy to see this merged.

mattpap commented 4 years ago

I uploaded jupyter_bokeh package to anaconda cloud (bokeh/label/dev channel).