Skip to content

Commit

Permalink
Update pycrdt and pycrdt-websocket
Browse files Browse the repository at this point in the history
  • Loading branch information
davidbrochart committed Dec 8, 2023
1 parent 4881b9d commit 1f14f00
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 15 deletions.
1 change: 0 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ jobs:
run: |
mamba install pip nodejs=18
pip install ".[test]"
pip install https://github.com/davidbrochart/ypy-websocket/archive/pycrdt.zip
- name: Build JavaScript assets
working-directory: javascript
Expand Down
3 changes: 1 addition & 2 deletions jupyter_ydoc/ybasedoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ def __init__(self, ydoc: Optional[Doc] = None):
self._ydoc = Doc()
else:
self._ydoc = ydoc
self._ystate = Map()
self._ydoc["state"] = self._ystate
self._ydoc["state"] = self._ystate = Map()
self._subscriptions: Dict[Any, str] = {}

@property
Expand Down
3 changes: 1 addition & 2 deletions jupyter_ydoc/yblob.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ def __init__(self, ydoc: Optional[Doc] = None):
:type ydoc: :class:`pycrdt.Doc`, optional.
"""
super().__init__(ydoc)
self._ysource = Map()
self._ydoc["source"] = self._ysource
self._ydoc["source"] = self._ysource = Map()

@property
def version(self) -> str:
Expand Down
6 changes: 2 additions & 4 deletions jupyter_ydoc/ynotebook.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,8 @@ def __init__(self, ydoc: Optional[Doc] = None):
:type ydoc: :class:`pycrdt.Doc`, optional.
"""
super().__init__(ydoc)
self._ymeta = Map()
self._ycells = Array()
self._ydoc["meta"] = self._ymeta
self._ydoc["cells"] = self._ycells
self._ydoc["meta"] = self._ymeta = Map()
self._ydoc["cells"] = self._ycells = Array()

@property
def version(self) -> str:
Expand Down
5 changes: 2 additions & 3 deletions jupyter_ydoc/yunicode.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ def __init__(self, ydoc: Optional[Doc] = None):
:type ydoc: :class:`pycrdt.Doc`, optional.
"""
super().__init__(ydoc)
self._ysource = Text()
self._ydoc["source"] = self._ysource
self._ydoc["source"] = self._ysource = Text()

@property
def version(self) -> str:
Expand Down Expand Up @@ -62,7 +61,7 @@ def set(self, value: str) -> None:
"""
with self._ydoc.transaction():
# clear document
del self._ysource[:]
self._ysource.clear()
# initialize document
if value:
self._ysource += value
Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ requires-python = ">=3.7"
keywords = ["jupyter", "ypy"]
dependencies = [
"importlib_metadata >=3.6; python_version<'3.10'",
"pycrdt >=0.3.4,<0.4.0",
"pycrdt >=0.7.0,<0.8.0",
]

[[project.authors]]
Expand All @@ -31,6 +31,7 @@ test = [
"pytest",
"pytest-asyncio",
"websockets >=10.0",
"pycrdt-websocket >=0.12.5,<0.13.0",
]
docs = [
"sphinx",
Expand Down
3 changes: 1 addition & 2 deletions tests/test_ypy_yjs.py → tests/test_pycrdt_yjs.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ def stringify_source(nb: dict) -> dict:
class YTest:
def __init__(self, ydoc: Doc, timeout: float = 1.0):
self.timeout = timeout
self.ytest = Map()
ydoc["_test"] = self.ytest
ydoc["_test"] = self.ytest = Map()
self.clock = -1.0

def run_clock(self):
Expand Down

0 comments on commit 1f14f00

Please sign in to comment.