From 0bd566dfaad84c9b99c70cf16c3cad6735cded30 Mon Sep 17 00:00:00 2001 From: David Brochart Date: Tue, 26 Dec 2023 15:55:05 +0100 Subject: [PATCH] Update pycrdt v0.8 --- jupyter_ydoc/ynotebook.py | 7 +++---- pyproject.toml | 4 ++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/jupyter_ydoc/ynotebook.py b/jupyter_ydoc/ynotebook.py index 2c8ce51..bab056a 100644 --- a/jupyter_ydoc/ynotebook.py +++ b/jupyter_ydoc/ynotebook.py @@ -2,7 +2,6 @@ # Distributed under the terms of the Modified BSD License. import copy -import json from functools import partial from typing import Any, Callable, Dict, Optional from uuid import uuid4 @@ -98,8 +97,8 @@ def get_cell(self, index: int) -> Dict[str, Any]: :return: A cell. :rtype: Dict[str, Any] """ - meta = json.loads(str(self._ymeta)) - cell = json.loads(str(self._ycells[index])) + meta = self._ymeta.to_py() + cell = self._ycells[index].to_py() cast_all(cell, float, int) # cells coming from Yjs have e.g. execution_count as float if "id" in cell and meta["nbformat"] == 4 and meta["nbformat_minor"] <= 4: # strip cell IDs if we have notebook format 4.0-4.4 @@ -181,7 +180,7 @@ def get(self) -> Dict: :return: Document's content. :rtype: Dict """ - meta = json.loads(str(self._ymeta)) + meta = self._ymeta.to_py() cast_all(meta, float, int) # notebook coming from Yjs has e.g. nbformat as float cells = [] for i in range(len(self._ycells)): diff --git a/pyproject.toml b/pyproject.toml index 420c157..ad36b8b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -13,7 +13,7 @@ requires-python = ">=3.7" keywords = ["jupyter", "ypy"] dependencies = [ "importlib_metadata >=3.6; python_version<'3.10'", - "pycrdt >=0.7.0,<0.8.0", + "pycrdt >=0.8.1,<0.9.0", ] [[project.authors]] @@ -31,7 +31,7 @@ test = [ "pytest", "pytest-asyncio", "websockets >=10.0", - "pycrdt-websocket >=0.12.5,<0.13.0", + "pycrdt-websocket >=0.12.6,<0.13.0", ] docs = [ "sphinx",