-
Notifications
You must be signed in to change notification settings - Fork 5.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
merge nbserver_extensions #2108
Conversation
Load with ConfigManager so that merge happens recursively, unlike normal config values. Makes loading more consistent with frontend extensions, but is a bit icky because the same files are loaded and read twice, and one key in a traitlets-defined config file is loaded differently than all others. This does behave more like we intend and people expect for extensions, though.
and refactor mock test environment a bit ensures no system config files loaded or affected
- unused imports - call jupyter_path instead of reimplementing it
75df326
to
e70e7be
Compare
notebook/notebookapp.py
Outdated
# This enables merging on keys, which we want for extension enabling,. | ||
# Regular config loading only merges at the class level, | ||
# so each level (use > env > system) clobbers the previous. | ||
manager = ConfigManager(read_config_path=jupyter_config_path()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will not pick up any overrides given to the NotebookApp
- config_file_name
, config_dir
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call, and further evidence that this is possibly too fiddly to be worth doing in-place.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should work with config_dir and config_file_name now, good catch.
could be important for subclasses
notebook/notebookapp.py
Outdated
if self.nbserver_extensions[modulename]: | ||
|
||
# Load server extensions with ConfigManager. | ||
# This enables merging on keys, which we want for extension enabling,. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extra comma at the end
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed.
notebook/notebookapp.py
Outdated
# Load server extensions with ConfigManager. | ||
# This enables merging on keys, which we want for extension enabling,. | ||
# Regular config loading only merges at the class level, | ||
# so each level (use > env > system) clobbers the previous. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
User*
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
r'd
Thanks Steve ! |
@minrk @Carreau @blink1073 This was supposed to merge nbserver_extensions for |
Looking down the rabbit hole it looks like it only applies to |
Thanks @blink1073! Was that done on purpose ? Any reason the notebook doesn't do the merge for nbserver_extensions in |
I'm not sure if that was a conscious decision historically or not, @minrk would be the best person to know for sure. |
.py config files also already have a clearer, explicit merge mechanism, so shouldn't have to get mixed up in this: c.Class.trait.update({'x': 5}) # update existing config, if any
# vs
c.Class.trait = {'x': 5} # override |
Thanks @minrk |
Load with ConfigManager so that merge happens recursively, unlike normal config values.
Makes loading more consistent with frontend extensions, which is good.
It is a bit icky because the same files are loaded and read twice, and one key in a traitlets-defined config file is loaded differently than all others.
This does behave more like we intend and people expect for extensions, though.
closes #2063