Skip to content
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

Add JupyerLab extensions? #271

Open
jitseniesen opened this issue Apr 29, 2020 · 6 comments
Open

Add JupyerLab extensions? #271

jitseniesen opened this issue Apr 29, 2020 · 6 comments

Comments

@jitseniesen
Copy link
Member

We should consider to add some extra JupyterLab extensions. For instance, the ones necessary to display Bokeh or Plotly plots.

Originally posted by @ccordoba12 in #264 (comment)

@jitseniesen
Copy link
Member Author

As noted in #309, ipywidgets is another important extension that we should consider.

@jitseniesen jitseniesen added v0.3.1 and removed v0.3 labels Jul 30, 2020
@jitseniesen jitseniesen added this to the v0.3.2 milestone Dec 24, 2020
@jitseniesen
Copy link
Member Author

I started to look into this, specifically at adding Bokeh, but it is not yet obvious to me how to achieve this. So I am using this issue to brainstorm.

Currently, if you open a notebook with a Bokeh plot in Spyder, it does not display the plot but a message that JavaScript is disabled in Jupyter lab. It may be possible to somehow enable JavaScript. However, the Jupyter people disabled JavaScript for security reasons and I assume their reasons are valid. It looks like enabling JavaScript means that just opening a notebook can execute arbitrary Python commands, which sounds scary.

The way Bokeh works in Jupyter Lab is as an extension, which is installed with the jupyter labextension install command (see Using with JupyterLab in Bokeh's user guide). The Bokeh extension is an application plugin (see the Jupyter Lab Extension Development Guide), which is a JavaScript object, and Jupyter Lab works as a collection of plugins. However, Spyder Notebook does not use the Jupyter Lab plugin framework, it just uses the functions within various Jupyter Lab packages, most notable the notebook package.

One possibility here would be to locate the functions within the Bokeh extension that we need and call them without using Jupyter Lab's plugin framework. This should be possible but I think it will be fragile: upgrades in either Bokeh or Jupyter Lab may change the functions to use. It also needs to be repeated for every extension.

Perhaps a better way is to use the whole application framework of Jupyter Lab including its plugin mechanism. Hopefully it's all flexible enough that we can still remove all the elements we don't want and only display the notebook. Users can then install the Bokeh extension (and any other extension) themselves. I think this is the option I want to explore further, but it is not a change for a minor release.

@jitseniesen jitseniesen modified the milestones: v0.3.2, v0.4 Dec 28, 2020
@ccordoba12
Copy link
Member

I think extensions in JupyterLab 3.0+ can also be pure Python packages, not only npm ones that require recompiling the Lab's code.

See here for some discussion about it:

jupyterlab/jupyterlab#9461

@jitseniesen
Copy link
Member Author

Yes, they now have what they call pre-built extension. As I understand it, installing them basically boils down to copying a prebuilt JavaScript file in the correct directory, which looks much easier. It still means that we have support Jupyter Lab's plugin mechanism, but it is another argument in favour of that approach.

@jitseniesen
Copy link
Member Author

The project jupyterlab-classic looks interesting; they built an interface that looks like classic notebooks using the modern JupyterLab components, and it claims to support extensions. So it is possible.

@ccordoba12
Copy link
Member

That looks really interesting indeed!

@jitseniesen jitseniesen modified the milestones: v0.4, v0.5 Apr 18, 2021
@jitseniesen jitseniesen modified the milestones: v0.5, v0.6.0, v0.6.1 May 28, 2024
@jitseniesen jitseniesen modified the milestones: v0.6.1, v0.6.2 Sep 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants