aiobreaker-redis
🛡 Distributed async circuit breaker for Python
asyncio,httpx, andFastAPIwith Redis state synchronization.
💡 Features
- ⚡️ Pure
asyncioFirst: Zero blocking I/O, built natively for Python async/await applications. - 🌐 Distributed Redis State: Synchronize circuit breaker status (
CLOSED,OPEN,HALF_OPEN) across multiple Gunicorn/Uvicorn worker processes and Kubernetes pods. - 🎯 Fast Fallbacks: Execute sync or async fallbacks instantly when circuits trip open.
- 🚀 FastAPI &
httpxReady: Clean@breaker.wrap(fallback=...)decorator for API endpoints and HTTP client wrappers.
📦 Installation
pip install aiobreaker-redis
🚀 Quick Usage
import httpx
from aiobreaker_redis import CircuitBreaker, CircuitOpenError
breaker = CircuitBreaker(
name="payment-gateway",
failure_threshold=5,
recovery_timeout=30.0,
# Optional redis client:
# redis_client=redis_client
)
async def payment_fallback():
return {"status": "queued", "message": "Payment service temporarily unavailable"}
@breaker.wrap(fallback=payment_fallback)
async def charge_card(amount: float):
async with httpx.AsyncClient() as client:
response = await client.post("https://api.payments.com/charge", json={"amount": amount})
response.raise_for_status()
return response.json()
📄 License
MIT © Raj Dubey
Metadata
Release files for aiobreaker-redis 0.1.0
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 |
|---|---|---|---|---|
| aiobreaker_redis-0.1.0.tar.gz | 4.5 kB | Without provenance | Details for aiobreaker_redis-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| aiobreaker_redis-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for aiobreaker_redis-0.1.0-py3-none-any.whl |
Total release size: 9.7 kB
Release files / aiobreaker_redis-0.1.0.tar.gz
| Download URL | aiobreaker_redis-0.1.0.tar.gz |
|---|---|
| Size | 4.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
22e3ec8fa3775e05d5cdb6681fb1ecc824c14f9d82860a72d405d2613f72cc9f
|
|
BLAKE2b-256 checksum How to use checksums |
43aa380fc11559a4852ea6196f29d5e2e30f53ad751d7307de2feb6b0d6a09c0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.4
|
Release files / aiobreaker_redis-0.1.0-py3-none-any.whl
| Download URL | aiobreaker_redis-0.1.0-py3-none-any.whl |
|---|---|
| Size | 5.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d77aadcd19ea8fe77c97b5112eb42697e5314b8247f2f9b1a275ade2cadac08d
|
|
BLAKE2b-256 checksum How to use checksums |
ae46b4b77544aaa7c5d7f76b98f05f84c5f8dcacca67ee5f018bc4df70d60c2f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.4
|
Security for aiobreaker-redis 0.1.0
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.