Customizing JupyterLab Launcher
Asked Answered
V

1

11

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.

Vowel answered 11/10, 2019 at 16:5 Comment(1)
I ended up writing a TSX snippet and injecting it into the minified vendors~main.xxx.js file via sed. Next question: How do I get this past a code review? cryingVowel
H
7

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!

Howl answered 28/9, 2021 at 7:11 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.