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.5.0.tar.gz (35.5 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.5.0-py3-none-any.whl (17.6 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for unbreak-0.5.0.tar.gz
Algorithm Hash digest
SHA256 2a377ee7a87074ebfa8f26fb446f50cc45dd3caab7e9060d84d65585ea04d14d
MD5 011cd8da9ac1ae1ef17c399a0345ffe4
BLAKE2b-256 048ad47fa4675f651df9851de5df749e700a5550d6d18687a05ea20219b0be12

See more details on using hashes here.

File details

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

File metadata

  • Download URL: unbreak-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 17.6 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.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4a641056d83e29ad5e5c451765ecb3530108d68e790712c97a8f9c33483403a2
MD5 386ec86154a92583d95f6aa4388cbcee
BLAKE2b-256 6e35770b6a39c89edb67ef37dabab52652ceddce2ba8f2d91399a5b0b6222592

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