Skip to main content

stamina

PyPI - Version PyPI - Python Version License: MIT

Transient failures are common in distributed systems. To deal with them, you need to retry failed operations. Tenacity is an amazing and beautifully composable toolkit for handling retries that I've been using it for years. In practice, I've found myself to use only very few knobs and wished it wouldn't erase the types of the callables that I decorate with @tenacity.retry.

stamina is an opinionated thin layer around Tenacity that I've been copy-pasting between my projects for a long time:

  • Retry only on certain exceptions.
  • Exponential backoff with jitter between retries.
  • Limit the number of retries and total time.
  • Preserve type hints of the decorated callable.
  • Count (Prometheus) and log (structlog) retries with basic metadata (if they're installed).
  • Easy deactivation for testing.

Release Information

Added

  • Retries are now instrumented. If prometheus-client is installed, retries are counted using the Prometheus counter stamina_retries_total. If structlog is installed, they are logged using a structlog logger at warning level. These two instrumentations are independent from each other.

License

stamina is written by Hynek Schlawack and distributed under the terms of the MIT license.

Metadata

Release files for stamina 22.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for stamina 22.2.0
File Size Uploaded Provenance Actions
stamina-22.2.0.tar.gz 12.6 kB Without provenance Details for stamina-22.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for stamina 22.2.0
File Interpreter ABI Platform Actions
stamina-22.2.0-py3-none-any.whl Python 3 none any Details for stamina-22.2.0-py3-none-any.whl

Total release size: 19.3 kB

Release files / stamina-22.2.0.tar.gz

Download URL stamina-22.2.0.tar.gz
Size 12.6 kB
Tags Source
SHA-256 checksum
How to use checksums
77c370c82b6ced13617d42e1b93032fdb1435720db964e6d40f4b9f8746bfb7c
BLAKE2b-256 checksum
How to use checksums
9936be63373747885f8aff9220e71d0496456bae4d74bd29d9760c6895d5ef4e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.7

Release files / stamina-22.2.0-py3-none-any.whl

Download URL stamina-22.2.0-py3-none-any.whl
Size 6.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d51df54359e0176efd86a04a08e68a7a9cdee5245499313feb3061009d624a30
BLAKE2b-256 checksum
How to use checksums
7cea04537875bbb02224212312d451585e1834a90c1bb75a84b93e62d9e32917
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.7

Security for stamina 22.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page