diff --git a/jupyter_ydoc/ynotebook.py b/jupyter_ydoc/ynotebook.py index 47ae466..66fa2a1 100644 --- a/jupyter_ydoc/ynotebook.py +++ b/jupyter_ydoc/ynotebook.py @@ -39,6 +39,7 @@ class YNotebook(YBaseDoc): "cell_type": str, "source": YText, "metadata": YMap, + "execution_status": str, "execution_count": Int | None, "outputs": [] | None, "attachments": {} | None @@ -100,6 +101,7 @@ def get_cell(self, index: int) -> Dict[str, Any]: """ meta = json.loads(self._ymeta.to_json()) cell = json.loads(self._ycells[index].to_json()) + cell.pop("execution_status", None) 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 @@ -171,6 +173,7 @@ def create_ycell(self, value: Dict[str, Any]) -> Y.YMap: del cell["attachments"] elif cell_type == "code": cell["outputs"] = Y.YArray(cell.get("outputs", [])) + cell["execution_status"] = "idle" return Y.YMap(cell)