Skip to content

Unify behavior of server/nb extensions enabling, user vs sys.prefix #1508

@bollwyvl

Description

@bollwyvl

Users are encountering exciting conditions with the extension enabling behavior.

We encountered that here where we have basically had to say rm -rf ~/.jupyter.

The behavior of both the nbextensions and the serverextensions are surprising.

nbextensions: user and sys-prefix merge, but sys-prefix wins

$ jupyter nbextension enable thisthing --py --sys-prefix
$ jupyter nbextension enable thisotherthing --py --sys-prefix
$ jupyter nbextension disable thisthing --py
$ curl /api/config/notebook
{"this-thing/main": true, "this-other-thing/main": true}
$ jupyter nbextension enable this-thing --py
$ jupyter nbextension disable this-thing --py --sys-prefix
$ curl /api/config/notebook
{}

Good

  • merging works (of enabling)

Bad

  • user loses

potential fixes

# traitlets/config/manager.py
def recursive_update(target, new):
   ...
   if not target[k] is None: # was not updating with 'false' before
   ...

# notebook/services/config/manager.py
class ConfigManager(LoggingConfigurable):
    def get(self, section_name):
        for p in self.read_config_path[::-1]: # previously reading in reverse order

serverextensions: ~/.jupyter conquers all

$ jupyter serverextension enable this-thing --py --sys-prefix
$ jupyter serverextension enable this-other-thing --py --sys-prefix
$ jupyter serverextension disable this-thing --py
$ jupyter notebook
Collisions detected in jupyter_notebook_config.py and jupyter_notebook_config.json config files. jupyter_notebook_config.json has higher priority: {
      "NotebookApp": {
        "nbserver_extensions": "{'this-thing': True, 'this-other-thing': True} ignored, using {'this-thing': False}"
      }
    }

Good

  • user wins!

Bad

  • no merge

potential fixes

# notebook/services/config/manager.py
def _ensure_subconfig(self):
   ...
   if isinstance(obj, dict) \ # _is_section_key(key)
                    and not isinstance(obj, Config):

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions