```{toctree} --- maxdepth: 2 hidden: true --- docs/src/quickstart.md docs/src/bridges.md docs/src/connections.md docs/src/codecs.md docs/src/multitenancy.md docs/src/api.md docs/src/protocol-reference.md docs/src/concepts.md ``` # transports Move typed models across any wire as incremental patches. Define a model once as a [pydantic](https://docs.pydantic.dev) model, stdlib `dataclass`, or [msgspec](https://jcristharif.com/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. [![Build Status](https://github.com/1kbgz/transports/actions/workflows/build.yaml/badge.svg?branch=main&event=push)](https://github.com/1kbgz/transports/actions/workflows/build.yaml) [![codecov](https://codecov.io/gh/1kbgz/transports/branch/main/graph/badge.svg)](https://codecov.io/gh/1kbgz/transports) [![License](https://img.shields.io/github/license/1kbgz/transports)](https://github.com/1kbgz/transports) [![PyPI](https://img.shields.io/pypi/v/transports.svg)](https://pypi.python.org/pypi/transports) ```python 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 ```bash 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](docs/src/quickstart.md) builds one hosted model and mirrors it with the in-process server/client protocol. ### How-to guides [Model bridges](docs/src/bridges.md) covers pydantic, dataclasses, msgspec, schemas, and plain JavaScript objects. [Connections](docs/src/connections.md) covers WebSocket, SSE, Jupyter comm, and anywidget adapters. [Codecs](docs/src/codecs.md) covers JSON, MessagePack, and custom codecs. [Multi-tenancy and sharing](docs/src/multitenancy.md) covers tenant isolation, shared models, and merge strategies. ### Reference [API reference](docs/src/api.md) lists the Python API. [Wire protocol reference](docs/src/protocol-reference.md) describes `Value`, patch operations, protocol messages, codecs, and model ids. ### Explanation [Concepts](docs/src/concepts.md) explains why transports uses incremental patches, server-owned revisions, a shared Rust core, and transport-agnostic adapters.