python-backoff
Function decoration for backoff and retry
Decision gist · record as of 2026-08-14
Yes. backoff is a lightweight, actively maintained library with zero dependencies, permissive MIT licensing, and broad Python version support. It solves a common problem (retry logic) cleanly and flexibly, with no security vulnerabilities. Install it if you need to add resilience to functions that interact with unreliable external resources.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.9 or later.
- Low friction installation with no runtime dependencies.
- Actively maintained with a recent release 6 days ago and support for current Python versions (3.9 through 3.15).
License · maintenance · safety
MIT (permissive) — MIT license permits unrestricted use, modification, and distribution with minimal legal obligations—suitable for both open-source and commercial projects.
last release 2026-08-08 (6 days) · last repo commit 2026-08-14 · 25 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 4,621,238 downloads/mo, #2,272 on PyPI
Alternatives
Verify before relying
pip install python-backoff
import backoff
@backoff.on_exception(backoff.expo, Exception, max_tries=5)
def my_function():
# function body
pass
my_function()- Whether the package handles connection pooling or maintains state across retries beyond what the decorator itself manages.
- Performance characteristics when used with high-frequency polling or many concurrent decorated functions.
What it is and what it does
backoff is a decorator library for adding retry logic to Python functions. It wraps functions to automatically re-execute them when they fail, using configurable wait strategies (exponential, fibonacci, constant, or custom) between attempts. The library supports both exception-based retries (when a specific exception is raised) and predicate-based retries (when a function's return value meets a condition), making it useful for handling transient failures in network calls, API requests, or resource polling.
The package is designed for unreliable resources and intermittent failures—typical scenarios include HTTP requests, database connections, and external API calls. It supports both synchronous functions and asyncio coroutines, offers fine-grained control over retry limits (by attempt count or elapsed time), and includes jitter algorithms to prevent thundering herd problems. You can combine multiple decorators, inspect exceptions before deciding whether to retry, and configure behavior at runtime via callables.
Use it for
- Retry HTTP requests with exponential backoff when network timeouts or transient errors occur.
- Poll an external API or queue at regular intervals until a non-empty result is returned.
- Automatically retry database operations that fail due to temporary connection issues.
- Handle rate-limiting by respecting Retry-After headers via the runtime backoff generator.
- Wrap asyncio coroutines to retry async I/O operations with configurable backoff strategies.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
backoff is a lightweight, actively maintained library with zero dependencies, permissive MIT licensing, and broad Python version support. It solves a common problem (retry logic) cleanly and flexibly, with no security vulnerabilities. Install it if you need to add resilience to functions that interact with unreliable external resources.
Install
python-backoff on PyPI
Before you install
Low friction installation with no runtime dependencies. Actively maintained with a recent release 6 days ago and support for current Python versions (3.9 through 3.15).
Requires Python 3.9 or later.
License in practice
MIT license permits unrestricted use, modification, and distribution with minimal legal obligations—suitable for both open-source and commercial projects.
Quickstart
pip install python-backoff
import backoff
@backoff.on_exception(backoff.expo, Exception, max_tries=5)
def my_function():
# function body
pass
my_function()
Verify before relying
- Whether the package handles connection pooling or maintains state across retries beyond what the decorator itself manages.
- Performance characteristics when used with high-frequency polling or many concurrent decorated functions.
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.9 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | None |
| Maintenance | Actively maintained 6 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 4,621,238 / month, #2,272 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableIntended Audience :: DevelopersNatural Language :: EnglishOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.15Programming Language :: Python :: 3.9Topic :: Internet :: WWW/HTTPTopic :: Software Development :: Libraries :: Python ModulesTopic :: Utilities |
Evidence: python_backoff-2.4.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
An agent finds packages by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language. Give your agent the search over MCP.
More Python Modules packages
Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.
Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.
Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.
PyYAML parses and emits YAML 1.1 data format, enabling serialization and deserialization of configuration files and Python objects to and from human-readable YAML text.
Pydantic validates Python data structures against type hints, coercing and checking input at runtime to ensure it matches a declared schema.
Provides reusable metadata objects for use with PEP-593 `typing.Annotated` to express common constraints like bounds, collection sizes, and predicates on types.
Install it if you use or build libraries that need to express type constraints in a standardized, inspectable way—or if you want to annotate your own types with…
Provides runtime tools to inspect and introspect Python type annotations, enabling programmatic examination of type hints at execution time.
See also backoff · backoff-utils · reretry · retry2 · retry · justbackoff · waiter · python-retry · stamina · redo