HeadlinesBriefing favicon HeadlinesBriefing.com

Backon: Zero‑Dependency Python Retry Library with Async Support

Hacker News •
×

Python developers now have a lightweight retry library called backon. The tool, written in pure Python, removes external dependencies and supports both synchronous and async workflows. Its API surface includes decorators, a functional retry call, and a context manager, letting teams wrap fragile calls with minimal ceremony.

Backon ships with built‑in wait strategies such as exponential backoff, constant, Fibonacci, and randomized delays. Users can inject custom sleep functions, attach detailed callbacks, or enable a global toggle for testing. The library also ships a circuit‑breaker implementation and hedging support, allowing the first successful retry to win out of concurrent attempts.

Installation requires Python 3.10+, and the package is distributed via PEP 621 and py.typed metadata. Backon’s type hints are validated with mypy, and a full test suite offers disable_retries() and limit_retries() helpers for unit tests. The design prioritizes zero runtime overhead while exposing a rich set of hooks for observability.

Backon’s zero‑dependency footprint and modern API make it a compelling drop‑in for cloud‑native services that need reliable retry logic. Teams can replace older, heavier back‑off libraries without code churn, gaining better testability and lower bundle size in production.