Generic communication library
https://1kbgz.github.io/transports/ ↗// readme
transports
Move typed models across any wire as incremental patches.
Define a model once as a pydantic model, stdlib dataclass, or
msgspec struct. Host it in Python, mutate it normally, and send
only the patch needed to update a remote mirror. The same Rust core drives Python (PyO3) and
JavaScript (wasm), so both sides use the same Value, diff, patch, and codec machinery.
import transports
from pydantic import BaseModel
class Device(BaseModel):
name: str
on: bool = False
session = transports.Session()
lamp = Device(name="lamp")
model_id = session.host(lamp)
lamp.on = True
print(session.drain())
# [(1, {'rev': 1, 'ops': [{'Set': {'path': [{'Key': 'on'}], 'value': {'Bool': True}}}]})]
Install
pip install transports
pip install "transports[connections]" # WebSocket server/client adapters
pip install "transports[sse]" # Server-Sent Events adapter
pip install "transports[jupyter]" # Jupyter comm adapter
Documentation
Tutorial
Quickstart builds one hosted model and mirrors it with the in-process server/client protocol.…