From 72a85fe1891ce171d99a5d6646344d27df034d9c Mon Sep 17 00:00:00 2001 From: Matthias Bussonnier Date: Tue, 2 Aug 2016 14:03:46 -0700 Subject: [PATCH] Load extension in predictable order. Not doing this can lead to subtle incomprehensible issues when 2 extensions (eg, jupyterlab and jupyterlab_extensions) both register the same handlers, that will randomly at each start get a different extension take precedence. --- notebook/notebookapp.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/notebook/notebookapp.py b/notebook/notebookapp.py index a0972475c..d13d9be8a 100644 --- a/notebook/notebookapp.py +++ b/notebook/notebookapp.py @@ -902,7 +902,8 @@ class NotebookApp(JupyterApp): nbserver_extensions = Dict({}, config=True, help=("Dict of Python modules to load as notebook server extensions." "Entry values can be used to enable and disable the loading of" - "the extensions.") + "the extensions. The extensions will be loaded in alphabetical " + "order.") ) reraise_server_extension_failures = Bool( @@ -1156,7 +1157,7 @@ class NotebookApp(JupyterApp): if not modulename in self.nbserver_extensions: self.nbserver_extensions[modulename] = True - for modulename in self.nbserver_extensions: + for modulename in sorted(self.nbserver_extensions): if self.nbserver_extensions[modulename]: try: mod = importlib.import_module(modulename)