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

File metadata

  • Download URL: swarmauri_publisher_redis-0.3.0.dev32.tar.gz
  • Upload date:
  • Size: 7.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.3 {"installer":{"name":"uv","version":"0.10.3","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.dev32.tar.gz
Algorithm Hash digest
SHA256 11bc68be304f7dca3549061f3fe591f2ed4b61562f715afa6851171e81fb03ae
MD5 11e2c91d1a0923a6ca8c69cfe831cc4c
BLAKE2b-256 a8c7094b8171bdfe736fbe8de285c84b2664ce3a96a5ccd05ac8e20853baaaea

See more details on using hashes here.

File details

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

File metadata

  • Download URL: swarmauri_publisher_redis-0.3.0.dev32-py3-none-any.whl
  • Upload date:
  • Size: 8.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.3 {"installer":{"name":"uv","version":"0.10.3","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.dev32-py3-none-any.whl
Algorithm Hash digest
SHA256 609c1422f132396cf698ba30f10d3d8e2d03303f34237357140bc3c4adcfa20c
MD5 d6ce815a4b84a1e9c60016ac139539a7
BLAKE2b-256 6df0b967680b73fc6a020e15d8524e1fe7c2a8686b51565bbc4018c11e2b6712

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