Skip to main content

Make your Python functions unbreakable — adaptive retries, predictive circuit breaker, fallback chains, and dead letter queues

Project description

unbreak

PyPI version Python versions License: MIT

Smart retry library with adaptive backoff, circuit breaker, fallback chains, and dead letter queues.

Install

pip install unbreak

Quick Start

import unbreak

@unbreak.retry(max=5, backoff="exponential")
def call_api():
    ...

# With circuit breaker
@unbreak.retry(max=5, circuit=True)
def call_api():
    ...

# Time budget mode
@unbreak.retry(budget="30s")
def call_api():
    ...

# Fallback chain
@unbreak.retry(max=3, fallback=[redis_get, db_query, lambda: "default"])
def call_api():
    ...

Features

  • Backoff strategies: fixed, exponential, adaptive (learns from response times)
  • Circuit breaker: sliding window, predictive degradation detection
  • Smart error detection: HTTP, DB, network, custom
  • Time budget mode: retries within a time window
  • Fallback chains: cascading fallbacks
  • Dead letter queue: in-memory, file (JSONL), custom backends
  • Coordinated jitter: distributed thundering herd prevention
  • Observability: structured event callbacks
  • Retry history: per-call timeline tracking
  • Async support: full asyncio support
  • Zero dependencies: stdlib only

License

MIT


Part of the thecliffhanger open source suite.

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

unbreak-0.4.0.tar.gz (35.4 kB view details)

Uploaded Source

Built Distribution

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

unbreak-0.4.0-py3-none-any.whl (17.5 kB view details)

Uploaded Python 3

File details

Details for the file unbreak-0.4.0.tar.gz.

File metadata

  • Download URL: unbreak-0.4.0.tar.gz
  • Upload date:
  • Size: 35.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.5

File hashes

Hashes for unbreak-0.4.0.tar.gz
Algorithm Hash digest
SHA256 34d6c9f9d45c19ce7e96e2b4a1df993da7f7f3e0ef4da7bd567928920eb74338
MD5 8611d41b3e6bf5c31d77e20d48818e5b
BLAKE2b-256 a138003e954169672e6e36ed3cb8314fc51c8342b903c453f701f69da61480ca

See more details on using hashes here.

File details

Details for the file unbreak-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: unbreak-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 17.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.5

File hashes

Hashes for unbreak-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e809816ecacea19563fe4b80a5d33d605dcd9d8784139446353dc72c65e09566
MD5 9e095ed0ca64eeaefd4cefec41dd3e3a
BLAKE2b-256 0c88a5cd9ea2031e2c2e15dfe3c61a15b31f273df554ad0ce90d463120f59463

See more details on using hashes here.

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