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

Automatically install lab extension when installing the python package? #105

Closed ceball closed 3 years ago

ceball commented 4 years ago

Here's what I think:

After doing pip install jupyter_bokeh, I should not also have to do jupyter labextension install @bokeh/jupyter_bokeh (and potentially other steps/packages I can't even remember right now ;)

Do you agree?

If it makes sense, I can probably make a PR.

mattpap commented 4 years ago

I'm pretty sure there's a reason why we do don't do this already, although I don't remember right now. Perhaps it's just a discouraged practice. In any case, this should work the same for pip and conda packages. @philippjfr, maybe you have some additional feedback?

philippjfr commented 4 years ago

I think for ages there wasn't a generally accepted way to do this but it may have been remedied at some point. Can you explain how this would be achieved?

mattpap commented 4 years ago

One thing that would be really useful, is the ability to install @jupyter-widgets/jupyterlab-manager automatically when issuing:

jupyter labextension install @bokeh/jupyter_bokeh

However, jupyterlab doesn't support dependency management yet (https://github.com/jupyterlab/jupyterlab/issues/4245).

ceball commented 4 years ago

To be a bit clearer, I'm roughly proposing we copy the extension tar.gz to share/jupyter/lab/extensions, and then the next time lab is started, it will prompt the user to rebuild. (Not building immediately makes sense because someone might be installing lots of extensions.)

this should work the same for pip and conda

Yes, I agree - i.e. "After doing conda install jupyter_bokeh, I should not also have to do jupyter labextension install @bokeh/jupyter_bokeh".

I think for ages there wasn't a generally accepted way to do this but it may have been remedied at some point. Can you explain how this would be achieved?

I would add jupyter-packaging as a build dependency, and tell it to install the lab extension :)

I.e. while I know what you're referring to, I'm going to try to side step answering beyond: "installing jupyter extensions is a problem common to all python-based jupyter projects and it looks like there is a jupyter project to support that".

Example:

I have also used jupyter-packaging in another project myself to install a lab extension, and it seems to work out fine practically (windows, mac, and linux, using conda and pip). However, I haven't tried using it in a project that's also bokeh based. And there could be complications around matching up versions of everything (lab, lab extension, python package), but does "labextension install" do anything to help with that anyway? (It might - I don't know. Or it might in the future. But presumably jupyter-packaging would keep up with any such developments.)

One thing that would be really useful, is the ability to install @jupyter-widgets/jupyterlab-manager

I think that should be "ipywidgets' problem", rather than a problem for here. I.e. I think it should be possible to specify a dependency on ipywidgets (or indeed pip/conda install ipywidgets as a user) such that ipywidgets actually work in jupyter lab. As you know, at the moment, installing ipywidgets does not give you working ipywidgets if you are using jupyter lab; you need to install node.js then install the above lab extension. But still, I think that should be solved by ipywidgets (jupyter).

ceball commented 4 years ago

I found some ipywidgets discussion: https://github.com/jupyter-widgets/ipywidgets/issues/2806

bryevdv commented 3 years ago

ext for version 3.0 handles dynamic loading of pre-build extensions for jlab >= 3