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.

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.4.0.tar.gz (117.9 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.4.0-cp311-abi3-manylinux_2_28_x86_64.whl (428.2 kB view details)

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

transports-0.4.0-cp310-abi3-win_amd64.whl (289.8 kB view details)

Uploaded CPython 3.10+Windows x86-64

transports-0.4.0-cp310-abi3-macosx_11_0_arm64.whl (378.1 kB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

File details

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

File metadata

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

File hashes

Hashes for transports-0.4.0.tar.gz
Algorithm Hash digest
SHA256 b43649859928db31ace18498229932138c36f1575082e7abb3b15b2d76c2718e
MD5 4ff96a7223c35b9fa93b4a732e4f4149
BLAKE2b-256 21e0f7b2a915c26a404e539a6eadae39e3346fb32a9910bb24fd27b337e322d4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for transports-0.4.0-cp311-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b518f7150e7632ec225307dc3d9f1dd40adc824b34638d385663fcf466975ca1
MD5 4eb494cb75a09fbe9d50fc96f240326f
BLAKE2b-256 2e22a06f3f8bfc6ec5283861a7f7c22a1fbcccb64c1fbfdddb56cfe128994117

See more details on using hashes here.

File details

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

File metadata

  • Download URL: transports-0.4.0-cp310-abi3-win_amd64.whl
  • Upload date:
  • Size: 289.8 kB
  • Tags: CPython 3.10+, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for transports-0.4.0-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 ab05e3b7ee1c7cd1bcae82f50759e117314625e338bfb35f44ee7af9f8048596
MD5 7f52667133433691c49308205366d33e
BLAKE2b-256 bd0be7f54767e0a5fe46b2158036dc4ae38c9b9b5ba9c3be79eb74760e528709

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for transports-0.4.0-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 669ec31e14442d663b28e8d055de1f38421b277fa0e030b3a52ed9792f9aacab
MD5 3fba59bc7ece132c45f5d45a63caef58
BLAKE2b-256 f4a265b07ed22e5127f44b1462c47abedc1f003d09de89e2909e3e969f42a5eb

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