Loading extension into running JupyterLab through JavaScript API: is it possible?

Hello.
I have a pretty strange requirement: I have a JupyterLab running in the browser (I didn’t start it, I just have a URL) and I want to use it to render notebooks and get output.

Is it possible to do the following:
Load my extension into the running JupyterLab using JS API (I have a programming access to the JS console via browser API). This extension will then open notebook using IDocumentManager, execute it, obtain output offset so I can read screenshot from browser etc.

Extension is pure JS of course.
Thank you

There is no API at the lumino.Application level that permits registering full dynamic extensions (e.g. with settings, can be dependend upon by other extensions, etc.)

There is intentionally less API surface area than e.g. the jQuery notebook, unless the developer-mode --expose-app-in-browser CLI argument or equivalent is applied.

There is however the user-facing Extension Manager, which can install extensions, provided pip (in Lab 4) and/or nodejs (in Lab 3) is on $PATH for the server. It might be possible to achieve this by emulating .click events, etc. at the JS level, and then reloading the page (provided the extension doesn’t have server components)

1 Like