Skip to main content

Unified resilience patterns — retry, circuit breaker, rate limiter, timeout, bulkhead, fallback.

Project description

crashbytes-resilience

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

Install

pip install crashbytes-resilience

Usage

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

crashbytes_resilience-1.1.5.tar.gz (42.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

crashbytes_resilience-1.1.5-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file crashbytes_resilience-1.1.5.tar.gz.

File metadata

  • Download URL: crashbytes_resilience-1.1.5.tar.gz
  • Upload date:
  • Size: 42.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for crashbytes_resilience-1.1.5.tar.gz
Algorithm Hash digest
SHA256 3b6c1e09eb244f611c10adfcfc6b6182731641d6edd853f9b56c3799e5aa99f3
MD5 bdb6a578204f76a04210405f24b96fec
BLAKE2b-256 aa3e5f7e3aa7e2f2d4fdf9e8cdd4b16b26eba55702c798873317399df23a9bac

See more details on using hashes here.

Provenance

The following attestation bundles were made for crashbytes_resilience-1.1.5.tar.gz:

Publisher: publish.yml on CrashBytes/crashbytes-resilience

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file crashbytes_resilience-1.1.5-py3-none-any.whl.

File metadata

File hashes

Hashes for crashbytes_resilience-1.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 849c06bb758cf4dcf312120cdd00d34eba50290e405decb0e42ed63e2b9b82d9
MD5 fa025700911baa73c073006648e7fdab
BLAKE2b-256 97c7e0d8e5db132528c3af8980e714d3183daae3d9fb3190513de9f0d6f29115

See more details on using hashes here.

Provenance

The following attestation bundles were made for crashbytes_resilience-1.1.5-py3-none-any.whl:

Publisher: publish.yml on CrashBytes/crashbytes-resilience

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page