Skip to main content

A simplified wrapper around the Zenoh SDK for pub/sub and request-reply patterns

Project description

AuraConnect

A simplified wrapper around the Zenoh Python SDK that makes it easier to use without dealing with async code directly.

Features

  • Simple declarative API with synchronous interface
  • Support for Publishers and Subscribers
  • Support for Query-Reply pattern
  • Handles all async code in the background

Installation

Prerequisites

  • Python 3.10 or higher
  • Zenoh dependencies

Setting up a virtual environment

# Create a virtual environment
python3 -m venv venv

# Activate the virtual environment
# On Linux/macOS
source venv/bin/activate
# On Windows
# .\venv\Scripts\activate

Install from source

cd aura_connect
# Install required dependencies
pip install -r requirements.txt

# Install package in development mode
pip install -e .

Usage

Basic Publisher/Subscriber

from aura_connect import AuraConnectClient

# Create a client
client = AuraConnectClient()

# Define a handler for received messages
def handle_message(key, value):
    print(f"Received on {key}: {value}")

# Declare a publisher and a subscriber
publisher = client.declare_publisher("demo/topic")
subscriber = client.declare_subscriber("demo/topic", handle_message)

# Publish a message
publisher.put("Hello, Zenoh!")

Query-Reply Pattern

from aura_connect import AuraConnectClient

# Create a client
client = AuraConnectClient()

# Define a handler for queries
def handle_query(key, value):
    request = value.decode() if value else ""
    print(f"Received query on {key}: {request}")
    return f"Response to: {request}".encode()

# Declare query server and client
query_server = client.declare_query_server("demo/query", handle_query)
query_client = client.declare_query_client("demo/query")

# Send a query and get responses
responses = query_client.query("What's your status?".encode())
for response in responses:
    print(f"Response from {response['key']}: {response['value'].decode()}")

Examples

See the examples directory for more complete examples:

  • basic_connect_example.py: Demonstrates basic pub/sub and query-reply functionality

Configuration

You can pass Zenoh configuration when creating the client:

config = {
    "mode": "peer",
    "listen": ["tcp/localhost:7447"]
}
client = AuraConnectClient(config)

Development

See the Development Guide for information on how to contribute to this project.

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

aura_connect-0.1.0.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

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

aura_connect-0.1.0-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file aura_connect-0.1.0.tar.gz.

File metadata

  • Download URL: aura_connect-0.1.0.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for aura_connect-0.1.0.tar.gz
Algorithm Hash digest
SHA256 68c192c2585e0b0713e3b155e551ccb10c7445033aee8066ab9767c046ef0576
MD5 198f841765f19d466ddb9c90fe34f42f
BLAKE2b-256 9c32ac6fe6b15c6fae56fef24f8e627f8de87981164774a9c98d13ac44a747d2

See more details on using hashes here.

Provenance

The following attestation bundles were made for aura_connect-0.1.0.tar.gz:

Publisher: build-aura-connect-package.yml on auraml/aurasim_utilities

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

File details

Details for the file aura_connect-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: aura_connect-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for aura_connect-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 266db5e9ac0ac7423c29910de469ae3c63b3b22e5e9eb2ea57d42ce8175d6c45
MD5 4d898f7d0897d62cb6d3e4b37e04b3ff
BLAKE2b-256 3081a3399af74daf7394fa4a2a82df0438583db394416f0071ab1dde331200b8

See more details on using hashes here.

Provenance

The following attestation bundles were made for aura_connect-0.1.0-py3-none-any.whl:

Publisher: build-aura-connect-package.yml on auraml/aurasim_utilities

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