finds.dev

litl/backoff

Python library providing function decorators for configurable backoff and retry

View on GitHub

★ 2,697PythonMITupdated May 2024

// the take

A Python decorator library for adding exponential backoff and retry logic to functions. Works with both sync and async code, targeting the common case of flaky network calls and external APIs. Does one thing and does it well.

Supports `backoff.runtime` to read retry delay from response headers like `Retry-After` — that's the right way to handle 429s and most libraries miss it. The `giveup` callable lets you short-circuit retries on 4xx errors without wrapping everything in try/except. Full jitter is the default and follows the AWS guidance correctly. Async support is first-class, not bolted on — coroutines work with the same decorators as sync functions.

CI still references Travis CI which has been effectively dead for open-source for years — signals the project isn't actively maintained (last push May 2024, no commits since). No built-in support for context managers or `with` blocks, so you can't retry a block of code without wrapping it in a function. The event handler dict interface is stringly-typed — you get a plain dict with magic keys rather than a typed dataclass, which is annoying in 2024. No native integration with `tenacity`, which has largely superseded this library and offers a richer feature set for anything beyond basic use.

We read the README, the directory tree and a key source file in June 2026. Nobody pays to be listed. How we judge →

// at a glance

Stars
2,697
Forks
155
Language
Python
License
MIT
Last commit
2 May 2024

// nearby

If backoff isn't quite it.

All repos →