Redis-streams transport for clamator (pre-1.0).
Project description
clamator-over-redis
Redis-streams transport for clamator. Implements the Transport interface from clamator-protocol so JSON-RPC traffic flows over Redis streams between processes — typically a Py service and a TS service, or two Py services on different hosts.
Install
pip install clamator-over-redis clamator-protocol redis
Quickstart
Contracts are authored in TypeScript and the Python sibling is produced by @clamator/codegen:
npx @clamator/codegen --src contracts --out-py generated
The emitted generated/arith.py exports Pydantic models, a typed ArithClient, an ArithService ABC, and the arith_contract Contract object.
Server — subclass the generated ArithService ABC:
# server.py
import asyncio
from clamator_over_redis import RedisRpcServer
from generated.arith import (
AddParams, AddResult, PingParams, ArithService, arith_contract,
)
class Arith(ArithService):
async def add(self, params: AddParams) -> AddResult:
return AddResult(sum=params.a + params.b)
async def ping(self, params: PingParams) -> None:
pass
async def main() -> None:
server = RedisRpcServer(key_prefix="my-app")
server.register_service(arith_contract, Arith())
await server.start()
await asyncio.Event().wait() # serve until cancelled
if __name__ == "__main__":
asyncio.run(main())
Client — call methods on the generated ArithClient:
# client.py
import asyncio
from clamator_over_redis import RedisRpcClient
from generated.arith import ArithClient, AddParams
async def main() -> None:
transport = RedisRpcClient(key_prefix="my-app")
await transport.start()
arith = ArithClient(transport)
result = await arith.add(AddParams(a=2, b=3))
print(result) # AddResult(sum=5)
await transport.stop()
if __name__ == "__main__":
asyncio.run(main())
By default the connection is built from $REDIS_URL (or redis://localhost:6379). Pass redis_url= for a different URL, or redis= for a pre-built redis.asyncio.Redis instance.
Key surface
RedisRpcServer(*, key_prefix, redis=None, redis_url=None, ...)—register_service(contract, handler_obj),start(),stop().RedisRpcClient(*, key_prefix, redis=None, redis_url=None, default_timeout_ms=30_000)—start(),stop(). The instance is aClamatorClient, so it can be wrapped by a generated*Clientproxy.
When to reach for this vs. clamator-over-memory
clamator-over-memory— tests, embedded scenarios, anything single-process.clamator-over-redis— cross-process, cross-host, durable streams, production.
Links
- Sibling (TypeScript):
@clamator/over-redis - Codegen:
@clamator/codegen(run from TS side; consume the generated Python output) - Design spec:
docs/2026-05-07-clamator-design.md - Agent rules:
AGENTS.md
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 clamator_over_redis-0.1.1.tar.gz.
File metadata
- Download URL: clamator_over_redis-0.1.1.tar.gz
- Upload date:
- Size: 9.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9f0e446b5d208c64fe2dda3bd41f23c406216735b5c8ef86ea97a8107822dc09
|
|
| MD5 |
0cb13917b4f07774c1c0b0a69e7c592a
|
|
| BLAKE2b-256 |
5f2e6e5e41e6c029362d43024ec5846ab405520f2186e414279c8f6917f05bfe
|
File details
Details for the file clamator_over_redis-0.1.1-py3-none-any.whl.
File metadata
- Download URL: clamator_over_redis-0.1.1-py3-none-any.whl
- Upload date:
- Size: 12.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d79c5846d80fbab5ba47f45e7ada3eec56f788fbe34bb5adc89a9aa51e9dfe67
|
|
| MD5 |
e2fce7639d8805292d692c29e214a862
|
|
| BLAKE2b-256 |
0eb602b2660cd79d3ddb329ebdd266f832f9cd32bf6408c8ff8de323c7b7fcb6
|