Skip to content

26.2.0

Latest

Choose a tag to compare

@hynek hynek released this 15 Nov 12:57
· 6 commits to main since this release
Immutable release. Only release title and notes can be modified.
26.2.0
bb4685e

Highlights

This is a big one! Native raise TryAgain with minimum backoff! RetryDetails filtering! Explicit block names for non-decorator retries! Lazy imports on Python 3.15! Bug fixes! Optimizations! Oh my!

Full changelog below!

Special thanks

This release would not be possible without my generous sponsors! Thank you to all of you making sustainable maintenance possible! If you would like to join them, go to https://github.com/sponsors/hynek and check out the sweet perks!

Above and beyond

Variomedia AG (@variomedia), Tidelift (@tidelift), Kraken Tech (@kraken-tech), Klaviyo (@klaviyo), Privacy Solutions GmbH (@privacy-solutions), FilePreviews (@filepreviews), TestMu AI Open Source Office (Formerly LambdaTest) (@LambdaTest-Inc), Todoist Inc (@todoist), Daniel Fortunov (@asqui), and Kevin P. Fleming (@kpfleming).

Maintenance sustainers

Buttondown (@buttondown), Christopher Dignam (@chdsbd), Magnus Watn (@magnuswatn), David Cramer (@dcramer), Rivo Laks (@rivol), Mike Fiedler (@miketheman), Duncan Hill (@cricalix), Colin Marquardt (@cmarqu), August Trapper Bigelow (@atbigelow), Nick Libertini (@libertininick), Brian M. Dennis (@crossjam), Al Sweigart (@asweigart), Celebrity News AG (@celebritynewsag), Sławomir Ehlert (@slafs), Mostafa Khalil (@khadrawy), Filip Mularczyk (@mukiblejlok), Thomas Klinger (@thmsklngr), Andreas Poehlmann (@ap--), Carlton Gibson (@carltongibson), and Roboflow (@roboflow).

Full changelog

Removed

  • Support for Python 3.10.

Deprecated

  • Raising tenacity.TryAgain in code that stamina retries now emits a DeprecationWarning. It only ever worked because stamina uses Tenacity internally. Raise stamina.exceptions.TryAgain instead.

    Generally speaking, we do not support "hybrid" usage of Tenacity features via stamina and will break such cases without warning in the future. #158

Added

  • stamina.exceptions.TryAgain that you can raise to force a retry, whatever on says. If stamina runs out of attempts, it raises the exception that you raised TryAgain from. Without one, your caller gets the TryAgain.

    Pass after to wait at least a number of seconds, a datetime.timedelta, or until a timezone-aware datetime.datetime before the next attempt. #158

  • stamina.instrumentation.set_process_details() that lets you change the stamina.instrumentation.RetryDetails before stamina passes them to the retry hooks. For example, you can remove secrets from the arguments before they are logged. stamina.instrumentation.get_process_details() returns the current one. #160

  • stamina.retry_context(), stamina.RetryingCaller(), and stamina.AsyncRetryingCaller() now accept a keyword-only name for retry instrumentation, like Prometheus labels. The default remains <context block>. #165

Changed

  • The type hints of on now accept subclasses of BaseException, backoff hooks are typed to receive a BaseException, and stamina.instrumentation.RetryDetails.caused_by is typed as a BaseException. This matches what stamina always did at runtime; we've only imposed our opinion via type hints which isn't always useful. If you annotated the argument of a backoff hook with Exception, your type checker now wants BaseException. #155

  • If a backoff would end after timeout, stamina now gives up right away. Before, it waited past timeout and attempted once more. This also applies to custom backoffs from backoff hooks. #158

  • On Python 3.15 and later, stamina now uses lazy imports. #159

Fixed

  • Context managers returned by stamina.instrumentation.RetryHooks are now exited only once. #157

This release contains contributions from @hynek, and @Ycz007.