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.dev42.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.dev42.tar.gz.

File metadata

  • Download URL: swarmauri_publisher_redis-0.3.0.dev42.tar.gz
  • Upload date:
  • Size: 7.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","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.dev42.tar.gz
Algorithm Hash digest
SHA256 77be10f55062cc30d451a2960ff5d8d19c04b95fe7aef417da779e5f5eeb9685
MD5 06282eb5bf02d86fe789c66133d22235
BLAKE2b-256 893fda74123004fd2e9bdfcc121089d535de7277c54f5ca17be54feaaf861e31

See more details on using hashes here.

File details

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

File metadata

  • Download URL: swarmauri_publisher_redis-0.3.0.dev42-py3-none-any.whl
  • Upload date:
  • Size: 8.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","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.dev42-py3-none-any.whl
Algorithm Hash digest
SHA256 0cb95a47b6d3029c15d64ffccd5695e16f5668c4f8ce4f12a7749f6ee27288e3
MD5 efc3066c13333ed250987114eba9b3f6
BLAKE2b-256 8a946472ba29f76f200258d1676a36e05ae6e4422db57a0e1c89635ddf875820

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