Notebook in side panel extension

Hello,

I’d like to create an extension for JupyterLab that has a side panel with code cells in it that can run code against the kernel of the current notebook in the main window. Is that possible? If so, an outline of how that would work would be very helpful.

Thanks!

Yes, it is possible. In plain JupyterLab you can open a new console and attach it to the kernel of existing notebook. The only difference in your extension would be to attach the console to sidebar and possibly customise it’s look an feel (also see Allow changing the position of the code console prompt cell by jtpio · Pull Request #13837 · jupyterlab/jupyterlab · GitHub).

In the latest alpha version you can also use subshells and subshell consoles for this, see Support kernel subshells by ianthomas23 · Pull Request #16963 · jupyterlab/jupyterlab · GitHub.

2 Likes

Thanks for the quick reply :slight_smile:

My initial idea was to have proper code cells in the side panel. I tried using Cursor for this, but it has no clue on how to do it, so I wondering what the right approach is. Should I have the side panel be a notebook class with cell objects in it? Similar to the main notebook panel?

If I do go the console path, how would I put a console in the side panel that is connected to the current kernel? Just a general outline to get me in the right direction would be greatly appreciated :pray: