From 636b1fce50f89be6bb20c39a64f2030f44e1bad9 Mon Sep 17 00:00:00 2001 From: RRosio Date: Mon, 16 Oct 2023 10:37:21 -0700 Subject: [PATCH 1/3] update import for backwards compatibility --- src/jupyter_nbextensions_configurator/__init__.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/jupyter_nbextensions_configurator/__init__.py b/src/jupyter_nbextensions_configurator/__init__.py index 7a39289..c055243 100644 --- a/src/jupyter_nbextensions_configurator/__init__.py +++ b/src/jupyter_nbextensions_configurator/__init__.py @@ -14,9 +14,16 @@ import re import yaml -from jupyter_server.base.handlers import APIHandler, JupyterHandler -from jupyter_server.utils import url_path_join as ujoin -from jupyter_server.utils import path2url +try: + from notebook.base.handlers import APIHandler + from notebook.base.handlers import IPythonHandler as JupyterHandler + from notebook.utils import url_path_join as ujoin + from notebook.utils import path2url +except ModuleNotFoundError as e: + from jupyter_server.base.handlers import APIHandler, JupyterHandler + from jupyter_server.utils import url_path_join as ujoin + from jupyter_server.utils import path2url + from notebook._version import version_info as nb_version_info from tornado import web From 1f6e77e7b389087c987551dab30a277cdb3cb2de Mon Sep 17 00:00:00 2001 From: RRosio Date: Mon, 16 Oct 2023 11:33:21 -0700 Subject: [PATCH 2/3] comment on use of Notebook < 7 handlers --- src/jupyter_nbextensions_configurator/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/jupyter_nbextensions_configurator/__init__.py b/src/jupyter_nbextensions_configurator/__init__.py index c055243..85db2b5 100644 --- a/src/jupyter_nbextensions_configurator/__init__.py +++ b/src/jupyter_nbextensions_configurator/__init__.py @@ -16,6 +16,7 @@ import yaml try: from notebook.base.handlers import APIHandler + # When Notebook < 7 is available, the import the Notebook handlers from notebook.base.handlers import IPythonHandler as JupyterHandler from notebook.utils import url_path_join as ujoin from notebook.utils import path2url From 560bea3308bc2d977cff428ab51110a3f274a0c4 Mon Sep 17 00:00:00 2001 From: RRosio Date: Tue, 31 Oct 2023 07:32:38 -0700 Subject: [PATCH 3/3] move print statement --- src/jupyter_nbextensions_configurator/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/jupyter_nbextensions_configurator/__init__.py b/src/jupyter_nbextensions_configurator/__init__.py index 85db2b5..0e1bf45 100644 --- a/src/jupyter_nbextensions_configurator/__init__.py +++ b/src/jupyter_nbextensions_configurator/__init__.py @@ -15,8 +15,8 @@ import yaml try: - from notebook.base.handlers import APIHandler # When Notebook < 7 is available, the import the Notebook handlers + from notebook.base.handlers import APIHandler from notebook.base.handlers import IPythonHandler as JupyterHandler from notebook.utils import url_path_join as ujoin from notebook.utils import path2url