Skip to main content

Python bindings for zenoh-plugin-grpc

Project description

zenoh-grpc-python

Python bindings for zenoh-plugin-grpc.

Install

From this directory:

maturin develop

Or build a wheel:

maturin build

Or simply pip install:

pip install -e .

Start A Server First

Use either:

cargo run -p zenoh-bridge-grpc

or zenohd with the plugin loaded.

Minimal Example

import zenoh_grpc

with zenoh_grpc.Session.connect() as session:
    pub = session.declare_publisher("demo/example", encoding="text/plain")
    pub.put(b"hello", encoding="text/plain")

Session.connect() defaults to unix:///tmp/zenoh-grpc.sock, so the shortest form is:

with zenoh_grpc.Session.connect() as session:
    ...

Python-Style Optional Parameters

The binding keeps Python-style direct function calls and exposes extra gRPC options as optional keyword arguments. If you omit them, the plugin now falls back to Zenoh's native defaults instead of hard-coded wrapper defaults.

put/delete/reply* calls are enqueue-style: success means the request entered a local bounded queue. Slow receivers are also isolated behind local bounded queues, and when a queue is full the oldest item is dropped. Subscriber.dropped_count(), QueryStream.dropped_count(), ReplyStream.dropped_count(), Publisher.send_dropped_count(), and Queryable.send_dropped_count() expose those counters.

declare_subscriber(key_expr, callback=None, ...) and declare_queryable(key_expr, callback=None, ...) support inline callbacks. When a callback is provided, the binding runs it on a dedicated OS thread for that object and acquires the GIL for each event. Callback mode is exclusive with manual receive APIs. Queryables expose receiver() for pull mode, yielding a QueryStream that produces Query objects, and Session.get() / Querier.get() return iterable ReplyStream objects.

After replying to a query, call query.drop() when you are done, or use with receiver.recv() as query: so the query is finalized automatically on context-manager exit.

import zenoh_grpc

with zenoh_grpc.Session.connect() as session:
    pub = session.declare_publisher(
        "demo/example",
        encoding="text/plain",
        express=True,
    )
    pub.put(b"hello", encoding="text/plain")

    for reply in session.get("demo/example", timeout_ms=3000):
        if reply.ok:
            print(reply.sample.key_expr, reply.sample.payload)

Supported endpoint formats:

  • unix:///tmp/zenoh-grpc.sock
  • tcp://127.0.0.1:7335

Examples

See:

  • examples/pub.py
  • examples/sub.py
  • examples/sub_callback.py
  • examples/queryable.py
  • examples/queryable_callback.py
  • examples/querier.py
  • examples/get.py

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

zenoh_grpc-1.7.2.dev2026041624.tar.gz (44.1 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

zenoh_grpc-1.7.2.dev2026041624-cp38-abi3-manylinux_2_31_x86_64.whl (2.1 MB view details)

Uploaded CPython 3.8+manylinux: glibc 2.31+ x86-64

zenoh_grpc-1.7.2.dev2026041624-cp38-abi3-manylinux_2_31_aarch64.whl (2.2 MB view details)

Uploaded CPython 3.8+manylinux: glibc 2.31+ ARM64

File details

Details for the file zenoh_grpc-1.7.2.dev2026041624.tar.gz.

File metadata

  • Download URL: zenoh_grpc-1.7.2.dev2026041624.tar.gz
  • Upload date:
  • Size: 44.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for zenoh_grpc-1.7.2.dev2026041624.tar.gz
Algorithm Hash digest
SHA256 8e3e6d7ebc7fe7bdf51d54f51cc86c299914eb521be54ef5097eba60ce417a42
MD5 2a09512f0997e2b6cd77de1d34ed03ca
BLAKE2b-256 55787f91534863cc2d73d88f07bb690072827e1e0a3b7c43532a3a0289eba130

See more details on using hashes here.

Provenance

The following attestation bundles were made for zenoh_grpc-1.7.2.dev2026041624.tar.gz:

Publisher: nightly-build.yml on shupx/zenoh-plugin-grpc

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file zenoh_grpc-1.7.2.dev2026041624-cp38-abi3-manylinux_2_31_x86_64.whl.

File metadata

File hashes

Hashes for zenoh_grpc-1.7.2.dev2026041624-cp38-abi3-manylinux_2_31_x86_64.whl
Algorithm Hash digest
SHA256 200dbfd96a06ad72c288591c2dec69459d182bc8132ee5982559b323dedf7f9c
MD5 8016d11d8557abd881585647eb1b889c
BLAKE2b-256 cfde9fab6f00b72dac6f3da14908e4dbf4abaadc3b49a327d40f27d7a6bcae94

See more details on using hashes here.

Provenance

The following attestation bundles were made for zenoh_grpc-1.7.2.dev2026041624-cp38-abi3-manylinux_2_31_x86_64.whl:

Publisher: nightly-build.yml on shupx/zenoh-plugin-grpc

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file zenoh_grpc-1.7.2.dev2026041624-cp38-abi3-manylinux_2_31_aarch64.whl.

File metadata

File hashes

Hashes for zenoh_grpc-1.7.2.dev2026041624-cp38-abi3-manylinux_2_31_aarch64.whl
Algorithm Hash digest
SHA256 563a85c08b8334c19fd112e165d8e4b07c9a236aa7360195c57c6c3b4c911b40
MD5 aefc004dfbf99158fa6e8c7022c4bf66
BLAKE2b-256 1c4c943a256cce9b0fa3ce18211a0ba274c5cbc57f0b24e9f6be4ccc32442f17

See more details on using hashes here.

Provenance

The following attestation bundles were made for zenoh_grpc-1.7.2.dev2026041624-cp38-abi3-manylinux_2_31_aarch64.whl:

Publisher: nightly-build.yml on shupx/zenoh-plugin-grpc

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page