Skip to content
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

Port missing logic and get unit tests working #5

Merged
merged 2 commits into from
Feb 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions notebook_shim/nbserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,21 @@ def sorted_extensions(self):
config_dirs = jupyter_paths + [serverapp.config_dir]
nbserver_extensions = get_nbserver_extensions(config_dirs)

# Link all extensions found in the old locations for
# notebook server extensions.
for name, enabled in nbserver_extensions.items():
# If the extension is already enabled in the manager, i.e.
# because it was discovered already by Jupyter Server
# through its jupyter_server_config, then don't re-enable here.
if name not in manager.extensions:
successful = manager.add_extension(name, enabled=enabled)
if successful:
logger.info(
"{name} | extension was found and enabled by notebook_shim. "
"Consider moving the extension to Jupyter Server's "
"extension paths.".format(name=name)
)
manager.link_extension(name)

def _load_jupyter_server_extension(serverapp):
# Patch the config service manager to find the
Expand Down
2 changes: 1 addition & 1 deletion notebook_shim/tests/mockextension.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
def _jupyter_server_extension_points():
return [
{
"module": "notebook_shim.tests.shim.mockextension",
"module": "notebook_shim.tests.mockextension",
"app": MockExtensionApp
}
]
Expand Down
2 changes: 1 addition & 1 deletion notebook_shim/tests/test_extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def jp_server_config():
"ServerApp": {
"jpserver_extensions": {
"notebook_shim": True,
"notebook_shim.tests.shim.mockextension": True
"notebook_shim.tests.mockextension": True
}
}
}
Expand Down