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

File metadata

  • Download URL: swarmauri_publisher_redis-0.3.0.dev43.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.dev43.tar.gz
Algorithm Hash digest
SHA256 30a44432ff89a2ad1583d05b0117c0ce18869553bdc530992e975e3c50e5354d
MD5 5bd1831eaef18e9ca7deed175f056b6e
BLAKE2b-256 81bc9c02ebb50d6b62c1c41bd2f097ba13798aba924a744f7cc8724494f2bf1f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: swarmauri_publisher_redis-0.3.0.dev43-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.dev43-py3-none-any.whl
Algorithm Hash digest
SHA256 4388073c94471d9fd0c2f11314bbd3bbbc9991341a89489fcb9e61e6358f2a5d
MD5 276ebc0c9cd9226ce3bb8e8fcc3c0bc2
BLAKE2b-256 dbeb380cce5da551fe0c0bf2bd0793321ffa00a4affaffd720b29a67df23ed11

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