Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Customizing JupyterLab Launcher

I'd like to add some custom content in my JupyterLab Launcher. This is the first page that new users see and I want to tell them about specifics of this environment and link to stuff. Kind of like this:

Illustration with new section in launcher

The Launcher's code is simple, and I can modify it to my liking. But I have trouble with applying the changes.

This is a JupyterHub environment (zero-to-jupyterhub-k8s) with a custom singleuser image that is derived from jupyter/datascience-notebook.

The launcher is not a normal labextension. Can I make an extension to replace it anyway? Or should I try to patch in my changes somewhere? Where? I can't even find the Launcher's code inside the image.

like image 275
Daniel Darabos Avatar asked Oct 11 '19 16:10

Daniel Darabos


1 Answers

I needed a similar solution and found the answer at the elyra-ai/elyra project!

What you need to do is to extend the main Launcher as it is done on Elyra's theme pacakge - packages/theme/src/launcher.tsx and then and the bottom of that file add your HTML fixes, should be looking something like this (launcher.tsx):

...
     return (
      <div className="jp-Launcher-body">
        <div className="jp-Launcher-content">
          <div className="jp-Launcher-cwd">
            <h3>Welcome! Here are few tips: ....</h3>
          </div>
          {categories}
        </div>
      </div>
    );
...

Keep in mind that there is an additional setup in order for this to work. Mainly - you need to disable the main jupyter launcher. In a command line it is simple:

jupyter labextension disable @jupyterlab/launcher-extension

However, you most likelly need to install this as a JupyterLab extension, so you have to disable the extension via page settings - this is what Elyra did:

{
  "disabledExtensions": ["@jupyterlab/launcher-extension"]
}

The last part is something where you can make a lot of tiny mistakes (forget to add it to setup.py data files, forget it on MANIFEST.in and etc). So I recommend to follow the original commit

Good luck, and big thanks to Elyra team!

like image 195
The Hog Avatar answered Sep 19 '22 10:09

The Hog