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

Uploaded Python 3

File details

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

File metadata

  • Download URL: unbreak-0.2.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.2.0.tar.gz
Algorithm Hash digest
SHA256 b64a9b2cb9f8adef3306f72f823c029ba0c58faf4bb7e1d095a866f4d142ab1d
MD5 fe79d4ba0552b14575ac87de934c94e7
BLAKE2b-256 036569a59f2c872ca6264f1cad1445a4c65e32eeca9267e6669c17047c843a0b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: unbreak-0.2.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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 646766af6e5619af283c9feb5f4bc360eb85ba08becdb8a9267d0fe306142372
MD5 53b1c69801b5fbb4eb3fba9a3251b989
BLAKE2b-256 d5cb27535bd9e10fd55dd028ea6ca7d214d0572fb6a1ed5b356a3b8ffaf6f157

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