Tools/hynek/stamina

stamina

Production-grade retries for Python

1.5k ★emergingPythonMIT License →trending

The Lens

By Erik Loyd, SaaS CEO and former COO/CFO of an AWS Premier Partner.

Updated Nov 2026

stamina makes retries in Python hard to get wrong. Decorate a function with stamina.retry, name the exceptions worth retrying, and it handles exponential backoff with jitter, a cap on attempts and a cap on total time. The defaults are sane out of the box: 10 attempts, 45 seconds total. MIT, free, from Hynek Schlawack of structlog.

It's a thin, opinionated wrapper around Tenacity, the long-standing retry library and its only dependency. Async uses the same API, including python-trio/trio. It ships hooks for Prometheus, structlog and standard logging, plus a testing switch that turns retries off globally so your test suite doesn't sit through backoff sleeps.

Use it anywhere code talks to a network: HTTP clients, database reconnects, queue consumers. Solo: free, add it the first time a flaky API wakes you up. Small teams: free, and it replaces the Tenacity config copy-pasted across services. Larger teams: free. The README pitches Tidelift support, but Sonar bought Tidelift and that link now lands on a Sonar product page.

The catch: it hides most of Tenacity's knobs on purpose, so check any exotic Tenacity setup before migrating. It needs Python 3.11 or newer, and it's essentially one maintainer's project.

Free vs Self-Hosted vs Paid

fully free

Free: Everything. MIT-licensed Python library on PyPI.

Self-hosted: N/A. Runs in your process; nothing to deploy.

Paid: No paid edition. The README advertises commercial support via the Tidelift Subscription, but Tidelift was acquired by Sonar in December 2024 and tidelift.com now redirects to Sonar's security product page; no stamina-specific price is published.

Completely free. Ignore the enterprise-support pitch unless you already buy Sonar.

What to do by team size

Solo
free
Small team
free
Medium team
free
Large team
free
Self-hosting ops:trivial

Get tools like this every Wednesday

One featured tool, three on the radar. No fluff.

Score
71/100 · B+
Adoption12/30
Maintenance25/25
Community9/20
License15/15
Analysis10/10

A low score is not a verdict on quality. Young and niche tools start low by design. How we calculate scores

Trust Signals

Community discussions enabledNotable author: 2,004 followers

License: MIT License

Use freely, including commercially. Keep the license notice.

Commercial use: ✓ Yes

About

Owner
Hynek Schlawack (User)
Stars
1,476
Forks
27

Explore Further

More tools in the directory