Registry / http-networking / eclipse-zenoh

eclipse-zenoh

JSON →
library1.9.0pypypi✓ verified 35d 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.

http-networkingcommunication
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.

import zenoh
import zenoh config = zenoh.Config()
import zenoh with zenoh.open(zenoh.Config()) as session:
publisher = session.declare_publisher(key)
subscriber = session.declare_subscriber(key, listener)
def listener(sample): ... print(sample.payload.to_string())
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 footguns
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`.
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.
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.
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.
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
23 hits · last 30 days
gptbot
4
ahrefsbot
4
bytedance
4
googlebot
4
script
1
Resources