23.2.0
Highlights
The highlight of this release are without question configurable retry hooks! You can now freely configure functions that are run whenever a retry is scheduled.
Can't wait to see what kind of third-party integrations y'all come up with – please show and tell us!
As a bonus, stamina now also comes with standard library's logging
instrumentation out of the box.
If you have praise, comments, or concerns (that aren't outright bugs), head over to the release discussion!
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), HiredScore (@HiredScore), FilePreviews (@filepreviews), Daniel Fortunov (@asqui), and Kevin P. Fleming (@kpfleming).
Maintenance Sustainers
Adam Hill (@adamghill), Dan Groshev (@si14), Magnus Watn (@magnuswatn), David Cramer (@dcramer), Moving Content AG (@moving-content), ProteinQure (@ProteinQure), Jesse Snyder (@jessesnyder), Rivo Laks (@rivol), Ionel Cristian Mărieș (@ionelmc), The Westervelt Company (@westerveltco), Philippe Galvan (@PhilippeGalvan), Birk Jernström (@birkjernstrom), Tim Schilling (@tim-schilling), Chris Withers (@cjw296), Christopher Dignam (@chdsbd), and Sławomir Ehlert (@slafs).
Not to forget 5 more amazing humans who chose to be generous but anonymous!
Full Changelog
Added
-
Instrumentation is now pluggable! You can define your own hooks that are run with retry details whenever a retry is scheduled. The documentation now has a whole chapter on instrumentation. #37
-
If structlog is not installed, the scheduled retry is now logged using the standard library
logging
module by default. #35
Changed
-
Tenacity's internal
AttemptManager
object is no longer exposed to the user. This was an oversight and never documented.stamina.retry_context()
now yields instances ofstamina.Attempt
. #22 -
Initialization of instrumentation is now delayed. This means that if there's no retries, there's no startup overhead from importing structlog and prometheus-client. #34
-
Some key names in structlog log messages have been renamed to better reflect their meaning (
slept
→waited_so_far
,attempt
→retry_num
, anderror
→caused_by
). You can rename them back using structlog'sstructlog.processors.EventRenamer
. #35