Passing configuration to jupyter_config.py

I’m using nb_conda_kernels in my baremetal JupyterHub environment and it’s all good. Now I want to add some configuration to that package and, according to its official documentation, this can be done by changing the jupyter_config.py file:

To set it in jupyter config file, edit the jupyter configuration file (py or json) located in your jupyter --config-dir

  • for jupyter_config.py - add a line “c.CondaKernelSpecManager.env_filter = ‘regex’”

The actual configuration I want to apply is c.CondaKernelSpecManager.name_format = "{language} [{environment}]. I added this line to my jupyterhub_config.py but it didn’t work. Is there a way to pass configuration lines that were originally aimed to be in the jupyter_config.py in JupyterHub?

I think you’ll have to put the configuration in a file that JupyterLab/notebook can find, e.g. in your user’s home directory. JupyterHub only handles authentication and starting/stopping your singleuser server.

1 Like

I’ve found the official docs on this:

Jupyter and IPython support “system-wide” locations for configuration, which is the logical place to put global configuration that you want to affect all users. It’s generally more efficient to configure user environments “system-wide”, and it’s a good idea to avoid creating files in users’ home directories.

The typical locations for these config files are:

  • system-wide in /etc/{jupyter|ipython}
  • env-wide (environment wide) in {sys.prefix}/etc/{jupyter|ipython} .

Putting my jupyter_config.py into /etc/jupyter did the trick.