Skip to main content

Crate zerodds_py

Crate zerodds_py 

Source
Expand description

Crate zerodds-py. Safety classification: STANDARD (Binding-FFI).

PyO3 bindings for the ZeroDDS DCPS API. Provides an importable Python module zerodds_py via maturin build or directly via cargo build --features extension-module.

Spec: OMG DDS 1.4 (formal/2015-04-10) §2.2.2 with Python idioms.

§Layer position

Layer 6 — PSMs / bindings.

§Build

  • Default cargo build (without Python headers): pyo3 is optional, the crate compiles as a lib placeholder. No Python API available — this is how the workspace CI runs without a Python dependency.
  • With --features extension-module (or via maturin build): compiled as a cdylib and produces an importable Python module zerodds_py.

§API

import zerodds_py as zerodds

factory = zerodds.DomainParticipantFactory.instance()
participant = factory.create_participant_offline(0)

topic = participant.create_bytes_topic("Chatter")
publisher = participant.create_publisher()
writer = publisher.create_bytes_writer(topic)

subscriber = participant.create_subscriber()
reader = subscriber.create_bytes_reader(topic)

writer.write(b"hello")
samples = reader.take()  # List[bytes]

Typed DdsType bindings (dataclass mapping via the IDL generator) follow from crates/idl-rust through the Python bindings generator.