Skip to main content

Generic communication library

Project description

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.

Build Status codecov License PyPI

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.

How-to guides

Model bridges covers pydantic, dataclasses, msgspec, schemas, and plain JavaScript objects. Connections covers WebSocket, SSE, Jupyter comm, and anywidget adapters. Codecs covers JSON, MessagePack, and custom codecs. Multi-tenancy and sharing covers tenant isolation, shared models, and merge strategies.

Reference

API reference lists the Python API. Wire protocol reference describes Value, patch operations, protocol messages, codecs, and model ids.

Explanation

Concepts explains why transports uses incremental patches, server-owned revisions, a shared Rust core, and transport-agnostic adapters.

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

transports-0.5.0.tar.gz (143.0 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

transports-0.5.0-cp311-abi3-manylinux_2_28_x86_64.whl (530.3 kB view details)

Uploaded CPython 3.11+manylinux: glibc 2.28+ x86-64

transports-0.5.0-cp310-abi3-win_amd64.whl (382.5 kB view details)

Uploaded CPython 3.10+Windows x86-64

transports-0.5.0-cp310-abi3-macosx_11_0_arm64.whl (465.8 kB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

File details

Details for the file transports-0.5.0.tar.gz.

File metadata

  • Download URL: transports-0.5.0.tar.gz
  • Upload date:
  • Size: 143.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for transports-0.5.0.tar.gz
Algorithm Hash digest
SHA256 9700df2b70ba5ab24b644631a92a624bda783f7ae46a35f69667dd53ad35802c
MD5 38623870bbd51c49334577a9ffc6e688
BLAKE2b-256 9f3fa9d37a98a61545e9824648b1ce9ccbc60c9d3b32f6364eaf6eeb8a299c49

See more details on using hashes here.

File details

Details for the file transports-0.5.0-cp311-abi3-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for transports-0.5.0-cp311-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 0f80c838bd5c26664442821f9808191d0c6fa98d4cb7417fad0ef6d02d86e331
MD5 1a77e57ace84c82cf2fd0d4a0f7f2780
BLAKE2b-256 8057e1d098e775db6e908e30bae6c2a88e989259f5acc93ae2058c8e31e1b433

See more details on using hashes here.

File details

Details for the file transports-0.5.0-cp310-abi3-win_amd64.whl.

File metadata

  • Download URL: transports-0.5.0-cp310-abi3-win_amd64.whl
  • Upload date:
  • Size: 382.5 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

Hashes for transports-0.5.0-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 d7022a21bf59a62fcda62ac1e36353c892f51037a418b3b660415c65a13705e6
MD5 2f1d6fdee25e061b481c20e7bd9d6d82
BLAKE2b-256 89cb165e6120010ad87006bfd8ee55e01a18b921484804a33d4d1e60324c873d

See more details on using hashes here.

File details

Details for the file transports-0.5.0-cp310-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for transports-0.5.0-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 36d859f7892ee048c496f4da377a71a47453c5c6881e0bd76532ae6f15f9f0b4
MD5 82036522a82e2448a1e0036b8717d57c
BLAKE2b-256 5c8d440c47f18c53d7b731876e193984ca4b21a912f0583e145e90bc5c6d84f5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page