How do I spawn template of my .ipynb file to each user once they login?

Basically, What I want is I want to share a template notebook with each user. Once the user is logged in the notebook should be visible on his workspace.

I have tried configuring with c.Spawner.args in the jupyterhub_configuration.py file but did not work for me. If this c.Spawner.args can be used then what should be the location of the file which is accessible by each user?

Thanks in advance.

Can you share what you mean by “template notebook” ? Detailing the exact user experience that you want , might help.

“template notebook” means a notebook file (with an extension of .ipynb) that should be displayed to each user on their workbook area.

For example, I have a template notebook as param-test.ipynb file inside the admin (as a user), the same file should be displayed on each user once they log in.

You will have to create a custom ContentsManager and override the method “new”. In that method you can check the “kernel” that the new notebook would be associated with and accordingly provide a default notebook JSON , that will be used as in the “Untitled.ipynb” .

…should be displayed on each user once they log in.
By default, JupyterLab shows all Kernel types on right side. When a user clicks on a kernel, you can check the kernel type (in “new” method detailed above) and accordingly provide a default JSON. This, in effect does what you want, - user clicks on an icon and gets to see the notebook that have as template. Just that, there’s no separate icon for your notebook, its an icon of your kernel.

1 Like