Create a launcher in Jupyter lab to open a specific url

I have a number of launchers setup for jupyterlab and they work fine (jupyter-server-proxy). Now I want to add a launcher to take the user to a specific url (e.g., google.com). I tried various approach to get this to work without success. My last attempt is shown below.

I’d expect this to be very simple but I’m obviously missing something. Any suggestions?

def _help_command():
    full_path = shutil.which("python3")
    url = "https://www.google.com"
    return [full_path, "-c", f"from webbrowser import open_new; open_new(\"{url}\")"]
 
c.ServerProxy.servers = {
    "help": {
        "command": _help_command
    }
}

jupyter-server-proxy is designed for proxying network services, it’s not a generic manager for JupyterLab launchers. What you want should be possible using a simple JupyterLab extension (maybe there’s one already?), perhaps the JupyterLab maintainers can suggest something?

Thanks for the reply @manics. I found the following repo but the extension is not compatible with recent version of JupyterLab.

2 Likes