Jupyterlab Extensions + Retrolab tree view/terminal view

I have an extension that adds a top menu bar item in Jupyterlab. It works as expected in JupyterLab but in RetroLab I do not want it to appear in the “/tree” view or “/terminal” view for example. I don’t want to do this based of URL so I was wondering if there is an easy way to tell.

I have tried checking if the notebookTracker is defined as that was a suggestion I had seen elseware, but on tree view and terminal view, it is still defined in RetroLab. I want to sort this out before NotebookV7 comes out if possible so my extension is just ready to roll from the get go. Any help would be greatly appreciated.

In retrolab, it relies on the retroPage value in jupyter-config-data (accessible with PageConfig.getOption).

In looks like this has been renamed to notebookPage. So probably just checking both, and skipping if either is non-null, would work for both.

1 Like

Ugh…I wish there were a less Retro/V7 specific way to do this like detecting that something wasn’t present in the UI because now I have to figure out all the possible pages in retro that I want to exclude. I mean, it works, but, at what cost?
FWIW - I now check if retroPage is set, then check notebookPage if not, and then make sure it isn’t “tree” “consoles” nor “terminals” for now. That covers most of the use case

Well, now would be the time for that information to be hoisted: issue up on notebook if you have a good idea.

But I don’t see how it would be able to know much without knowing something about the top-level app architecture… and being able to pull it from the same configuration source tastes pretty good. At present, those values aren’t extensible by third parties, so they are really the best we have.

We could make a third-party extension that at least isolated these, but that feels rather heavy.

I had made an argument for more of a schema-based approach, which declared concretely what features a given shell (and woudl translate to e.g. a terminal-based application) had… but it gets tiring fighting for such things.

1 Like

Linking to this issue as somewhat related: Improve the loading of extensions in `index.js` · Issue #225 · jupyterlab/retrolab · GitHub

Agree this could be improved, and a schema-based approach would be ideal. Not sure there will be bandwidth to work on this for Notebook 7.0 (although it would be great), but something that should definitely be considered for future iterations.

Also the RetroLab issues will soon be moved to the jupyter/notebook repo.

1 Like