Skip to content

Commit

Permalink
make server_extension_path an overrideable property
Browse files Browse the repository at this point in the history
matches nbextension_path, etc. from NotebookApp

This should be overridden when disabling user config in JupyterHub
  • Loading branch information
minrk committed Mar 10, 2022
1 parent 426a4c6 commit aa1003b
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions jupyter_server/serverapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -2139,6 +2139,15 @@ def init_components(self):
# TODO: this should still check, but now we use bower, not git submodule
pass

@property
def server_extension_path(self):
"""Path to search for server extension config"""
config_path = jupyter_config_path()
if self.config_dir not in config_path:
# add self.config_dir to the front, if set manually
config_path.insert(0, self.config_dir)
return config_path

def find_server_extensions(self):
"""
Searches Jupyter paths for jpserver_extensions.
Expand All @@ -2154,11 +2163,7 @@ def find_server_extensions(self):
# This enables merging on keys, which we want for extension enabling.
# Regular config loading only merges at the class level,
# so each level clobbers the previous.
config_paths = jupyter_config_path()
if self.config_dir not in config_paths:
# add self.config_dir to the front, if set manually
config_paths.insert(0, self.config_dir)
manager = ExtensionConfigManager(read_config_path=config_paths)
manager = ExtensionConfigManager(read_config_path=self.server_extension_path)
extensions = manager.get_jpserver_extensions()

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

0 comments on commit aa1003b

Please sign in to comment.