Eclipse Zenoh (pronounce /zeno/) is a lightweight, high-performance middleware that unifies data in motion, data at rest, and computations across diverse environments, from embedded systems to the cloud. The Python API (version 1.9.0) provides bindings to the core Rust implementation, enabling pub/sub, geo-distributed storage, queries, and computations. It maintains an active development and release cadence, with major updates often quarterly, aiming for performance and efficiency beyond mainstream stacks.
pip install eclipse-zenohVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates a simple Zenoh publisher that periodically sends random temperature readings to the 'myhome/kitchen/temp' key expression. It uses a context manager to ensure the Zenoh session is properly closed. To observe the data, you would run a separate Zenoh subscriber.
Review the migration guides (e.g., v0.11 -> v1.0) on the official Zenoh documentation. Update code to use context managers for `zenoh.open()` and `declare_publisher`/`declare_subscriber`, handle payloads as `zenoh.ZBytes`, and adjust callback signatures.
Ensure you have the Rust toolchain installed on your system (follow instructions at `rustup.rs`) before attempting to `pip install eclipse-zenoh`. Binary wheels are provided for common platforms, so this issue is typically encountered in less common environments or when building from source.
Always use a Python `with` statement (context manager) when opening a Zenoh session (`with zenoh.open(zenoh.Config()) as session:`) or explicitly call `session.close()` before your script exits.
Synchronize the system clocks of all participating Zenoh nodes (publishers, subscribers, routers) using a time synchronization protocol like NTP or PTP.
For Zenoh 1.x, access the payload directly via `sample.payload`. To get string representation, use `sample.payload.to_string()`. If specific metadata is expected, ensure the publishing side includes it and check for its presence on the receiving side.
Synchronize the system clocks of all machines running Zenoh applications using a Network Time Protocol (NTP) client or Precision Time Protocol (PTP).
Install the Rust toolchain by following the instructions at `https://rustup.rs/`. After installation, ensure your shell environment is updated (e.g., `source $HOME/.cargo/env`) and try `pip install eclipse-zenoh` again.