Skip to content

Commit

Permalink
Import sync from pycrdt
Browse files Browse the repository at this point in the history
  • Loading branch information
davidbrochart committed Sep 13, 2024
1 parent 35984d0 commit 6357140
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
11 changes: 6 additions & 5 deletions plugins/yjs/fps_yjs/ywidgets/widgets.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
import sys
from typing import Any

from pycrdt import TransactionEvent

try:
from ypywidgets.utils import ( # type: ignore
import ypywidgets
from pycrdt import (
TransactionEvent,
YMessageType,
YSyncMessageType,
create_sync_message,
create_update_message,
process_sync_message,
sync,
)
ypywidgets_installed = True
except ImportError:
Expand Down Expand Up @@ -41,8 +42,8 @@ def comm_open(self, msg, comm) -> None:
self.comm = comm
model = self.ydocs[f"{name}Model"]()
self.widgets[comm_id] = {"model": model, "comm": comm}
msg = sync(model.ydoc)
comm.send(**msg)
msg = create_sync_message(model.ydoc)
comm.send(buffers=[msg])

def comm_msg(self, msg) -> None:
comm_id = msg["content"]["comm_id"]
Expand Down
1 change: 0 additions & 1 deletion tests/test_execute.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ async def recv(self) -> bytes:
return bytes(b)


@pytest.mark.skip(reason="FIXME: caused by new ypywidgets version")
@pytest.mark.asyncio
@pytest.mark.parametrize("auth_mode", ("noauth",))
async def test_execute(auth_mode, unused_tcp_port):
Expand Down

0 comments on commit 6357140

Please sign in to comment.