Show More
@@ -9,6 +9,7 b' from __future__ import print_function' | |||||
9 | import base64 |
|
9 | import base64 | |
10 | import datetime |
|
10 | import datetime | |
11 | import errno |
|
11 | import errno | |
|
12 | import importlib | |||
12 | import io |
|
13 | import io | |
13 | import json |
|
14 | import json | |
14 | import logging |
|
15 | import logging | |
@@ -709,6 +710,11 b' class NotebookApp(BaseIPythonApplication):' | |||||
709 | self.config.FileContentsManager.root_dir = new |
|
710 | self.config.FileContentsManager.root_dir = new | |
710 | self.config.MappingKernelManager.root_dir = new |
|
711 | self.config.MappingKernelManager.root_dir = new | |
711 |
|
712 | |||
|
713 | server_extensions = List(Unicode(), config=True, | |||
|
714 | help=("Python modules to load as notebook server extensions. " | |||
|
715 | "This is an experimental API, and may change in future releases.") | |||
|
716 | ) | |||
|
717 | ||||
712 | def parse_command_line(self, argv=None): |
|
718 | def parse_command_line(self, argv=None): | |
713 | super(NotebookApp, self).parse_command_line(argv) |
|
719 | super(NotebookApp, self).parse_command_line(argv) | |
714 |
|
720 | |||
@@ -916,6 +922,24 b' class NotebookApp(BaseIPythonApplication):' | |||||
916 | self.log.warn("components submodule unclean, you may see 404s on static/components") |
|
922 | self.log.warn("components submodule unclean, you may see 404s on static/components") | |
917 | self.log.warn("run `setup.py submodule` or `git submodule update` to update") |
|
923 | self.log.warn("run `setup.py submodule` or `git submodule update` to update") | |
918 |
|
924 | |||
|
925 | def init_server_extensions(self): | |||
|
926 | """Load any extensions specified by config. | |||
|
927 | ||||
|
928 | Import the module, then call the load_jupyter_server_extension function, | |||
|
929 | if one exists. | |||
|
930 | ||||
|
931 | The extension API is experimental, and may change in future releases. | |||
|
932 | """ | |||
|
933 | for modulename in self.server_extensions: | |||
|
934 | try: | |||
|
935 | mod = importlib.import_module(modulename) | |||
|
936 | func = getattr(mod, 'load_jupyter_server_extension', None) | |||
|
937 | if func is not None: | |||
|
938 | func(self) | |||
|
939 | except Exception: | |||
|
940 | self.log.warn("Error loading server extension %s", modulename, | |||
|
941 | exc_info=True) | |||
|
942 | ||||
919 | @catch_config_error |
|
943 | @catch_config_error | |
920 | def initialize(self, argv=None): |
|
944 | def initialize(self, argv=None): | |
921 | super(NotebookApp, self).initialize(argv) |
|
945 | super(NotebookApp, self).initialize(argv) | |
@@ -926,6 +950,7 b' class NotebookApp(BaseIPythonApplication):' | |||||
926 | self.init_webapp() |
|
950 | self.init_webapp() | |
927 | self.init_terminals() |
|
951 | self.init_terminals() | |
928 | self.init_signal() |
|
952 | self.init_signal() | |
|
953 | self.init_server_extensions() | |||
929 |
|
954 | |||
930 | def cleanup_kernels(self): |
|
955 | def cleanup_kernels(self): | |
931 | """Shutdown all kernels. |
|
956 | """Shutdown all kernels. |
General Comments 0
You need to be logged in to leave comments.
Login now