Registry / http-networking / eclipse-zenoh

eclipse-zenoh

JSON →
library1.9.0pypypi✓ verified 86d ago

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-zenoh
INSTALL
IMPORT
SIG · ECLIPSE-ZENOH
E
eclipse-zenoh
http-networkingpythonv1.9.0
Install
1.8s avg
Import
Disk
46MB
Pass rate
5/ 10
Env Coverage5 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.9.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
build_error
glibc
py 3.103.920 runs
installs and imports cleanly · install 1.8s · import 0.000s · 48MB
46MB installed
● package 46MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

zenoh
import zenoh
Config
import zenoh config = zenoh.Config()
Session
import zenoh with zenoh.open(zenoh.Config()) as session:
Publisher
publisher = session.declare_publisher(key)
Subscriber
subscriber = session.declare_subscriber(key, listener)
Sample
def listener(sample): ... print(sample.payload.to_string())
ZBytes
value_bytes = zenoh.ZBytes(b'hello')

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.

import zenoh import time import random import os # Configure a Zenoh session (default configuration for local peer/client) # For a router or specific configuration, consider loading from a file: # config_file = os.environ.get('ZENOH_CONFIG_FILE', '') # if config_file: config = zenoh.Config.from_file(config_file) # else: config = zenoh.Config() def read_temp(): return random.randint(15, 30) if __name__ == "__main__": # Open a Zenoh session using a context manager for proper cleanup with zenoh.open(zenoh.Config()) as session: key = 'myhome/kitchen/temp' # Declare a publisher on the specified key expression pub = session.declare_publisher(key) print(f"Zenoh Publisher sending data to '{key}'...") try: while True: t = read_temp() buf = f"{t}" pub.put(buf) print(f"Putting Data ('{key}': '{buf}')...") time.sleep(1) except KeyboardInterrupt: print("Publisher stopped.")
Debug
Known issues
breakingThe API underwent significant reworks between versions 0.x and 1.x (e.g., v0.11 to v1.0), emphasizing a more 'pythonic' feel. Key changes include mandatory use of context managers for sessions/entities, the `Value` type being replaced by `ZBytes` and `Encoding`, and `drop-callback` requiring wrapping in `handlers.Callback`.
fix
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.
affects: < 1.0.0
gotchaInstalling `eclipse-zenoh` via pip might fail with build errors if you are on a platform without pre-built binary wheels and do not have a Rust toolchain installed. This is because the Python API is a binding over a Rust implementation.
fix
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.
affects: All versions
gotchaFailure to properly close a Zenoh session can lead to the script hanging on exit. This occurs if object finalizers are called after the library's internal Rust thread has already been killed.
fix
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.
affects: All versions
gotchaZenoh nodes communicating with each other can drop messages or log 'Error treating timestamp for received Data' if their system clocks drift by more than 100ms.
fix
Synchronize the system clocks of all participating Zenoh nodes (publishers, subscribers, routers) using a time synchronization protocol like NTP or PTP.
affects: All versions
Errors
Common errors & fixes
AttributeError: 'NoneType' object has no attribute 'timestamp' (or similar on sample.data_info)
In older Zenoh Python API versions, `data_info` or `timestamp` might not always be present or valid on a received `Sample` object, leading to `NoneType` errors when accessed directly without checks. The API for `Sample` payload handling has evolved.
fix
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.
ERROR zenoh::net::routing::pubsub] Error treating timestamp for received Data (incoming timestamp ... exceeding delta 100ms is rejected: ...)
This error indicates that the system clocks between the Zenoh publisher and subscriber/router are not synchronized, and the time difference exceeds 100 milliseconds.
fix
Synchronize the system clocks of all machines running Zenoh applications using a Network Time Protocol (NTP) client or Precision Time Protocol (PTP).
Command 'rustc' not found
You are attempting to install `eclipse-zenoh` from a source distribution, but the Rust toolchain (including the `rustc` compiler) is not installed or not in your system's PATH.
fix
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.
Upgrade
Version history
1.9.0latest on PyPI · released Apr 10, 2026
Audit
Dependencies
Rust toolchainoptionalZenoh-python is developed in Rust. While binary wheels are provided for common platforms, building from source requires a Rust toolchain.
Agent activity
34 hits · last 30 days
node
32
OpenAI (training)
1
Resources
eclipse-zenoh — pip install eclipse-zenoh · libregistry