A Redis publisher implementation for Swarmauri.
Project description
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 asredis://[:password]@host:port/db.host,port,db: Required whenuriis 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.dumpsbefore 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file swarmauri_publisher_redis-0.3.0.dev46.tar.gz.
File metadata
- Download URL: swarmauri_publisher_redis-0.3.0.dev46.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dc4b81d571921cfd20c6067d0d68fed6f2fa5ef4960dbf4d9374eb4cd9bfc041
|
|
| MD5 |
ca6b737566087822963c4b385a41548c
|
|
| BLAKE2b-256 |
0c179c840d21058b0079babe15132d7206add2403a645249d4e0953611c5b16b
|
File details
Details for the file swarmauri_publisher_redis-0.3.0.dev46-py3-none-any.whl.
File metadata
- Download URL: swarmauri_publisher_redis-0.3.0.dev46-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e22845783c4e5c7108e2763df6126f281e4b80b65fe655e8a13f27798f1cdf62
|
|
| MD5 |
59d5d10b5e130b3d4c7fc30fa81772b9
|
|
| BLAKE2b-256 |
1ed67576d67e6df90df535f7a5d9dc4a0105870aa569711214b55d8a0bbb51a5
|