Skip to main content

rb_zenoh

rb_zenoh is a shared Zenoh-based communication package. Its main features are publish/subscribe, query/queryable, and ZenohRouter decorator-based routing.

Installation/Dependencies

  • Python: >=3.12,<3.13
  • Package dependencies: flatbuffers, psutil, rb_utils, rb_modules
  • The _core native extension is not built during package installation. Build the _core*.so/_core*.pyd for the required platforms first, then include it in the package.
# For the current host
bash scripts/backend/build_cpp_core.sh zenoh

# For Docker/Linux
RB_CPP_CORE_TARGETS="linux/amd64 linux/arm64" bash scripts/backend/build_cpp_core.sh zenoh

The distributed rainbow-rb-zenoh is not built as a fat wheel; it is split into per-platform wheels. Each wheel contains only the single _core artifact for its platform.

ZENOH_CONFIG

Set the ZENOH_CONFIG environment variable to a zenoh.json5 path to use that file as the base config (example: /usr/share/rainbow-rb-zenoh/zenoh.json5.example).

  • Precedence: file base -> explicitly passed config pairs override it -> env-based build_config() is skipped.
  • Applies to every session in the process, including child processes.
  • A bad file fails immediately (ValueError in Python, std::invalid_argument in C++).
  • Because build_config() is skipped, muscat-specific settings it applies (PyFM child SHM off, unix-socket listen, peer endpoints) do not apply, and a fixed listen port in the file makes a second session / child process fail with address-in-use — use it for external standalone clients, not inside muscat services.
export ZENOH_CONFIG=~/zenoh.json5

For C++-only use: sudo apt install rainbow-rb-zenoh-dev, then find_package(rb_zenoh) / pkg-config rb_zenoh.

Core Objects

  • ZenohClient: low-level communication API
  • ZenohRouter: decorator-based router
  • SubscribeOptions: options controlling subscribe behavior

1) publish

from rb_zenoh.client import ZenohClient

client = ZenohClient()
client.publish("muscat/sample/topic", payload={"ok": True})

Publishing a FlatBuffer request:

from rb_flat_buffers.IPC.Request_MotionPause import Request_MotionPauseT

req = Request_MotionPauseT()
client.publish(
    "C500920/call_pause",
    flatbuffer_req_obj=req,
    flatbuffer_buf_size=64,
)

2) subscribe

from rb_zenoh.client import ZenohClient
from rb_zenoh.schema import SubscribeOptions

client = ZenohClient()

async def on_msg(*, topic, mv, obj_payload, dict_payload, attachment):
    print(topic, obj_payload, dict_payload, attachment)

client.subscribe(
    "muscat/sample/topic",
    on_msg,
    options=SubscribeOptions(dispatch="immediate"),
)

Callback signature:

  • topic: topic string
  • mv: raw payload (memoryview)
  • obj_payload: object parsed via flatbuffer_obj_t=<FlatBuffer T class> (T | None)
  • dict_payload: dict conversion result, regardless of whether flatbuffer_obj_t is set (dict | None)
  • attachment: sender, sender_id information

3) queryable

def on_query(req=None, params=None):
    return {"status": "ok"}

client.queryable("muscat/sample/query", on_query)

Callback arguments:

  • req: query payload body
    • Injected only when flatbuffer_req_t/flatbuffer_req_T_class is specified.
    • A FlatBuffer ...T object parsed internally via InitFromPackedBuf(...).
    • If flatbuffer_req_t is specified but the request has no payload, an error is raised.
  • params: query parameters
    • The internal q.parameters value is injected as a dict[str, str].
    • Used to pass filters/options separately from the payload (req).

Notes:

  • Arguments are auto-injected only when the callback parameters are named exactly req and params.
  • Parameters declared with other names such as request or query_params are not injected.
  • If neither is declared, the callback is invoked with no arguments.

4) query_one / query_all

query_one

res = client.query_one("muscat/program/state", timeout=0.3)
print(res.get("dict_payload"))
  • Returns only the first reply
  • Raises ZenohNoReply if there is no reply

query_all

res_list = client.query_all("*/health", timeout=0.5)
for item in res_list:
    print(item.get("key"), item.get("dict_payload"))
  • Returns all replies received within the timeout as a list
  • Returns an empty list if there are no replies

Which to use when

  • Calling a single target: query_one
  • Collecting from wildcards/multiple services: query_all

FlatBuffer Parameter Details

flatbuffer_req_obj

  • Meaning: the FlatBuffer object to send as the request (an object supporting Pack())
  • Used in: publish, query_one, query_all
  • Internal behavior: packed with a builder, then sent as a bytes payload

