Install & Compatibility
Where this runs
tested against v4.1.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
py 3.9
✕ build_error
✓ 3.5s
21MB installed
● package 21MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
YDoc
✓ from jupyter_ydoc import YNotebook
✗ from jupyter_ydoc import YDoc
YBlob
✓ from jupyter_ydoc import YBlob
YFile
✓ from jupyter_ydoc import YFile
This quickstart demonstrates how to initialize a YDoc, wrap it with YNotebook, set content from a standard Jupyter notebook dictionary, retrieve the content, and programmatically add a new cell to the Y-document structure.
import json
from jupyter_ydoc import YDoc, YNotebook
# 1. Initialize a YDoc (the core Yjs document)
ydoc = YDoc()
# 2. Create a YNotebook wrapper for the YDoc
# This initializes the YDoc with an empty notebook structure if it's new.
ynotebook = YNotebook(ydoc)
# 3. Set content from a standard Jupyter notebook dictionary
notebook_content = {
"cells": [
{"cell_type": "code", "source": "print('Hello from jupyter-ydoc!')", "metadata": {}},
{"cell_type": "markdown", "source": "## Getting Started", "metadata": {}}
],
"metadata": {
"kernelspec": {"display_name": "Python 3", "language": "python", "name": "python3"},
"language_info": {"codemirror_mode": {"name": "ipython", "version": 3}}
},
"nbformat": 4,
"nbformat_minor": 5
}
ynotebook.set(notebook_content)
print("Notebook content set successfully.")
# 4. Retrieve content as a standard Jupyter notebook dictionary
retrieved_content = ynotebook.get()
print("\nRetrieved notebook content:")
print(json.dumps(retrieved_content, indent=2))
# 5. Manipulate the notebook content (e.g., add a new cell)
ynotebook.append_cell({"cell_type": "code", "source": "x = 10\ny = 20\nx + y", "metadata": {}})
print("\nAdded a new code cell.")
# 6. Get the updated content
updated_content = ynotebook.get()
print("\nUpdated notebook content after adding cell:")
print(json.dumps(updated_content, indent=2))
Upgrade
Version history
4.1.1latest on PyPI · released Jul 6, 2026
Audit
Dependencies
ypyrequiredCore dependency for Yjs CRDT implementation.
notebook_formatrequiredUsed for converting between Y-document structures and standard Jupyter notebook formats.