Skip to main content

A Redis publisher implementation for Swarmauri.

Project description

Swarmauri Logo

PyPI - Downloads Hits PyPI - Python Version PyPI - License PyPI - swarmauri_publisher_redis


Swarmauri Redis Publisher

swarmauri_publisher_redis provides a Redis Pub/Sub publisher that conforms to the Swarmauri PublishBase interface. The publisher serializes dictionaries to JSON before sending them to Redis channels, making it easy to exchange structured messages across your Swarmauri deployments.

Installation

Choose the workflow that matches your project setup:

# Using pip
pip install swarmauri_publisher_redis

# Using Poetry
poetry add swarmauri_publisher_redis

# Using uv (https://docs.astral.sh/uv/)
uv add swarmauri_publisher_redis
# or install into the active environment
uv pip install swarmauri_publisher_redis

Configuration

RedisPublisher accepts either a complete Redis connection URI or the individual connection settings. Mixing the two configuration styles is not supported.

  • uri: Full Redis URI such as redis://[:password]@host:port/db.
  • host, port, db: Required when uri is not provided. The publisher constructs the URI for you.
  • username, password: Optional credentials used when building the URI.

If neither a URI nor the full host/port/db combination is supplied, initialization raises a ValueError.

Usage

The publisher creates a Redis client from your connection information and publishes JSON-encoded payloads.

from swarmauri_publisher_redis import RedisPublisher

publisher = RedisPublisher(
    host="localhost",
    port=6379,
    db=0,
)

publisher.publish("my_channel", {"message": "Hello Redis!"})

Using a Redis URI

You can also configure the publisher with a pre-built connection string:

from swarmauri_publisher_redis import RedisPublisher

publisher = RedisPublisher(uri="redis://localhost:6379/0")
publisher.publish("alerts", {"severity": "info", "detail": "It works!"})

Additional Notes

  • Payloads are serialized with json.dumps before being sent to Redis.
  • A Redis server must be reachable for the publish call to succeed outside of tests.

Want to help?

If you want to contribute to swarmauri-sdk, read up on our guidelines for contributing that will help you get started.

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

swarmauri_publisher_redis-0.3.0.dev36.tar.gz (7.6 kB view details)

Uploaded Source

Built Distribution

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

File details

Details for the file swarmauri_publisher_redis-0.3.0.dev36.tar.gz.

File metadata

  • Download URL: swarmauri_publisher_redis-0.3.0.dev36.tar.gz
  • Upload date:
  • Size: 7.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for swarmauri_publisher_redis-0.3.0.dev36.tar.gz
Algorithm Hash digest
SHA256 c99f2fd5518588ca16746d9517b15d9c6356dec2fab0818a54fef43b63a39078
MD5 5cf3fcc3b0fdfa9e1b63de1df69aacdf
BLAKE2b-256 1a844c6e78e4537c758225cf3c7a1f40a90d700c89e803d6fcf3a29bdb84eeeb

See more details on using hashes here.

File details

Details for the file swarmauri_publisher_redis-0.3.0.dev36-py3-none-any.whl.

File metadata

  • Download URL: swarmauri_publisher_redis-0.3.0.dev36-py3-none-any.whl
  • Upload date:
  • Size: 8.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for swarmauri_publisher_redis-0.3.0.dev36-py3-none-any.whl
Algorithm Hash digest
SHA256 8dd5c3cd90f9085d46786fdcfedee66b25bc5f128fa2d9a77c398fa524e42fbb
MD5 941299b296d5f5e495fc3d45eb0bea74
BLAKE2b-256 ce9ecfaac2be7378a14f1813af5b9b32fe9daa5f4b0ce205c3bdc60405a476e7

See more details on using hashes here.

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