skillfed

python-retry

Retry package for Python

python-retry v0.0.1 138.8K downloads/30d#11,317 on PyPI5
Permissive license MIT License DORMANT released

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-retry

uv

uv add python-retry

poetry

poetry add python-retry

Installing 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

License :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3

Tags

retry decorator pythonautomatic retry logicexponential backoff retryexception retry handlerfunction retry wrapper
resiliencedecoratorerror-handling

More Software Development packages