How to access default paths from within the JupyterLab client (solved)

Say a user starts JupyterLab by executing jupyter lab from /Users/username/home. Call this path launch.

If they have c.NotebookApp.notebook_dir set to /Users/username/home/code, their lab should start up directed to /Users/username/home/code.

Running jupyter lab paths will list the application, user settings, and workspace directories, which don’t necessarily reside along the launch or notebook_dir paths.

Is there any way to get any of these paths (launch, notebook_dir, application, user-settings, workspace) programatically inside the client code without talking to a custom backend, eg., from an extension?

Turns out these sorts of things can be exposed via PageConfig from '@jupyterlab/coreutils'

Here the PageConfig is in the source.

For example, launch can be accessed via PageConfig.getOption('serverRoot').

This section of the source code shows how to access a bunch of the default paths.

1 Like