Skip to content

Commit a1d5ea9

Browse files
committed
Add cell execution_state
1 parent 8ea8da6 commit a1d5ea9

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

jupyter_ydoc/ynotebook.py

+3
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ class YNotebook(YBaseDoc):
3939
"cell_type": str,
4040
"source": YText,
4141
"metadata": YMap,
42+
"execution_state": str,
4243
"execution_count": Int | None,
4344
"outputs": [] | None,
4445
"attachments": {} | None
@@ -100,6 +101,7 @@ def get_cell(self, index: int) -> Dict[str, Any]:
100101
"""
101102
meta = json.loads(self._ymeta.to_json())
102103
cell = json.loads(self._ycells[index].to_json())
104+
cell.pop("execution_state", None)
103105
cast_all(cell, float, int) # cells coming from Yjs have e.g. execution_count as float
104106
if "id" in cell and meta["nbformat"] == 4 and meta["nbformat_minor"] <= 4:
105107
# strip cell IDs if we have notebook format 4.0-4.4
@@ -171,6 +173,7 @@ def create_ycell(self, value: Dict[str, Any]) -> Y.YMap:
171173
del cell["attachments"]
172174
elif cell_type == "code":
173175
cell["outputs"] = Y.YArray(cell.get("outputs", []))
176+
cell["execution_state"] = "idle"
174177

175178
return Y.YMap(cell)
176179

0 commit comments

Comments
 (0)