Skip to content

Commit

Permalink
Revert "Use multithreading flag (#14)" (#15)
Browse files Browse the repository at this point in the history
This reverts commit 32045b3.
  • Loading branch information
fcollonval authored Dec 17, 2024
1 parent 32045b3 commit 99ebff9
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions jupyter_nbmodel_client/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ def output_hook(outputs: list[dict[str, t.Any]], message: dict[str, t.Any]) -> s
return set()




class KernelClient(t.Protocol):
"""Interface to be implemented by the kernel client."""

Expand Down Expand Up @@ -119,9 +121,7 @@ class NotebookModel(MutableSequence):
# FIXME add API to clear code cell; aka execution count and outputs

def __init__(self) -> None:
self._doc: YNotebook
# Initialize _doc
self._reset_y_model()
self._doc = YNotebook()

def __delitem__(self, index: int) -> NotebookNode:
raw_ycell = self._doc.ycells.pop(index)
Expand Down Expand Up @@ -312,6 +312,4 @@ def set_cell_source(self, index: int, source: str) -> None:

def _reset_y_model(self) -> None:
"""Reset the Y model."""
# Use allow_multithreading=True to ensure blocking document transactions
# https://jupyter-server.github.io/pycrdt/usage/#Transactions
self._doc = YNotebook(ydoc=pycrdt.Doc(allow_multithreading=True))
self._doc = YNotebook()

0 comments on commit 99ebff9

Please sign in to comment.