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.3.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.3.0-py3-none-any.whl (17.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: unbreak-0.3.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.3.0.tar.gz
Algorithm Hash digest
SHA256 c79e03e8ec3fefed2eac4ec1ca5af070da27eeff233daddb69de54968d96434a
MD5 bd9e2ec9e8693134fc85a7049609bee6
BLAKE2b-256 1ec912753e482c4c73d4af23af7180e967a2405867e9d9acc55cc89c327bde79

See more details on using hashes here.

File details

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

File metadata

  • Download URL: unbreak-0.3.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.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 289e1351cf553a3c04959401f9196d023322420fd945ed8e02e2b72495dbdfff
MD5 4fe932aab33912d0f92ef1a3a2d998c2
BLAKE2b-256 d79a9e4883ead1d8e5f8d588f8423fc2743caa42bb3d3987d765efedba28356b

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