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.

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.2

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.2
File Actions
rainbow_rb_zenoh-0.11.2-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details for rainbow_rb_zenoh-0.11.2-cp313-cp313-win_amd64.whl
rainbow_rb_zenoh-0.11.2-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.2-cp313-cp313-manylinux_2_35_x86_64.whl
rainbow_rb_zenoh-0.11.2-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.2-cp313-cp313-manylinux_2_35_aarch64.whl
rainbow_rb_zenoh-0.11.2-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details for rainbow_rb_zenoh-0.11.2-cp312-cp312-win_amd64.whl
rainbow_rb_zenoh-0.11.2-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.2-cp312-cp312-manylinux_2_35_x86_64.whl
rainbow_rb_zenoh-0.11.2-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.2-cp312-cp312-manylinux_2_35_aarch64.whl
rainbow_rb_zenoh-0.11.2-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details for rainbow_rb_zenoh-0.11.2-cp311-cp311-win_amd64.whl
rainbow_rb_zenoh-0.11.2-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.2-cp311-cp311-manylinux_2_35_x86_64.whl
rainbow_rb_zenoh-0.11.2-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.2-cp311-cp311-manylinux_2_35_aarch64.whl

Total release size: 53.2 MB

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

Download URL rainbow_rb_zenoh-0.11.2-cp313-cp313-win_amd64.whl
Size 6.0 MB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
d5569ba79db3c7a2a82feb535ad74c70fbe07d4d619c38e717583a9900020df8
BLAKE2b-256 checksum
How to use checksums
97dc055cda9d23ef4c414cef9a83b6ca5d64089d50265a18f0c6351955092bdf
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.2-cp313-cp313-manylinux_2_35_x86_64.whl

Download URL rainbow_rb_zenoh-0.11.2-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
dfc2b69fb9eb0572232355bc19b60262080ba19152af24717941e827b0709793
BLAKE2b-256 checksum
How to use checksums
4a2ab21ab961c0dd90ccd929e84ed03f306b09a6d5321587dc0cc2781e9432b6
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.2-cp313-cp313-manylinux_2_35_aarch64.whl

Download URL rainbow_rb_zenoh-0.11.2-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
4060c45ea2c4a2aaef1e593722c19b490e8b708f364aab620ba540a76dede058
BLAKE2b-256 checksum
How to use checksums
e93a2e9e61a97a46fd7e1ef647ba618ead22ab44ebb4d8bddcf9be3b5ce2e4d3
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.2-cp312-cp312-win_amd64.whl

Download URL rainbow_rb_zenoh-0.11.2-cp312-cp312-win_amd64.whl
Size 6.0 MB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
9d50dc4674c4244bd942b725e78acad337df16b858d2ebca61ba221d04a9f63d
BLAKE2b-256 checksum
How to use checksums
27ac8fd5cb498a8bbc3e4a1820b139eb53b24a02201bece01f51008fe027bc02
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.2-cp312-cp312-manylinux_2_35_x86_64.whl

Download URL rainbow_rb_zenoh-0.11.2-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
6411f1917e300b4bd1b93269ff423ec95e764eaaa8a1a2bd6649ea9b5c397f04
BLAKE2b-256 checksum
How to use checksums
eb4d65fed26a0ca5ae505a6ec34e7af13716eebf5d75eee114fb701729f65584
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.2-cp312-cp312-manylinux_2_35_aarch64.whl

Download URL rainbow_rb_zenoh-0.11.2-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
a8b488aa96c9f8299505f0185e91527c8e6e158f163e5261899fb0c4e969fa5f
BLAKE2b-256 checksum
How to use checksums
4a7934b11d0d0f59a9486272efe3fb82e162ee9ed9eec61ebd2e0092c11baea0
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.2-cp311-cp311-win_amd64.whl

Download URL rainbow_rb_zenoh-0.11.2-cp311-cp311-win_amd64.whl
Size 6.0 MB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
dc463a214f6e8d54d34b7fc0aadf34c4df7d6520d305d4cf3c69b5fc39b631d1
BLAKE2b-256 checksum
How to use checksums
17dfc08ec9f9567e1fefb648263f88c4e2c50ae950dc725e6d7e677dca109236
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.2-cp311-cp311-manylinux_2_35_x86_64.whl

Download URL rainbow_rb_zenoh-0.11.2-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
54bca53006bb1cf8acd8e817fff7eee6f9fcbeb33c505fb8e49da15382b870cb
BLAKE2b-256 checksum
How to use checksums
1f1b2c1d77de1642ead2db6f8a212693ca5514dc7be8fe449ca36b0c4ce7f64c
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.2-cp311-cp311-manylinux_2_35_aarch64.whl

Download URL rainbow_rb_zenoh-0.11.2-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
b5827895f4307686b9f7f80b2fa963f44d73e3b5d804502044763e4457f53b02
BLAKE2b-256 checksum
How to use checksums
4eb40166854f12c12422649d8f7892f1cbcdb2fb227d1ab919051d7eb8541f81
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.2

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.2 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