Generic communication library
Project description
transports
Move typed models across any wire.
Define a model once — as a pydantic model, a stdlib dataclass, or a
msgspec struct — host it, and its mutations stream to peers as
incremental patches (not whole-model resends), over a WebSocket, in JSON or MessagePack. A Rust
core (model representation, diff/patch, codecs, framing) compiles to Python (PyO3) and JavaScript
(wasm), so both ends share one implementation.
import transports
from pydantic import BaseModel
class Device(BaseModel):
name: str
on: bool = False
session = transports.Session()
lamp = Device(name="lamp")
session.host(lamp)
lamp.on = True # just mutate the model...
for model_id, patch in session.drain():
print(patch)
# {'rev': 1, 'ops': [{'Set': {'path': [{'Key': 'on'}], 'value': {'Bool': True}}}]}
Install
pip install transports
pip install "transports[connections]" # adds the WebSocket server/client adapters
What you get
- Reactive models — mutate a field, get the minimal patch. No manual diffing or
send(). - Three model kinds, one contract — pydantic, dataclass, and msgspec all bridge to the same core.
- One core, two languages — Python and JavaScript share the Rust diff/patch and codecs, so a patch produced on one side applies on the other.
- Live sync over WebSocket — host a model on a server and mirror it in the browser; mutate it in Python and the page updates. See Connections.
- JSON or MessagePack — swap the wire format without touching your models. See Codecs.
Documentation
Quickstart · Concepts · Model bridges · Connections · Codecs · API reference
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file transports-0.3.0.tar.gz.
File metadata
- Download URL: transports-0.3.0.tar.gz
- Upload date:
- Size: 115.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6f9f87634c3f80ab92689b5079a293728e1650d83f0543ce46b0319b5d4f496d
|
|
| MD5 |
525af408852a38a72c98da2cb772e5e0
|
|
| BLAKE2b-256 |
49f231408949a682d67bd0363aa11bd6177a3da3d4ca1c9fdd07bcc80b7caf77
|
File details
Details for the file transports-0.3.0-cp311-abi3-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: transports-0.3.0-cp311-abi3-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 423.5 kB
- Tags: CPython 3.11+, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
49ced8b4a33c7524d547b14f9ce2bb1836ae618b4247b07eb049d6cc8dd95a45
|
|
| MD5 |
fcbf2306d991cdf44fa4535b50ffac16
|
|
| BLAKE2b-256 |
3deb0845c0d11f6333c26efd183c3004488f29b918cc0df2e5006eb1c5988ac7
|
File details
Details for the file transports-0.3.0-cp310-abi3-win_amd64.whl.
File metadata
- Download URL: transports-0.3.0-cp310-abi3-win_amd64.whl
- Upload date:
- Size: 285.2 kB
- Tags: CPython 3.10+, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
06c23686b79f963a99fa0059850851a2d1b0e7665fabbed5e5352ab7b56f1976
|
|
| MD5 |
36d86b7d8f17ef55fad98ca93197a98a
|
|
| BLAKE2b-256 |
e360d048510bd9363703ba3c03c0e097f2653aeee207eb43b2532bae91fee762
|
File details
Details for the file transports-0.3.0-cp310-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: transports-0.3.0-cp310-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 373.2 kB
- Tags: CPython 3.10+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
21a02758f0562c995e941f2fad7d3463f30e26614d394f8f879dbfd4ee45c14d
|
|
| MD5 |
1d1fc47c692bcd80dd195b878e5de94d
|
|
| BLAKE2b-256 |
9baf25d4f5ea7084b8578a33bddff3d29f09b7a468a9c051549c8a3218320168
|