--- id: retry2 version: "0.9.5" license: Apache License 2.0 license_treatment: permissive maintenance: dormant --- # retry2 — Easy to use retry decorator. License: permissive · Maintenance: dormant · Downloads: 2.2M/mo ## What it is and what it does retry2 is a decorator-based retry library that wraps function calls to automatically re-execute them when they fail with specified exceptions. It lets you configure the number of attempts, delay between retries, exponential backoff multipliers, random jitter, and optional logging of failures. The package is a maintained fork of an unmaintained original and aims to keep retry logic simple and dependency-light. You use it by decorating a function with @retry() and specifying which exceptions to catch, how many times to try, and how long to wait between attempts. It also provides a retry_call() function for cases where you need to apply retry logic dynamically rather than at definition time. The library preserves original tracebacks for debugging and can optionally use decorator to preserve function signatures. Use it for: - Wrap API calls to handle transient network failures with exponential backoff. - Retry database operations that may fail due to temporary locks or connection issues. - Implement resilience in web scraping or data-fetching tasks with configurable delays. - Add retry logic to background jobs or scheduled tasks without rewriting the function. - Dynamically adjust retry behavior at runtime using retry_call() based on application state. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Provides a decorator and function wrapper to automatically retry failed function calls with configurable delays, backoff, and exception handling. Yes, if you need straightforward retry logic with minimal dependencies. The low install friction, permissive license, and zero known vulnerabilities make it safe to adopt. However, the dormant maintenance status (last release 2023-01-11) means you should verify it handles your specific exception types and retry patterns before relying on it in production. ## Install pip install retry2 uv add retry2 poetry add retry2 ## Installing retry2 Before you install: Low friction: pure Python wheel with a single optional runtime dependency (decorator). Maintenance is dormant—last release was 2023-01-11 and the repository has not been updated since 2024-07-10, though it remains unarchived and carries no known vulnerabilities. License in practice: Apache License 2.0 is permissive; you can use, modify, and distribute this package freely in commercial and private projects with minimal restrictions. Quickstart: pip install retry2 from retry2 import retry @retry(exceptions=ValueError, tries=3, delay=1) def my_function(): pass my_function() Verify before relying: - Whether the package's dormant maintenance status affects its suitability for new projects or production use. - How well the package's retry semantics integrate with modern async/await patterns. - Whether the optional decorator dependency is required for your use case or only for signature preservation. ## Package facts - License: Apache License 2.0 (permissive) - Python support: supports_current - Install friction: low - Maintenance: dormant - Downloads: 2.2M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags retry decorator, automatic retry logic, exponential backoff, exception retry handler, function retry wrapper, retry with delay, resilience decorator, resilience, decorator, backoff [View on SkillFed](https://skillfed.io/packages/retry2) · [View on PyPI](https://pypi.org/project/retry2/)