hex_util_zenoh is a lightweight Python wrapper around Eclipse Zenoh, providing a simple pub/sub communication node API. It is part of the HEXFELLOW ecosystem and offers an intuitive interface for Zenoh-based inter-process and inter-machine communication.
| Module | Primary Purpose | Key Components |
|---|---|---|
| hex_zenoh_node | Simple pub/sub node wrapping Zenoh sessions | HexZenohNode |
- Simplified Zenoh API: Wraps the Eclipse Zenoh Python bindings behind a minimal, ROS-like node interface (
create_pub,create_sub,pub). - Easy publisher/subscriber management: Automatically tracks and reuses publishers per topic. Subscribers automatically unwrap
ZBytespayloads into plainbytesfor user callbacks. - Thread-aware: Designed to be used safely across threads with clear start/close lifecycle.
- Robotics engineers who need lightweight, decentralised pub/sub communication.
- Developers using Eclipse Zenoh who want a simpler, more Pythonic API.
- Anyone building distributed systems in the HEXFELLOW ecosystem.
hex_util_zenoh/
├── hex_util_zenoh/
│ ├── __init__.py # Public exports (HexZenohNode)
│ └── hex_zenoh_node.py # HexZenohNode class
├── examples/
│ ├── talker.py # TalkerNode example (ROS 2 talker style)
│ └── listener.py # ListenerNode example (ROS 2 listener style)
├── docs/
│ └── api.md # API reference
├── pyproject.toml # Project metadata & build configuration
└── venv.sh # Virtual environment setup script
- Python ≥ 3.8
- OS: Linux (Zenoh runs on all major platforms; tested on Linux)
- Dependencies:
eclipse-zenoh ≥ 1.0.0
pip install hex_util_zenohWe use uv to manage the Python environment. Please install it first.
- Clone and install in editable mode:
git clone https://github.com/hexfellow/hex_util_zenoh.git
cd hex_util_zenoh
./venv.sh- Activate before using:
source .venv/bin/activatefrom hex_util_zenoh import HexZenohNode
node = HexZenohNode()
node.start()
# Create a publisher and subscriber
node.create_pub("chatter")
def on_message(data: bytes):
print(f"Received: {data.decode()}")
node.create_sub("chatter", on_message)
# Publish a message
node.pub("chatter", b"Hello, Zenoh!")
# Clean up
node.close()Open two terminals. In the first:
python examples/talker.pyIn the second:
python examples/listener.py- API Reference — Detailed documentation of the
HexZenohNodeclass.
Apache License 2.0. See LICENSE.
| Role | Name | |
|---|---|---|
| Author | Dong Zhaorui | joray.dong@hexfellow.com |
| Maintainer | jecjune (Chen Zejun) | zejun.chen@hexfellow.com |
| Maintainer | Dong Zhaorui | joray.dong@hexfellow.com |