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

patch server's sorted_extensions to prioritize nbclassic #56

Merged
merged 1 commit into from
May 20, 2021
Merged
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
17 changes: 17 additions & 0 deletions nbclassic/nbserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,23 @@ def _link_jupyter_server_extension(serverapp):
manager = serverapp.extension_manager
logger = serverapp.log

# Hack that patches the enabled extensions list, prioritizing
# jupyter nbclassic. In the future, it would be much better
# to incorporate a dependency injection system in the
# Extension manager that allows extensions to list
# their dependency tree and sort that way.
def sorted_extensions(self):
"""Dictionary with extension package names as keys
and an ExtensionPackage objects as values.
"""
# Sort the keys and
keys = sorted(self.extensions.keys())
keys.remove("nbclassic")
keys = ["nbclassic"] + keys
return {key: self.extensions[key] for key in keys}

manager.__class__.sorted_extensions = property(sorted_extensions)

# Look to see if nbclassic is enabled. if so,
# link the nbclassic extension here to load
# its config. Then, port its config to the serverapp
Expand Down