Skip to main content

SpiriSynq

SpiriSynq keeps Python dataclass instances in sync across processes, machines, and languages over a Zenoh pub/sub network. Define a typed dataclass, point multiple instances at the same topic, and field changes flow between them automatically.

from dataclasses import dataclass
from SpiriSynq.syncable_objects import SyncableObject

@dataclass
class Telemetry(SyncableObject):
    altitude: float = 0.0
    battery: int = 100

# Process A — owns the data
t = Telemetry("drone/telemetry", synq_authoritive=True)
t.altitude = 42.5  # published to the network automatically

# Process B — mirrors it
mirror = Telemetry.from_topic("drone/telemetry")
print(mirror.altitude)  # 42.5

Installation

pip install SpiriSynq

Requires Python 3.13+. A Zenoh router is optional for local use — peers discover each other directly.

How it works

Each syncable field maps to a Zenoh key expression <topic>/<field>. When a field changes, psygnal fires a signal, SpiriSynq serialises the new value to YAML, and publishes it. All subscribers on the same topic receive the update and apply it in-place without echo-looping it back.

Nested dataclass fields sync at the sub-field level: a change to robot.gps.latitude publishes to <topic>/gps/latitude, not <topic>/gps. Inherit from SubSyncableDataclass to make a nested type fully evented without Zenoh overhead; alternatively, use @dataclass(frozen=True) for immutable value objects that are replaced atomically.

Authoritative vs mirror

Sync is bidirectional — every instance both publishes its own changes and receives changes from others. synq_authoritive controls only the queryable side:

  • Authoritative (synq_authoritive=True): registers Zenoh queryables for full-state rehydration on connect, @remote_method RPCs, and schema/discovery endpoints. Sets the base topic prefix from the hostname.
  • Mirror (default): publishes and receives field changes just like an authoritative instance, but forwards RPC calls to the authoritative node rather than running them locally.
# Both sides can write — sync is bidirectional
counter = Counter("myapp/counter", synq_authoritive=True)
mirror = Counter.from_topic("myapp/counter")
mirror.value = 99  # received by counter

Remote methods

@remote_method exposes a method as a Zenoh queryable. Mirrors call it transparently — the call is routed to the authoritative node and the return value is sent back.

from SpiriSynq.remote_callables import remote_method

@dataclass
class Robot(SyncableObject):
    status: str = "idle"

    @remote_method
    def arm(self, mode: str = "auto") -> str:
        self.status = "armed"
        return f"armed in {mode} mode"

# From a mirror — works exactly like a local call
robot = Robot.from_topic("fleet/robot1")
result = robot.arm(mode="manual")  # "armed in manual mode"

Generator and async generator methods are supported. The mirror receives a regular Python generator that streams values as each reply arrives.

Custom timeouts: robot.arm.timeout(5.0)(mode="manual").

Discovery

from SpiriSynq.session import current_session

session = current_session.get()
for metadata in session.list_topics():
    print(metadata["topic"], metadata["classes"])

# Filter by type
for metadata in session.list_topics(type_filter="Robot"):
    robot = Robot.from_topic(metadata["topic"])

Cross-language compatibility

The wire format is plain Zenoh with YAML payloads. Any node that implements the SpiriSynq protocol — three built-in callables, per-field puts, and a JSON Schema describing each object — is a first-class participant. No library required on the other end.

Key configuration options

Field Default Purpose
synq_authoritive False Register queryables; answer rehydration and RPC calls
synq_publish True Publish local changes to the network
synq_receive True Apply incoming changes from the network
sync_lazy_publish False Skip publishing when no subscribers are present
synq_auto_start True Call sync() automatically on construction

Docs

Metadata

Release files for SpiriSynq 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for SpiriSynq 0.5.0
File Size Uploaded Provenance
spirisynq-0.5.0.tar.gz 98.5 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for SpiriSynq 0.5.0
File Interpreter ABI Platform
spirisynq-0.5.0-py3-none-any.whl Python 3 none any Details

Total release size: 163.2 kB

Release files / spirisynq-0.5.0.tar.gz

Download URL spirisynq-0.5.0.tar.gz
Size 98.5 kB
Tags Source
SHA-256 checksum
How to use checksums
17e70797b91a416535b3d07cc5ef65a1fb4e35cef6b5c9ee4d34bde3a589e7d3
BLAKE2b-256 checksum
How to use checksums
9770513041580195c7e744b1421c7690cf5b179061f8f2c64f6445826259056e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 24, 2026.

Transparency log

Release files / spirisynq-0.5.0-py3-none-any.whl

Download URL spirisynq-0.5.0-py3-none-any.whl
Size 64.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9542891fba821a1d224c46eb872f6f338ee8342ad84e10723cdc377485de7a52
BLAKE2b-256 checksum
How to use checksums
53ed910fac38f647fce52deb3c8f97ad65b409b4b1cd6d078b539c26e5ea6937
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 24, 2026.

Transparency log

Security for SpiriSynq 0.5.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for spirisynq-0.5.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 24, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page