flatbuffer_buf_size

  • Meaning: initial buffer size of the FlatBuffer serialization builder
  • Used in:
    • Request serialization: publish, query_one, query_all
    • queryable response serialization: queryable(..., flatbuffer_res_buf_size=...)
  • Serialization may fail if it is too small
  • Recommended: start from 64/128/256/512 and increase to fit the payload size

flatbuffer_res_T_class

  • Meaning: specifies which FlatBuffer type to parse the response payload as
  • Used in: query_one, query_all
  • Type: must be a FlatBuffer Object API class (T class)
    • e.g. Response_FunctionsT, State_CoreT
    • Usually a class whose name ends in ...T
    • Parsed internally via InitFromPackedBuf(...)
  • Result:
    • If specified: parsed object in obj_payload
    • If not specified: rely mainly on dict_payload/raw payload

Example:

from rb_flat_buffers.IPC.Request_MotionPause import Request_MotionPauseT
from rb_flat_buffers.IPC.Response_Functions import Response_FunctionsT

res = client.query_one(
    "C500920/call_pause",
    flatbuffer_req_obj=Request_MotionPauseT(),
    flatbuffer_res_T_class=Response_FunctionsT,
    flatbuffer_buf_size=64,
    timeout=0.3,
)
obj = res.get("obj_payload")

5) Using ZenohRouter

from rb_zenoh.router import ZenohRouter

router = ZenohRouter(prefix="muscat/common")

@router.subscribe("health")
async def on_health(*, topic, obj_payload, dict_payload, attachment):
    pass

@router.queryable("echo")
async def on_echo(params=None):
    return {"ok": True}

Lifecycle:

  • On startup: await router.startup()
  • On shutdown: await router.shutdown()

Exceptions/Notes

  • query_one no-reply: ZenohNoReply
  • Transport reconnection errors: ZenohTransportError
  • ZenohClient is a per-process singleton, so avoid unnecessary frequent close() calls

Metadata

Release files for rainbow-rb-zenoh 0.11.10

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for rainbow-rb-zenoh 0.11.10
File Actions
rainbow_rb_zenoh-0.11.10-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details for rainbow_rb_zenoh-0.11.10-cp313-cp313-win_amd64.whl
rainbow_rb_zenoh-0.11.10-cp313-cp313-manylinux_2_35_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.35+ x86-64 Details for rainbow_rb_zenoh-0.11.10-cp313-cp313-manylinux_2_35_x86_64.whl
rainbow_rb_zenoh-0.11.10-cp313-cp313-manylinux_2_35_aarch64.whl CPython 3.13 CPython 3.13 Linux glibc 2.35+ ARM64 Details for rainbow_rb_zenoh-0.11.10-cp313-cp313-manylinux_2_35_aarch64.whl
rainbow_rb_zenoh-0.11.10-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details for rainbow_rb_zenoh-0.11.10-cp312-cp312-win_amd64.whl
rainbow_rb_zenoh-0.11.10-cp312-cp312-manylinux_2_35_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.35+ x86-64 Details for rainbow_rb_zenoh-0.11.10-cp312-cp312-manylinux_2_35_x86_64.whl
rainbow_rb_zenoh-0.11.10-cp312-cp312-manylinux_2_35_aarch64.whl CPython 3.12 CPython 3.12 Linux glibc 2.35+ ARM64 Details for rainbow_rb_zenoh-0.11.10-cp312-cp312-manylinux_2_35_aarch64.whl
rainbow_rb_zenoh-0.11.10-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details for rainbow_rb_zenoh-0.11.10-cp311-cp311-win_amd64.whl
rainbow_rb_zenoh-0.11.10-cp311-cp311-manylinux_2_35_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.35+ x86-64 Details for rainbow_rb_zenoh-0.11.10-cp311-cp311-manylinux_2_35_x86_64.whl
rainbow_rb_zenoh-0.11.10-cp311-cp311-manylinux_2_35_aarch64.whl CPython 3.11 CPython 3.11 Linux glibc 2.35+ ARM64 Details for rainbow_rb_zenoh-0.11.10-cp311-cp311-manylinux_2_35_aarch64.whl

Total release size: 53.2 MB

Release files / rainbow_rb_zenoh-0.11.10-cp313-cp313-win_amd64.whl

Download URL rainbow_rb_zenoh-0.11.10-cp313-cp313-win_amd64.whl
Size 6.0 MB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
0db721b6b1685155017db32b59393b39b415b8ea8d7dc2ce322964abdd1d87fd
BLAKE2b-256 checksum
How to use checksums
77bf76288fb909fe1e5ae1f29bc8b3c9f1645b4fa71eb8c910887c59f627770c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.13

Release files / rainbow_rb_zenoh-0.11.10-cp313-cp313-manylinux_2_35_x86_64.whl

