slck-mediator — Python
Cross-language Mediator pattern framework for Python.
Send/stream/publish · 11-middleware pipeline · outbox · inbox · saga · integration event bus · full observability.
Installation
pip install slck-mediator
With optional extras:
pip install "slck-mediator[otel]" # OpenTelemetry adapters
pip install "slck-mediator[sql]" # SQLAlchemy adapters
pip install "slck-mediator[mongo]" # Motor (MongoDB) adapters
pip install "slck-mediator[all]" # Everything
Quick Start
from mediator import Mediator, Request, ConsoleLogger, InMemoryMetrics, InMemoryTracer
class GreetCommand(Request[str]):
def __init__(self, name: str) -> None:
self.name = name
async def greet_handler(ctx, cmd: GreetCommand) -> str:
return f"Hello, {cmd.name}!"
async def main():
logger = ConsoleLogger()
metrics = InMemoryMetrics()
tracer = InMemoryTracer("app", logger, metrics)
m = Mediator(logger=logger, metrics=metrics, tracer=tracer)
m.register_request_handler(GreetCommand, greet_handler)
result = await m.send(GreetCommand("World"))
print(result) # Hello, World!
Code Generation
Generate a build-time direct-dispatch mediator from your feature handlers:
python tools/generate_mediator.py
Development
pip install -e ".[dev]"
pytest
Key modules:
tools/generate_mediator.py: build-time direct-dispatch generator for the example package with duplicate, missing-handler, polymorphic notification, generic-contract, and unsupported-constructor-or-factory diagnostics, and inherited-request-or-stream-contract diagnostics, and handler-or-message-discovery diagnosticsexample/generated_mediator.py: generated direct-dispatch, polymorphic notification resolution, service registration, typed mediator facade, and dependency-wiring factory used by the example composition rootmediator/mediator.py: async runtime mediator withsend,stream, andpublishmediator/registry.py: runtime request, stream, and notification registrymediator/pipeline.py: middleware behaviors including rate limiting and bulkhead controlsmediator/eventbus.py: integration event transports, including concrete Kafka producer, NATS client, RabbitMQ client, and SQS client-backed adapters, plus versioned JSON envelope serializersmediator/outbox.py: file-backed, in-memory, and adapter-backed outbox store, dead-letter store and replay manager, and workermediator/inbox.py: file-backed, in-memory, and adapter-backed idempotent consumer inbox supportmediator/saga.py: saga orchestration with durable file persistence and adapter-backed optimistic storesmediator/lifecycle.py: hosted worker lifecycle, health/readiness, and graceful shutdown coordinationmediator/fastapi.py: FastAPI dependency helperexample/main.py: runnable CQRS, stream, outbox, inbox, and saga demo using the generated service collection/provider integration and typed mediator facade
Built-in notification publishers: ForeachAwaitPublisher, TaskWhenAllPublisher, plus compatibility aliases for SequentialNotificationPublisher and ParallelNotificationPublisher.
Versioned integration messages use a canonical JSON envelope with specVersion, version, schema, occurredAt, and idempotencyKey, and the example logs both the serialized envelope and round-trip deserialization.
Metadata
Release files for slck-mediator 1.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| slck_mediator-1.0.2.tar.gz | 34.2 kB | Without provenance | Details for slck_mediator-1.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| slck_mediator-1.0.2-py3-none-any.whl | Python 3 | none | any | Details for slck_mediator-1.0.2-py3-none-any.whl |
Total release size: 71.6 kB
Release files / slck_mediator-1.0.2.tar.gz
| Download URL | slck_mediator-1.0.2.tar.gz |
|---|---|
| Size | 34.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
07bb1d7f0b800e9b1ff41cf4d614e32b4feb25385944d2d7cf23238253ec7245
|
|
BLAKE2b-256 checksum How to use checksums |
e126ba2d8d5982ade323fd14038aa8b9e10634ce9e67d133b6b7b86421f8f58e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.4
|
Release files / slck_mediator-1.0.2-py3-none-any.whl
| Download URL | slck_mediator-1.0.2-py3-none-any.whl |
|---|---|
| Size | 37.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d6cc3db72ed9e2d639ed41a3b85b59c0f0eee81f159f64338a9c1631e1bc6c7e
|
|
BLAKE2b-256 checksum How to use checksums |
7fddfd5028c1dc7fd1b34a17c1a0527de6dc190c979141dc8c5fbb60346054de
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.4
|
Security for slck-mediator 1.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.