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

File metadata

  • Download URL: swarmauri_publisher_redis-0.3.0.dev45.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.dev45.tar.gz
Algorithm Hash digest
SHA256 ca54ec1fe90a411696d0f0f330126e52f4d7f9cc74e6184e6985438c31019559
MD5 95c0967164378f65f55d473f522289f9
BLAKE2b-256 494493508fbc3a7d7eabd52c72375fd840375300bdbd28554298755e49c19213

See more details on using hashes here.

File details

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

File metadata

  • Download URL: swarmauri_publisher_redis-0.3.0.dev45-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.dev45-py3-none-any.whl
Algorithm Hash digest
SHA256 9e8e20a417ff0da04b52bd26ef66b975d049799a5b9fee67fadd8e3b80ca5cb1
MD5 c42a59f17fc121bb67fc93fc2485d89e
BLAKE2b-256 1f85689a8ae10d3bba01bac0ea77334673361a13af6ae95e1e5bce599dfb38ae

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