31

I leverage Docker containers to launch JupyterLabs and would like the ability to apply user settings directly at launch, instead of configuring user settings through the "Advanced Settings Editor" GUI at every container launch.

In reviewing the following pull request, it does seem that this functionality should exist: https://github.com/jupyterlab/jupyterlab/pull/2585

I have not found anything referencing this capability in the JupyterLab documentation, so any leads would be greatly appreciated!

Chris McPherson
  • 313
  • 1
  • 3
  • 6

4 Answers4

32

Running jupyter-lab --generate-config should generate a config file in /home/<USER>/.jupyter/jupyter_notebook_config.py

thinwybk
  • 4,193
  • 2
  • 40
  • 76
Zeke Arneodo
  • 664
  • 7
  • 14
  • 4
    above command is `jupyter lab ...` instead of `jupyter-lab ...` – Jean Monet Jun 21 '20 at 17:42
  • 1
    @ZekeArneodo, probably this deserves a new question, do you know how to use this file to import preferences in a new (different) jupyterlab? – Jason Angel Jul 19 '20 at 13:57
  • As of version 0.32.1 which is the one I have installed, if you port the files /home/$(whoami)/.jupyter/jupyter_notebook_config.py and /home/$(whoami)/.jupyter/jupyter_notebook_config.json (if exists), you will be porting the configuration, including the set password. If setting up a new install, I would probably run jupyter-lab --generate-config first, so it creates the default locations and config files and replace them with the ones to import. – Zeke Arneodo Jul 23 '20 at 21:52
  • 8
    This should not be the answer. config and settings are different. – Kermit Aug 05 '20 at 03:51
  • That is true! Sorry I thought the question was a different one, but there are no edits. So I just answered the wrong question. Should we delete this answer? – Zeke Arneodo Aug 11 '20 at 02:27
  • @JeanMonet `jupyter lab` and `jupyter-lab` are the same command – 蔡宗容 Aug 11 '22 at 06:44
  • @蔡宗容 incorrect. Please refer to the documentation: https://jupyterlab.readthedocs.io/en/stable/getting_started/starting.html#starting-jupyterlab – Jean Monet Aug 11 '22 at 13:29
  • @JeanMonet The doc you provided doesn't show anything about the differences between `jupyter lab` and `jupyter-lab`. When a user runs `jupyter lab ... `, it should be redirected to `jupyter-lab` where `lab` is a subcommand – 蔡宗容 Aug 17 '22 at 02:40
  • 1
    @JeanMonet the image https://i.imgur.com/273Z9hS.png shows the redirection from `jupyter lab ... ` to `jupyter-lab ... ` – 蔡宗容 Aug 17 '22 at 02:55
20

Settings for extensions are documented here:

https://jupyterlab.readthedocs.io/en/stable/user/extensions.html#settings

In short, you can supply and overrides.json in <sys-prefix>/share/jupyter/lab/settings where <sys-prefix> can be found by running jupyter lab path.

The example from the docs shows an overrides.json like this:

{
  "@jupyterlab/apputils-extension:themes": {
    "theme": "JupyterLab Dark"
  }
}
bsimpson53
  • 485
  • 5
  • 9
  • 2
    The key name of the dictionary entry is taken from the // commented-out header at the top of each section of Advanced Settings Editor. So for instance, to make a change to defaults of the Notebook section, e.g. turning on Record Timing for all users unless they turn it off... { "@jupyterlab/notebook-extension:tracker": { "recordTiming": true } } – Jeff Saxe Apr 20 '21 at 19:04
12

I couldn't find any documentations, however in your folder ~/.jupyter/lab/user-settings/@jupyterlab if you create a custom notebook configuration (for instance), you will have a file created in notebook-extension/tracker.jupyterlab-settings.

You can copy the folder(s) you want to use for each of your container in this location, then when you start a jupyter lab, you should see the custom configuration(s) loaded correctly.

Adonis
  • 4,670
  • 3
  • 37
  • 57
  • 1
    `jupyter lab path` does show this path. But I'm not sure where to put custom settings for jupyter lab extensions. For example `jupyterlab-execute-time` – Sida Zhou Apr 29 '20 at 04:06
  • 3
    This is exactly what I was searching for, too, how to make ExecuteTime's requirements (recordTiming) be on by default for all users, without each user having to make a one-time change in Advanced Settings. In our case, we're using The Littlest JupyterJub, so the path of the file described above by @bsimpson53 is `/opt/tljh/user/share/jupyter/lab/settings/overrides.json`. The folder `settings` may or may not exist, so you may have to `mkdir` that, and then create a file overrides.json inside it. `{ "@jupyterlab/notebook-extension:tracker": { "recordTiming": true } }` – Jeff Saxe Apr 20 '21 at 18:56
  • @JeffSaxe I have been absolutely losing my mind trying to figure out how to do this. Thank you so much! – mginn Apr 07 '23 at 02:04
0

In /usr/local/share/jupyter/lab/schemas/@jupyterlab, you can find all default settings.

And in notebook-extension/tracker.json, you can find the recordTiming.

Change the default value will help.

Simon Yang
  • 21
  • 2