Can I start a Jupyter Lab with some preset examples for user to use?

I maintain an app on Open Ondemand for users to start Jupyter Lab on HPC cluster. Recently I get a request from users, they hope that when they start Jupyter Lab they can have some preset notebooks to get started with, instead of writing notebook from scratch.

I think one of the good place to put those example notebooks is launching page but I don’t know if it is possible. Or is there other solutions to fullfill the users’ requirement? Thank you.

If you own the environment, you can create a default, and any number of custom workspaces, and put them in a well-known location:

This includes any open documents, such as notebooks, as well as sidebar settings, etc.

There are probably other tricks that could be used, but this is generally the most robust.

1 Like

I am not sure if I understand it correctly. Do you mean I can have a folder, for example /share/notebooks, to host sample notebooks. And then I can create a workspace with those notebooks opened?

Yes, any contents would need to be in a predictable place, with respect to the notebook_dir (usually the directory with jupyter lab or jupyter notebook is started).

Then, once the structure is well-defined (perhaps as exported with the File → Save Current Workspace As)

jupyter workspace import my-workspace.workspace

For an example, see:

Note: without knowing a lot more about the specific deployment: doing this every the time, means that a user would lose their ability to save have their specific workspace loaded, potentially, which might be frustrating.

Another approach is to use the relatively simple /lab/tree/path/to/Notebook.ipynb URL pattern, however the system is handling redirects.