From 8fee21f7cd338057c69febb5508f9b6c8bfd2392 Mon Sep 17 00:00:00 2001 From: David Brochart Date: Tue, 12 Dec 2023 16:59:38 +0100 Subject: [PATCH] Use pycrdt-websocket instead of ypy-websocket (#220) --- docs/source/configuration.md | 2 +- jupyter_collaboration/app.py | 2 +- jupyter_collaboration/handlers.py | 6 +++--- jupyter_collaboration/rooms.py | 6 +++--- jupyter_collaboration/stores.py | 4 ++-- jupyter_collaboration/websocketserver.py | 4 ++-- pyproject.toml | 4 ++-- tests/conftest.py | 2 +- tests/test_handlers.py | 2 +- tests/utils.py | 2 +- 10 files changed, 17 insertions(+), 17 deletions(-) diff --git a/docs/source/configuration.md b/docs/source/configuration.md index bfe0b144..6cb1f65c 100644 --- a/docs/source/configuration.md +++ b/docs/source/configuration.md @@ -27,5 +27,5 @@ jupyter lab --YDocExtension.file_poll_interval=2 jupyter lab --YDocExtension.document_cleanup_delay=100 # The YStore class to use for storing Y updates (default: JupyterSQLiteYStore). -jupyter lab --YDocExtension.ystore_class=ypy_websocket.ystore.TempFileYStore +jupyter lab --YDocExtension.ystore_class=pycrdt_websocket.ystore.TempFileYStore ``` diff --git a/jupyter_collaboration/app.py b/jupyter_collaboration/app.py index ff337460..27c78a6c 100644 --- a/jupyter_collaboration/app.py +++ b/jupyter_collaboration/app.py @@ -5,8 +5,8 @@ import asyncio from jupyter_server.extension.application import ExtensionApp +from pycrdt_websocket.ystore import BaseYStore from traitlets import Bool, Float, Type -from ypy_websocket.ystore import BaseYStore from .handlers import DocSessionHandler, YDocWebSocketHandler from .loaders import FileLoaderMapping diff --git a/jupyter_collaboration/handlers.py b/jupyter_collaboration/handlers.py index 61a73d7c..e543a5f5 100644 --- a/jupyter_collaboration/handlers.py +++ b/jupyter_collaboration/handlers.py @@ -12,11 +12,11 @@ from jupyter_server.auth import authorized from jupyter_server.base.handlers import APIHandler, JupyterHandler from jupyter_ydoc import ydocs as YDOCS +from pycrdt_websocket.websocket_server import YRoom +from pycrdt_websocket.ystore import BaseYStore +from pycrdt_websocket.yutils import YMessageType, write_var_uint from tornado import web from tornado.websocket import WebSocketHandler -from ypy_websocket.websocket_server import YRoom -from ypy_websocket.ystore import BaseYStore -from ypy_websocket.yutils import YMessageType, write_var_uint from .loaders import FileLoaderMapping from .rooms import DocumentRoom, TransientRoom diff --git a/jupyter_collaboration/rooms.py b/jupyter_collaboration/rooms.py index 75e2a20e..543d664e 100644 --- a/jupyter_collaboration/rooms.py +++ b/jupyter_collaboration/rooms.py @@ -10,9 +10,9 @@ from jupyter_events import EventLogger from jupyter_ydoc import ydocs as YDOCS -from ypy_websocket.websocket_server import YRoom -from ypy_websocket.ystore import BaseYStore, YDocNotFound -from ypy_websocket.yutils import write_var_uint +from pycrdt_websocket.websocket_server import YRoom +from pycrdt_websocket.ystore import BaseYStore, YDocNotFound +from pycrdt_websocket.yutils import write_var_uint from .loaders import FileLoader from .utils import ( diff --git a/jupyter_collaboration/stores.py b/jupyter_collaboration/stores.py index 323e06ed..4f31a9de 100644 --- a/jupyter_collaboration/stores.py +++ b/jupyter_collaboration/stores.py @@ -1,10 +1,10 @@ # Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. +from pycrdt_websocket.ystore import SQLiteYStore as _SQLiteYStore +from pycrdt_websocket.ystore import TempFileYStore as _TempFileYStore from traitlets import Int, Unicode from traitlets.config import LoggingConfigurable -from ypy_websocket.ystore import SQLiteYStore as _SQLiteYStore -from ypy_websocket.ystore import TempFileYStore as _TempFileYStore class TempFileYStore(_TempFileYStore): diff --git a/jupyter_collaboration/websocketserver.py b/jupyter_collaboration/websocketserver.py index f35c1148..00d3f54e 100644 --- a/jupyter_collaboration/websocketserver.py +++ b/jupyter_collaboration/websocketserver.py @@ -7,9 +7,9 @@ from logging import Logger from typing import Any +from pycrdt_websocket.websocket_server import WebsocketServer, YRoom +from pycrdt_websocket.ystore import BaseYStore from tornado.websocket import WebSocketHandler -from ypy_websocket.websocket_server import WebsocketServer, YRoom -from ypy_websocket.ystore import BaseYStore class RoomNotFound(LookupError): diff --git a/pyproject.toml b/pyproject.toml index 2c9dd593..2ed1e410 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -28,8 +28,8 @@ classifiers = [ ] dependencies = [ "jupyter_server>=2.0.0,<3.0.0", - "jupyter_ydoc>=1.1.0a0,<2.0.0", - "ypy-websocket>=0.12.1,<0.13.0", + "jupyter_ydoc>=2.0.0,<3.0.0", + "pycrdt-websocket>=0.12.5,<0.13.0", "jupyter_events>=0.7.0", "jupyter_server_fileid>=0.7.0,<1", "jsonschema>=4.18.0" diff --git a/tests/conftest.py b/tests/conftest.py index 234dbb3c..17fc6ef6 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -10,8 +10,8 @@ import nbformat import pytest from jupyter_ydoc import YNotebook, YUnicode +from pycrdt_websocket import WebsocketProvider from websockets import connect -from ypy_websocket import WebsocketProvider from jupyter_collaboration.loaders import FileLoader from jupyter_collaboration.rooms import DocumentRoom diff --git a/tests/test_handlers.py b/tests/test_handlers.py index 0a8f7d08..dc6280c4 100644 --- a/tests/test_handlers.py +++ b/tests/test_handlers.py @@ -8,7 +8,7 @@ from typing import Any from jupyter_ydoc import YUnicode -from ypy_websocket import WebsocketProvider +from pycrdt_websocket import WebsocketProvider async def test_session_handler_should_create_session_id( diff --git a/tests/utils.py b/tests/utils.py index 199e152c..c25e3f29 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -7,7 +7,7 @@ from typing import Any from jupyter_server import _tz as tz -from ypy_websocket.yutils import write_var_uint +from pycrdt_websocket.yutils import write_var_uint from jupyter_collaboration.utils import RoomMessages