Metadata-Version: 2.4
Name: crashbytes-resilience
Version: 1.0.0
Summary: Unified resilience patterns — retry, circuit breaker, rate limiter, timeout, bulkhead, fallback.
Project-URL: Homepage, https://github.com/CrashBytes/crashbytes-resilience
Project-URL: Repository, https://github.com/CrashBytes/crashbytes-resilience
Project-URL: Issues, https://github.com/CrashBytes/crashbytes-resilience/issues
Author-email: CrashBytes <crashbytes@users.noreply.github.com>
License-Expression: MIT
License-File: LICENSE
Keywords: bulkhead,circuit-breaker,rate-limiter,resilience,retry,timeout
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Typing :: Typed
Requires-Python: >=3.10
Provides-Extra: dev
Requires-Dist: mypy; extra == 'dev'
Requires-Dist: pytest; extra == 'dev'
Requires-Dist: pytest-asyncio; extra == 'dev'
Requires-Dist: pytest-cov; extra == 'dev'
Requires-Dist: ruff; extra == 'dev'
Description-Content-Type: text/markdown

# crashbytes-resilience

Unified resilience patterns for Python — retry, circuit breaker, rate limiter, timeout, bulkhead, fallback. Zero dependencies. Sync + async. Thread-safe.

## Install

```bash
pip install crashbytes-resilience
```

## Usage

```python
from crashbytes_resilience import retry, circuit_breaker, timeout, fallback, pipeline

@retry(max_attempts=3, delay=0.5, backoff=2.0)
def fetch_data():
    ...

@circuit_breaker(failure_threshold=5, recovery_timeout=30)
def call_service():
    ...

@timeout(5.0)
async def slow_operation():
    ...

@fallback(lambda: {"cached": True})
def get_config():
    ...

# Compose patterns
@pipeline(retry(max_attempts=3, delay=0.1), timeout(5.0), fallback(lambda: None))
def resilient_call():
    ...
```

## Patterns

| Decorator | Description |
|-----------|-------------|
| `@retry()` | Retry with exponential backoff |
| `@circuit_breaker()` | Stop calling failing services |
| `@rate_limiter()` | Token-bucket rate limiting |
| `@timeout()` | Time-limit operations |
| `@bulkhead()` | Limit concurrent executions |
| `@fallback()` | Provide fallback on failure |
| `@pipeline()` | Compose multiple patterns |

All patterns work with both sync and async functions.

## License

MIT
