Skip to content

Commit 653740c

Browse files
authored
Re-use ServerApp.config_file_paths for consistency (#715)
* Use app.config_file_path to find server extensions This property in the base class already has the same logic to add config_dir to jupyter_config_path JupyterHub overrides this to have slightly different logic, and the same should apply here * extensions should inherit parent's config_file_path base ServerApp should have total control over config file loading
1 parent 426a4c6 commit 653740c

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

jupyter_server/extension/application.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,11 @@ class method. This method can be set as a entry_point in
162162
def _default_open_browser(self):
163163
return self.serverapp.config["ServerApp"].get("open_browser", True)
164164

165+
@property
166+
def config_file_paths(self):
167+
"""Look on the same path as our parent for config files"""
168+
return self.serverapp.config_file_paths
169+
165170
# The extension name used to name the jupyter config
166171
# file, jupyter_{name}_config.
167172
# This should also match the jupyter subcommand used to launch

jupyter_server/serverapp.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@
104104
base_flags,
105105
base_aliases,
106106
)
107-
from jupyter_core.paths import jupyter_config_path
108107
from jupyter_client import KernelManager
109108
from jupyter_client.kernelspec import KernelSpecManager
110109
from jupyter_client.session import Session
@@ -2154,11 +2153,7 @@ def find_server_extensions(self):
21542153
# This enables merging on keys, which we want for extension enabling.
21552154
# Regular config loading only merges at the class level,
21562155
# so each level clobbers the previous.
2157-
config_paths = jupyter_config_path()
2158-
if self.config_dir not in config_paths:
2159-
# add self.config_dir to the front, if set manually
2160-
config_paths.insert(0, self.config_dir)
2161-
manager = ExtensionConfigManager(read_config_path=config_paths)
2156+
manager = ExtensionConfigManager(read_config_path=self.config_file_paths)
21622157
extensions = manager.get_jpserver_extensions()
21632158

21642159
for modulename, enabled in sorted(extensions.items()):

0 commit comments

Comments
 (0)