--- id: stamina version: "26.1.0" license: MIT license_treatment: permissive maintenance: active --- # stamina — Production-grade retries made easy. License: permissive · Maintenance: active · Downloads: 5.8M/mo ## What it is and what it does Stamina is a retry library built on top of Tenacity that simplifies resilience patterns in distributed systems. It provides a decorator-based API that handles transient failures with exponential backoff, jitter, and configurable attempt and timeout limits. The library is designed to do the right thing by default—retrying only specified exceptions, respecting both attempt counts and total time budgets, and automatically supporting async functions including Trio. The package includes first-class support for instrumentation via Prometheus, structlog, and standard logging, plus dedicated testing utilities to globally disable or limit retries during test runs. Type hints are preserved on decorated functions, and the same API works for both sync and async callables as well as arbitrary code blocks, making it suitable for I/O-heavy workloads where transient failures are common. Use it for: - Decorate functions to automatically retry on transient errors with exponential backoff and jitter. - Retry async functions with the same API as sync functions, including Trio support. - Instrument retry behavior with Prometheus metrics or structured logging for observability. - Globally disable retries in test suites or limit retry attempts to speed up test execution. - Configure both attempt count and total timeout limits to bound retry behavior. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Stamina wraps Tenacity to provide a production-ready retry decorator with sensible defaults: exponential backoff with jitter, attempt and timeout limits, exception filtering, and built-in async support for asyncio and Trio. Yes. Stamina is actively maintained with no known vulnerabilities and low install friction. It solves a real problem—production-grade retries—with sensible defaults and a clean API. Use it when you need resilience in distributed systems and want to avoid copy-pasting retry logic. ## Install pip install stamina uv add stamina poetry add stamina ## Installing stamina Before you install: Low install friction; pure Python wheel with a single runtime dependency (tenacity). Actively maintained with recent commits and 1440 GitHub stars. Supports Python 3.10 through 3.14. License in practice: MIT license (permissive) allows use in commercial and proprietary projects with minimal restrictions; attribution required but no copyleft obligations. Quickstart: pip install stamina import stamina @stamina.retry(on=Exception, attempts=3) def do_it(): pass Requires Python 3.10 or later. Verify before relying: - Whether Prometheus instrumentation requires additional dependencies beyond tenacity. - How structlog integration behaves when structlog is not installed. - Performance overhead of retry instrumentation in high-throughput scenarios. - Specific exception types and filtering capabilities beyond what the description excerpt shows. ## Package facts - License: MIT (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 5.8M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags retry decorator with backoff, exponential backoff retry, async retry library, production retry handling, resilient distributed systems, transient failure retry, tenacity wrapper, resilience, observability [View on SkillFed](https://skillfed.io/packages/stamina) · [View on PyPI](https://pypi.org/project/stamina/)