Skip to content

Commit

Permalink
Merge pull request #5 from Zsailer/release-prep
Browse files Browse the repository at this point in the history
Port missing logic and get unit tests working
  • Loading branch information
Zsailer authored Feb 10, 2022
2 parents 4e3a0a8 + eb60fc2 commit 5b433fa
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
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

0 comments on commit 5b433fa

Please sign in to comment.