From 4d5263e6204410304398c278d73c486744fc0966 Mon Sep 17 00:00:00 2001 From: Alexander Steppke Date: Tue, 14 Nov 2023 16:20:13 +0100 Subject: [PATCH] modified jupyter helper for collaboration >=2.x --- src/cristallina/jupyter_helper.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/cristallina/jupyter_helper.py b/src/cristallina/jupyter_helper.py index f24097f..95fb098 100644 --- a/src/cristallina/jupyter_helper.py +++ b/src/cristallina/jupyter_helper.py @@ -4,14 +4,28 @@ To use: jupyter lab --YDocExtension.ystore_class=cristallina.jupyter_helper.MySQLiteYStore +In 2.0.x this is replaced by: +# The Store class used for storing Y updates (default: SQLiteYStore). +jupyter lab --YDocExtension.ystore_class=jupyter_collaboration.stores.FileYStore + This should work on the local consoles and also on RA (yet untested). """ +from packaging.version import Version import random -from ypy_websocket.ystore import SQLiteYStore +import jupyter_collaboration + +if Version(jupyter_collaboration.__version__) < Version("1.9"): + from ypy_websocket.ystore import SQLiteYStore + +else: + # approach for >=2.0 + from jupyter_collaboration.stores import SQLiteYStore class MySQLiteYStore(SQLiteYStore): + """ + Custom SQL location for jupyter collaboration to avoid NFS locking issues. + """ suffix = random.randint(0, 1E9) db_path = f"/tmp/ystore_{suffix}.db" -