Skip to main content

pamoja-zenoh

Zenoh key expressions: validity, canonical form, matching, and whether two expressions share or cover keys. One capability of pamoja, one memory-safe Rust core with bindings for TypeScript, Python, and C#.

read the guide documentation API reference

Install

pip install pamoja-zenoh
from pamoja import zenoh

This pulls in pamoja-native, the compiled engine. pip install pamoja is the whole framework in one package.

Example

The script the test suite runs, spliced here as it ran.

From bindings/python/guides/zenoh.py:

from pamoja.zenoh import canonize, is_canon, is_valid, join, matches


# A key expression names a set of keys. Chunks sit between slashes, `*` stands for exactly one
# chunk, whatever it holds, and `**` for any number of them, including none.
def selects(pattern: str, key: str) -> str:
    verdict = "covers" if matches(pattern, key) else "misses"
    return f"{verdict:<10}{pattern} {verdict} {key}"


print(selects("farm/*/power", "farm/t7/power"))
print(selects("farm/*/power", "farm/substation/power"))
print(f"{selects('farm/*/power', 'farm/row2/t14/power')}, since * is exactly one chunk")
print(selects("farm/**/power", "farm/row2/t14/power"))
print(f"{selects('farm/**/alarm', 'farm/alarm')}, where ** is no chunk at all")

# `$*` stands for any run of characters inside one chunk, so it selects on part of a name.
print(selects("farm/t$*/power", "farm/t7/power"))
print(selects("farm/t$*/power", "farm/substation/power"))

# One set of keys has one canonical spelling, and a Zenoh session accepts no other.
for written in ("farm/*/**/power", "farm/**/*/power", "farm/**/**/power"):
    canonical = canonize(written)
    if is_canon(written):
        print(f"canonical {written}, as written")
    else:
        print(f"rewritten {written} is spelled {canonical}")

# Joining places one expression beneath another, and canonizes the seam between them.
for prefix, suffix in (("farm/t7", "power"), ("farm/**", "*/power")):
    print(f"joined    {prefix} and {suffix} make {join(prefix, suffix)}")

# A malformed expression is refused rather than repaired into something plausible.
for written, why in (
    ("farm//power", "a chunk is empty"),
    ("farm/t7*/power", "* stands alone in its chunk, or after $"),
    ("farm/t7/power?", "? and # are reserved"),
):
    if not is_valid(written) and canonize(written) is None:
        print(f"malformed {written}, since {why}")

The same capability in every language

Language Package Reference
Rust pamoja-zenoh reference, docs.rs, install
TypeScript @pamoja/zenoh reference, install
Python pamoja-zenoh reference, install
C# Pamoja.Zenoh reference, install

Documentation

License

MIT

Metadata

Release files for pamoja-zenoh 0.2.1

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

Source distribution (sdist)

Source distribution for pamoja-zenoh 0.2.1
File Size Uploaded Provenance Actions
pamoja_zenoh-0.2.1.tar.gz 3.6 kB Without provenance Details for pamoja_zenoh-0.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pamoja-zenoh 0.2.1
File Interpreter ABI Platform Actions
pamoja_zenoh-0.2.1-py3-none-any.whl Python 3 none any Details for pamoja_zenoh-0.2.1-py3-none-any.whl

Total release size: 7.8 kB

Release files / pamoja_zenoh-0.2.1.tar.gz

Download URL pamoja_zenoh-0.2.1.tar.gz
Size 3.6 kB
Tags Source
SHA-256 checksum
How to use checksums
1fd3290604a014c8d0c0bbc1bc0e09a88ac86be898b06b0a128453b7d5611811
BLAKE2b-256 checksum
How to use checksums
b726c67f2af50a9e92436efbe3a346ab2b2aae47c69373b1f65f4f9bbce53713
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.18

Release files / pamoja_zenoh-0.2.1-py3-none-any.whl

Download URL pamoja_zenoh-0.2.1-py3-none-any.whl
Size 4.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
047e252c47d1d3baba8006311487a147f50887cfe3ef916605201716f5456223
BLAKE2b-256 checksum
How to use checksums
fbc9d8d126efec8d92d863dcfe81455f4b76bb9eba60336f8fbd151ab981b003
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.18

Security for pamoja-zenoh 0.2.1

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.

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