-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Hook to add alternative notebook managers #2155
Changes from all commits
43bd4e5
ed770d0
89b4dd7
a311548
b32ac6d
c749daf
c90b6b0
079f8ed
131d891
05153e7
267b4c8
aadce0a
1d19c4d
583d3f0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -227,6 +227,7 @@ def __init__(self, ipython_app, kernel_manager, notebook_manager, | |
aliases = dict(ipkernel_aliases) | ||
|
||
aliases.update({ | ||
'nbmgr': 'NotebookApp.nbmgr', | ||
'ip': 'NotebookApp.ip', | ||
'port': 'NotebookApp.port', | ||
'port-retries': 'NotebookApp.port_retries', | ||
|
@@ -241,7 +242,7 @@ def __init__(self, ipython_app, kernel_manager, notebook_manager, | |
aliases.pop('f', None) | ||
|
||
notebook_aliases = [u'port', u'port-retries', u'ip', u'keyfile', u'certfile', | ||
u'notebook-dir'] | ||
u'notebook-dir', u'nbmgr'] | ||
|
||
#----------------------------------------------------------------------------- | ||
# NotebookApp | ||
|
@@ -277,6 +278,9 @@ class NotebookApp(BaseIPythonApplication): | |
# file to be opened in the notebook server | ||
file_to_run = Unicode('') | ||
|
||
# Which alternative NotebookManager to use | ||
nbmgr = Unicode(u'', config=True, help="""Alternative notebook manager module""") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. let's follow conventions and call this notebook_manager_class There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note there's also a more specific trait for this sort of thing - |
||
|
||
# Network related information. | ||
|
||
ip = Unicode(LOCALHOST, config=True, | ||
|
@@ -430,7 +434,14 @@ def init_configurables(self): | |
config=self.config, log=self.log, kernel_argv=self.kernel_argv, | ||
connection_dir = self.profile_dir.security_dir, | ||
) | ||
self.notebook_manager = NotebookManager(config=self.config, log=self.log) | ||
|
||
# added option to load alternative notebook | ||
if self.nbmgr and self.nbmgr != "": | ||
loader = __import__(self.nbmgr, globals(), locals(), ['get_notebook_manager'], -1) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. use utils.import_string, as elsewhere. And the default should be set in the notebook_manager_class default value. |
||
self.notebook_manager = loader.get_notebook_manager() | ||
else: | ||
self.notebook_manager = NotebookManager(config=self.config, log=self.log) | ||
|
||
self.log.info("Serving notebooks from %s", self.notebook_manager.notebook_dir) | ||
self.notebook_manager.list_notebooks() | ||
self.cluster_manager = ClusterManager(config=self.config, log=self.log) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this should get an alias. Remember, everything is always available at the command-line, even without aliases as: