jupyter_client
jupyter_client copied to clipboard
JUPYTER_CONFIG_DIR is ignored
https://jupyter.readthedocs.io/en/latest/projects/jupyter-directories.html
Claims that jupyter_notebook_config.py is read from that directory. I would expect if it works for one jupyter command (notebook) it would work for all of them.... especially since there are KernelSpec parameters in there.
It definitely doesn't not pick up the config file from that directory for jupyter kernelspec list
In fact... I just grepped in my Venv that I run jupyter notebooks out of and I didn't find a single instance of jupyter_notebook_config.py or JUPYTER_CONFIG_DIR anywhere in code, directory structure or anything. I'm left puzzled as to how this works at all.
Happily I can pass the config file in via --config=
Hi @lramey. The configuration file that jupyter applications read (and locate using the path hierarchy) is a function of the application's name attribute. Each application subclasses JupyterApp and, typically, uses a different value for name - the default being jupyter. The path magic occurs in functions of jupyter_core's path module.
Notebook sets its name value to jupyter-notebook - which then yields jupyter_notebook_config as the configuration file "prefix" to look for. I believe both .py and .json extensions are checked, but I'm not sure if that's unconditional.
The kernelspec application is actually built using sub-commands - each of which is its own JupyterApp subclass. The kernelspec application itself derives from the Application traitlet class - which is also the superclass of JupyterApp - and launches the appropriate sub-command JupyterApp instance depending on the command-line options. It uses a name attribute of jupyter kernelspec.
In the case of jupyter kernelspec list, the launched JupyterApp is ListKernelSpecs. However, during that class instantiation, the name attribute from KernelSpecApp is set into the attributes of ListKernelSpecs (I believe via traitlet instantiation magic - probably somewhere here). As a result, any of the command line options of jupyter kernelspec will wind up looking for a configuration file named jupyter_kernelspec_config.
I'm sorry if this was too much information, but I figure it's best to err on that side than too little.
I knew all of that except the last paragraph. :)
So... working as intended then?
Should I just set JUPYTER_KERNELSPEC_CONFIG and proceed?
Sorry about the TMI. :smile:
Yes, my understanding is that things are working and adding your applicable config to jupyter_kernelspec_config.{py,json} is the thing to try.
ohhh... its not the Env var name its the file name? OK.
I don't mind the brain dump... I wish it was in the docs. :)