Skip to content

Commit f182aec

Browse files
committed
Revert "Server extension paths (jupyter-server#730)"
This reverts commit 9711822.
1 parent 0fd5c7b commit f182aec

File tree

3 files changed

+8
-28
lines changed

3 files changed

+8
-28
lines changed

jupyter_server/extension/application.py

+2-19
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
from traitlets import default
1313
from traitlets import Dict
1414
from traitlets import HasTraits
15-
from traitlets import Instance
1615
from traitlets import List
1716
from traitlets import Unicode
1817
from traitlets.config import Config
@@ -104,7 +103,7 @@ def _prepare_templates(self):
104103
loader=FileSystemLoader(self.template_paths),
105104
extensions=["jinja2.ext.i18n"],
106105
autoescape=True,
107-
**self.jinja2_options,
106+
**self.jinja2_options
108107
)
109108

110109
# Add the jinja2 environment for this extension to the tornado settings.
@@ -163,12 +162,6 @@ class method. This method can be set as a entry_point in
163162
def _default_open_browser(self):
164163
return self.serverapp.config["ServerApp"].get("open_browser", True)
165164

166-
@property
167-
def config_file_paths(self):
168-
"""Look on the same path as our parent for config files"""
169-
# rely on parent serverapp, which should control all config loading
170-
return self.serverapp.config_file_paths
171-
172165
# The extension name used to name the jupyter config
173166
# file, jupyter_{name}_config.
174167
# This should also match the jupyter subcommand used to launch
@@ -207,17 +200,7 @@ def _default_url(self):
207200
]
208201

209202
# A ServerApp is not defined yet, but will be initialized below.
210-
serverapp = Instance(ServerApp)
211-
212-
@default("serverapp")
213-
def _default_serverapp(self):
214-
# load the current global instance, if any
215-
if ServerApp.initialized():
216-
return ServerApp.instance()
217-
else:
218-
# serverapp accessed before it was defined,
219-
# declare an empty one
220-
return ServerApp()
203+
serverapp = None
221204

222205
_log_formatter_cls = LogFormatter
223206

jupyter_server/serverapp.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@
104104
base_flags,
105105
base_aliases,
106106
)
107+
from jupyter_core.paths import jupyter_config_path
107108
from jupyter_client import KernelManager
108109
from jupyter_client.kernelspec import KernelSpecManager
109110
from jupyter_client.session import Session
@@ -2153,7 +2154,11 @@ def find_server_extensions(self):
21532154
# This enables merging on keys, which we want for extension enabling.
21542155
# Regular config loading only merges at the class level,
21552156
# so each level clobbers the previous.
2156-
manager = ExtensionConfigManager(read_config_path=self.config_file_paths)
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)
21572162
extensions = manager.get_jpserver_extensions()
21582163

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

tests/extension/test_app.py

-8
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,6 @@ def test_extensionapp_load_config_file(
6969
assert mock_extension.mock_trait == "config from file"
7070

7171

72-
def test_extensionapp_no_parent():
73-
# make sure we can load config files, even when serverapp is not passed
74-
# relevant for e.g. shortcuts to config-loading
75-
app = MockExtensionApp()
76-
assert isinstance(app.config_file_paths, list)
77-
assert app.serverapp is not None
78-
79-
8072
OPEN_BROWSER_COMBINATIONS = (
8173
(True, {}),
8274
(True, {"ServerApp": {"open_browser": True}}),

0 commit comments

Comments
 (0)