python-retry
Retry package for Python
What it is and what it does
Python Retry is a lightweight decorator library that wraps function calls to automatically retry them when they fail. It lets you specify how many times to retry, what exceptions should trigger a retry, and how long to wait between attempts—including exponential backoff. The package has no runtime dependencies, making it a minimal addition to any project that needs resilience against transient failures.
You apply it as a simple decorator above any function, optionally tuning its behavior with parameters like max_retries, backoff_factor, and retry_on to filter which exceptions warrant a retry. It can also suppress exceptions entirely and log retry attempts to a logger you provide.
Use it for:
- Wrap API calls that may fail transiently, retrying with exponential backoff before giving up
- Protect database queries or network operations from temporary connectivity issues
- Add resilience to file I/O operations that might fail due to transient system conditions
- Implement retry logic in test fixtures or setup/teardown code without rewriting the function
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides a decorator to automatically retry failed function calls with configurable stop conditions, wait strategies, and exception filtering.
Yes, if you need basic retry logic without external dependencies. The package is simple and permissively licensed. However, maintenance is dormant (no updates since 2022-03-11), so verify compatibility with your Python version and consider whether a more actively maintained alternative better suits long-term projects.
Install
python-retry on PyPI
pip
pip install python-retryuv
uv add python-retrypoetry
poetry add python-retryInstalling python-retry
Before you install
Low install friction with no runtime dependencies. Maintenance is dormant—last release was 2022-03-11 with no updates since, though the repository remains active and has received a recent commit (2024-04-12).
License in practice
MIT License permits unrestricted use, modification, and distribution with minimal obligations—suitable for both open-source and proprietary projects.
Quickstart
pip install python-retry
from python_retry import retry
@retry(max_retries=2, backoff_factor=1)
def call_api():
# function body
pass
call_api()
Requires Python 3.6 or later (package specifies requires_python >= 3.6).
Verify before relying
- Whether the package handles async/await functions or only synchronous callables
- Current test coverage and whether the test suite remains passing under modern Python versions
Package facts
| License | MIT License (permissive) |
| Python support | supports the current Python release (>=3.6) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | dormant — 1,617 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 138,784/month — #11,317 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: python_retry-0.0.1-py3-none-any.whl
Keywords: python, retry
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
retryingRetrying is a decorator-based library that adds…
permissive · top 1,000 on PyPI
eth-retryA decorator that automatically retries…
permissive · top 15,000 on PyPI
retryProvides a decorator and function wrapper for…
permissive · top 1,000 on PyPI
aiohttp-retryWraps aiohttp's ClientSession to automatically…
permissive · top 1,000 on PyPI
reretryA decorator and function wrapper for retrying…
permissive · top 15,000 on PyPI
retry2Provides a decorator and function wrapper to…
permissive · top 5,000 on PyPI
tenacityTenacity is a retry library that adds automatic…
permissive · top 100 on PyPI
backoffProvides function decorators to automatically…
permissive · top 1,000 on PyPI
awsretryA decorator that wraps AWS API calls to…
permissive · top 15,000 on PyPI
python-backoffProvides function decorators for retrying…
permissive · top 5,000 on PyPI