Registry / http-networking / pycrdt-websocket

pycrdt-websocket

JSON →
library0.16.3pypypiunverified

Pycrdt-websocket provides a WebSocket connector for `pycrdt`, enabling real-time, collaborative document synchronization using Y-CRDTs over a network. It facilitates both server-side handling of Y-CRDT documents and client-side connections. The library is actively maintained with frequent minor releases, typically addressing bug fixes and compatibility updates.

pip install pycrdt-websocket
INSTALL
IMPORT
SIG · PYCRDT-WEBSOCKET
P
pycrdt-websocket
http-networkingpythonv0.16.3
Install
2.7s avg
Import
Disk
21MB
Pass rate
9/ 10
Env Coverage9 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.16.3 · 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
musl
glibc
py 3.10
✓ —
✓ 2.85s
py 3.11
✓ —
✓ 2.5s
py 3.12
✓ —
✓ 2.2s
py 3.13
✓ —
✓ 2.3s
py 3.9
✕ build_error
✓ 3.5s
21MB installed
● package 21MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

WebSocketServer
from pycrdt import WebSocketServer
from pycrdt import WebSocketServer

This quickstart demonstrates a basic pycrdt-websocket setup with a server and a client. The server initializes a YDoc and listens for connections, while the client connects to synchronize its own YDoc. It shows how text changes are synchronized in real-time.

import asyncio from pycrdt import YDoc, YText from pycrdt.websocket import WebSocketServer, YDocRoom async def server_main(): # Initialize a Y-CRDT document for the server ydoc = YDoc() with ydoc.transaction(): text = ydoc.get_text('my_text') text += 'Hello from server!' # Create a WebSocket server that manages rooms server = WebSocketServer(ydoc, 'ws://127.0.0.1:1234') print("Server starting on ws://127.0.0.1:1234") await server.start() await asyncio.sleep(5) # Keep server running for a bit await server.stop() print("Server stopped") async def client_main(): await asyncio.sleep(1) # Give server a moment to start print("Client connecting...") # Connect to the server with a YDocRoom client_ydoc = YDoc() room = YDocRoom(client_ydoc, 'ws://127.0.0.1:1234') await room.connect() # Access the shared text shared_text = client_ydoc.get_text('my_text') print(f"Client received: '{shared_text}'") with client_ydoc.transaction(): shared_text.append(' And client!') print(f"Client sent: '{shared_text}'") await asyncio.sleep(1) # Allow changes to propagate await room.disconnect() print("Client disconnected") async def main(): server_task = asyncio.create_task(server_main()) client_task = asyncio.create_task(client_main()) await asyncio.gather(server_task, client_task) if __name__ == '__main__': asyncio.run(main())
Debug
Known issues
breakingThe top-level package name for imports changed from `pycrdt_websocket` to `pycrdt.websocket` starting from version 0.16.0. This requires updating all import statements.
fix
Replace `from pycrdt_websocket import ...` with `from pycrdt.websocket import ...`.
affects: >=0.16.0
breakingThe `YStore` class, which manages persistence for Y-CRDT documents, was extracted into a separate package `pycrdt-store` starting from version 0.16.0. If you were using or subclassing `YStore` directly, you now need to import it from `pycrdt_store`.
fix
Install `pycrdt-store` (`pip install pycrdt-store`) and update imports from `from pycrdt.websocket import YStore` to `from pycrdt_store import YStore`.
affects: >=0.16.0
gotchaPycrdt-websocket is built on `asyncio` and requires `await` for all network operations (e.g., `server.start()`, `room.connect()`). Forgetting `await` will lead to silent failures or incorrect behavior.
fix
Ensure all calls to asynchronous methods are prefixed with `await` and run within an `async` function, typically managed by `asyncio.run()`.
affects: All versions
gotchaCompatibility with `pycrdt` versions is crucial. Always check the release notes for `pycrdt-websocket` to ensure you are using a compatible `pycrdt` version, as internal API changes in `pycrdt` can break `pycrdt-websocket` functionality.
fix
Refer to the `pycrdt-websocket` project's `pyproject.toml` or `setup.py` for the exact `pycrdt` version range requirement, and upgrade/downgrade `pycrdt` accordingly (e.g., `pip install pycrdt>=0.9.0,<0.11.0`).
affects: All versions
Upgrade
Version history
0.16.3latest on PyPI · released Jun 11, 2026
Audit
Dependencies
pycrdtrequiredCore Y-CRDT implementation; pycrdt-websocket relies on it for document synchronization.
pycrdt-storerequiredProvides the abstract YStore base class and related utilities, extracted in v0.16.0. Required if you need to manage Y documents in a store.
websocketsrequiredUsed for the underlying WebSocket communication; typically installed as a transitive dependency.
Agent activity
22 hits · last 30 days
node
18
OpenAI (training)
1
Resources
pycrdt-websocket — pip install pycrdt-websocket · libregistry