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:
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.
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!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With