From 210fcec432fd85f46d7715b08955ac433919bf97 Mon Sep 17 00:00:00 2001 From: yacchin1205 <968739+yacchin1205@users.noreply.github.com> Date: Tue, 30 May 2023 19:42:23 +0900 Subject: [PATCH 1/3] Fix base handler for jupyter_server and compatibility for nbclassic --- Dockerfile | 15 ++++++++++----- nbtags/_version.py | 2 +- nbtags/handler.py | 11 +++++------ nbtags/nbextension/main.yml | 3 ++- nbtags/nbextension/tree.yml | 3 ++- 5 files changed, 20 insertions(+), 14 deletions(-) diff --git a/Dockerfile b/Dockerfile index 2059fa2..666f1fd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM jupyter/scipy-notebook +FROM jupyter/scipy-notebook:latest USER root @@ -16,8 +16,13 @@ RUN mkdir /opt/nbtags && \ chmod +x /usr/local/bin/before-notebook.d/*.sh USER $NB_UID -RUN jupyter nbextensions_configurator enable --user && \ - jupyter nbextension install --py --user nbtags && \ - jupyter serverextension enable --py --user nbtags && \ - jupyter nbextension enable --py --user nbtags && \ +RUN jupyter nbclassic-extension install --py jupyter_nbextensions_configurator --user && \ + jupyter nbclassic-extension enable --py jupyter_nbextensions_configurator --user && \ + jupyter nbclassic-serverextension enable --py jupyter_nbextensions_configurator --user && \ + jupyter nbclassic-extension install --py --user nbtags && \ + jupyter nbclassic-serverextension enable --py --user nbtags && \ + jupyter nbclassic-extension enable --py --user nbtags && \ jupyter nblineage quick-setup --user + +# Make classic notebook the default +ENV DOCKER_STACKS_JUPYTER_CMD=nbclassic \ No newline at end of file diff --git a/nbtags/_version.py b/nbtags/_version.py index 53f025b..ffeb5e8 100644 --- a/nbtags/_version.py +++ b/nbtags/_version.py @@ -1,2 +1,2 @@ -version_info = (0, 1, 0, 'dev1') +version_info = (0, 2, 0, 'dev1') __version__ = '.'.join(map(str, version_info)) diff --git a/nbtags/handler.py b/nbtags/handler.py index bfafc23..4f17cbb 100644 --- a/nbtags/handler.py +++ b/nbtags/handler.py @@ -1,12 +1,11 @@ -from notebook.base.handlers import IPythonHandler +from jupyter_server.base.handlers import APIHandler, JupyterHandler from tornado import web import json -import itertools import re from nbtags.scrapbox import ScrapboxAPI -class TagsHandler(IPythonHandler): +class TagsHandler(APIHandler): def initialize(self, nb_app): self.nb_app = nb_app @@ -96,7 +95,7 @@ def _has_code(self, text): return text.startswith('code:cell.') or text.strip() == 'code:toc.md' -class CellCreateURLHandler(IPythonHandler): +class CellCreateURLHandler(JupyterHandler): def initialize(self, nb_app): self.nb_app = nb_app @@ -134,7 +133,7 @@ def _get_content(self, cell): return '' -class NotebookCreateURLHandler(IPythonHandler): +class NotebookCreateURLHandler(JupyterHandler): def initialize(self, nb_app): self.nb_app = nb_app @@ -159,7 +158,7 @@ def _get_content(self, toc): return 'code:toc.md\n' + '\n'.join([' ' + l for l in toc]) -class NotebookMemeHandler(IPythonHandler): +class NotebookMemeHandler(APIHandler): def initialize(self, nb_app): self.nb_app = nb_app diff --git a/nbtags/nbextension/main.yml b/nbtags/nbextension/main.yml index cb00180..4e7d5b2 100644 --- a/nbtags/nbextension/main.yml +++ b/nbtags/nbextension/main.yml @@ -5,4 +5,5 @@ Description: "Sticky Note for Jupyter Notebook" Link: README.md Icon: main.png Main: main.js -Compatibility: 5.x 6.x +# 1.x means nbclassic - leave 6.x in place just in case. +Compatibility: 1.x 6.x diff --git a/nbtags/nbextension/tree.yml b/nbtags/nbextension/tree.yml index f466b5c..fa8084b 100644 --- a/nbtags/nbextension/tree.yml +++ b/nbtags/nbextension/tree.yml @@ -5,4 +5,5 @@ Description: "Sticky Note for Jupyter Notebook" Link: README.md Icon: tree.png Main: tree.js -Compatibility: 5.x 6.x +# 1.x means nbclassic - leave 6.x in place just in case. +Compatibility: 1.x 6.x From 04c40c680873f656a2d45aaf502d00d6fd562611 Mon Sep 17 00:00:00 2001 From: yacchin1205 <968739+yacchin1205@users.noreply.github.com> Date: Tue, 30 May 2023 19:43:27 +0900 Subject: [PATCH 2/3] Fix whitespaces --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 666f1fd..6db632e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -25,4 +25,4 @@ RUN jupyter nbclassic-extension install --py jupyter_nbextensions_configurator - jupyter nblineage quick-setup --user # Make classic notebook the default -ENV DOCKER_STACKS_JUPYTER_CMD=nbclassic \ No newline at end of file +ENV DOCKER_STACKS_JUPYTER_CMD=nbclassic From c5978ec12798ac9bb85607f3bddbc70a2b221819 Mon Sep 17 00:00:00 2001 From: yacchin1205 <968739+yacchin1205@users.noreply.github.com> Date: Wed, 31 May 2023 11:49:09 +0900 Subject: [PATCH 3/3] Fix dependencies --- requirements.txt | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index abf79e6..3dcbcbd 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1 @@ -notebook>=5.0.0 +notebook>=6.5.4 diff --git a/setup.py b/setup.py index d668ba6..16715f6 100644 --- a/setup.py +++ b/setup.py @@ -17,7 +17,7 @@ package_data={'nbtags': ['nbextension/*']}, include_package_data=True, platforms=['Jupyter Notebook 5.x', 'Jupyter Notebook 6.x'], - install_requires=['notebook>=5.0.0']) + install_requires=['notebook>=6.5.4']) if __name__ == '__main__': setup(**setup_args)