From 08b8951e45c804cb70a25505f647bb67fb19d975 Mon Sep 17 00:00:00 2001 From: Arne de Laat Date: Tue, 16 Apr 2019 14:17:31 +0200 Subject: [PATCH 1/4] Also allow subclasses of TextFileContentsManager Only load the jupytext.TextFileContentsManager as contents manager if the configured class is not already an instance of it. --- jupytext/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jupytext/__init__.py b/jupytext/__init__.py index 4d966e728..d4d283ec5 100644 --- a/jupytext/__init__.py +++ b/jupytext/__init__.py @@ -17,9 +17,9 @@ def __init__(self): def load_jupyter_server_extension(app): # pragma: no cover """Use Jupytext's contents manager""" - if app.contents_manager_class == TextFileContentsManager: + if isinstance(app.contents_manager_class, TextFileContentsManager): app.log.info("[Jupytext Server Extension] NotebookApp.contents_manager_class is " - "jupytext.TextFileContentsManager already - OK") + "(or a subclass of) jupytext.TextFileContentsManager already - OK") return # The server extension call is too late! From 08a54a3868f57aeb26f2c05b82013e492526bdb9 Mon Sep 17 00:00:00 2001 From: Marc Wouts Date: Tue, 16 Apr 2019 18:29:24 +0200 Subject: [PATCH 2/4] Fallback on FileContentsManager when LargeFileManager is not available #217 --- jupytext/contentsmanager.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/jupytext/contentsmanager.py b/jupytext/contentsmanager.py index cd3c09ac4..659e2b27e 100644 --- a/jupytext/contentsmanager.py +++ b/jupytext/contentsmanager.py @@ -14,7 +14,12 @@ except ImportError: pass -from notebook.services.contents.largefilemanager import LargeFileManager +try: + from notebook.services.contents.largefilemanager import LargeFileManager +except ImportError: + # Older versions of notebook do not have the LargeFileManager #217 + from notebook.services.contents.filemanager import FileContentsManager as LargeFileManager + from jupyter_client.kernelspec import find_kernel_specs, get_kernel_spec from .jupytext import reads, writes, create_prefix_dir From 3e08979ff978b4dafaae72046ff743351d38e09a Mon Sep 17 00:00:00 2001 From: Marc Wouts Date: Tue, 16 Apr 2019 19:17:54 +0200 Subject: [PATCH 3/4] Try solve LGTM alert #218 --- jupytext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jupytext/__init__.py b/jupytext/__init__.py index d189dcd8a..fd26deef0 100644 --- a/jupytext/__init__.py +++ b/jupytext/__init__.py @@ -11,7 +11,7 @@ class TextFileContentsManager: """A class that raises the previous ImportError""" err = err - def __init__(self): + def __init__(self, parent=None, log=None): # noqa raise self.err From 980e032a537b820fc1d2879af2120182f0695726 Mon Sep 17 00:00:00 2001 From: Marc Wouts Date: Tue, 16 Apr 2019 19:18:11 +0200 Subject: [PATCH 4/4] Version 1.1.1 --- HISTORY.rst | 9 +++++++++ jupytext/version.py | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/HISTORY.rst b/HISTORY.rst index d6f77377b..fc09b1110 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -3,6 +3,15 @@ Release History --------------- +1.1.1 (2019-04-16) +++++++++++++++++++++++ + +**Improvements** + +- Jupytext server extension leaves the contents manager unchanged when it is already a subclass of TextFileContentsManager (#218) +- The base class for TextFileContentsManager defaults to FileContentsManager when LargeFileManager is not available (#217) + + 1.1.0 (2019-04-14) ++++++++++++++++++++++ diff --git a/jupytext/version.py b/jupytext/version.py index a5567ef6d..6da904d80 100644 --- a/jupytext/version.py +++ b/jupytext/version.py @@ -1,3 +1,3 @@ """Jupytext's version number""" -__version__ = '1.1.0' +__version__ = '1.1.1'