Skip to content

Commit

Permalink
Merge pull request #56 from Zsailer/nbclassic-first
Browse files Browse the repository at this point in the history
patch server's sorted_extensions to prioritize nbclassic
  • Loading branch information
blink1073 authored May 20, 2021
2 parents d0adc1d + d1f6fbc commit 0df2d33
Showing 1 changed file with 17 additions and 0 deletions.
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

0 comments on commit 0df2d33

Please sign in to comment.