Download URL rainbow_rb_zenoh-0.11.10-cp313-cp313-manylinux_2_35_x86_64.whl
Size 6.0 MB
Tags CPython 3.13 Linux glibc 2.35+ x86-64
SHA-256 checksum
How to use checksums
afe05fb55cd0f1cbc40844d25f4b9cb7e58649b4575699b7bebe124da831ccb9
BLAKE2b-256 checksum
How to use checksums
e856fcaaa9b53ff9e17c63645909cd9e2140020aa3b7f17053d673bb24a9cdbd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.13

Release files / rainbow_rb_zenoh-0.11.10-cp313-cp313-manylinux_2_35_aarch64.whl

Download URL rainbow_rb_zenoh-0.11.10-cp313-cp313-manylinux_2_35_aarch64.whl
Size 5.7 MB
Tags CPython 3.13 Linux glibc 2.35+ ARM64
SHA-256 checksum
How to use checksums
303b4d31f9f2b96e68ff418845dfe43d012090d884d7769275d371d210d40500
BLAKE2b-256 checksum
How to use checksums
6a7e8cadecfe3d420b058ced4a14723d3ffd53ae9c606ae20a2ae59addef7746
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.13

Release files / rainbow_rb_zenoh-0.11.10-cp312-cp312-win_amd64.whl

Download URL rainbow_rb_zenoh-0.11.10-cp312-cp312-win_amd64.whl
Size 6.0 MB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
572aaa382463469d81baa6b1b910fb11fc365eba1a46b09649ad98b4ee0e4f16
BLAKE2b-256 checksum
How to use checksums
83708cce50c3b9cd28900ad71958b9411aba1f2e3c18a04b010680cfc8aff5b2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.13

Release files / rainbow_rb_zenoh-0.11.10-cp312-cp312-manylinux_2_35_x86_64.whl

Download URL rainbow_rb_zenoh-0.11.10-cp312-cp312-manylinux_2_35_x86_64.whl
Size 6.0 MB
Tags CPython 3.12 Linux glibc 2.35+ x86-64
SHA-256 checksum
How to use checksums
442b160402332b947cd45436eb3edaca1c9baa71f0bd0f508de82340b1556c2e
BLAKE2b-256 checksum
How to use checksums
86f15c8e56c2d35c5e894a429d22334220910abef8ba1554575602c901937235
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.13

Release files / rainbow_rb_zenoh-0.11.10-cp312-cp312-manylinux_2_35_aarch64.whl

Download URL rainbow_rb_zenoh-0.11.10-cp312-cp312-manylinux_2_35_aarch64.whl
Size 5.7 MB
Tags CPython 3.12 Linux glibc 2.35+ ARM64
SHA-256 checksum
How to use checksums
a622183dad719a1dbc272f9270f55d6a918de97932444e24f7a114f4a351d39a
BLAKE2b-256 checksum
How to use checksums
33efc89891d90b5eabaf57136b373566cd105eddd4d2aeb14468ab8c95114c5f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.13

Release files / rainbow_rb_zenoh-0.11.10-cp311-cp311-win_amd64.whl

Download URL rainbow_rb_zenoh-0.11.10-cp311-cp311-win_amd64.whl
Size 6.0 MB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
efa28c33c7ea782de5e6181c15f1a7b3d51e7a74df763ef1c0272caee5ea00f9
BLAKE2b-256 checksum
How to use checksums
13b0193fc25f90db34382204aa7fa4879c787f5a6a0f1cd45e2ed4b24ecb4ba9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.13

Release files / rainbow_rb_zenoh-0.11.10-cp311-cp311-manylinux_2_35_x86_64.whl

Download URL rainbow_rb_zenoh-0.11.10-cp311-cp311-manylinux_2_35_x86_64.whl
Size 6.0 MB
Tags CPython 3.11 Linux glibc 2.35+ x86-64
SHA-256 checksum
How to use checksums
7bba4f629b9547eca5bfd4bd01a7b0c6b3f03b6be565ae91ee980ea97c370e8c
BLAKE2b-256 checksum
How to use checksums
4ad7e45bd940be97dd30e815e5ef09562cf64b61390fca0790f8bd2abff268cf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.13

Release files / rainbow_rb_zenoh-0.11.10-cp311-cp311-manylinux_2_35_aarch64.whl

Download URL rainbow_rb_zenoh-0.11.10-cp311-cp311-manylinux_2_35_aarch64.whl
Size 5.7 MB
Tags CPython 3.11 Linux glibc 2.35+ ARM64
SHA-256 checksum
How to use checksums
e9bef9275408645ce62c05ec03abd5cd1122d7882243f6834c5520140b1fd5a4
BLAKE2b-256 checksum
How to use checksums
d9a7dc70297935bc66e029a8259abb2147d83e59be9c97a589c488b93b066366
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.13

Security for rainbow-rb-zenoh 0.11.10

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.11.10 This release

9 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page