After much waffling, I’ve just released a new version of a #Python package that I haven’t advertised much until now, but that’s in prod with virtually every of my work projects: https://stamina.hynek.me/

It has a single purpose: to help you write correct retry logic effortlessly.

If you’ve looked at it before: it now has proper docs, support for async, and retries of arbitrary code blocks. And if you wonder what the big deal is, check out the new tutorial: https://stamina.hynek.me/en/latest/tutorial.html

stamina 24.2.0 documentation

@hynek Is there a pattern to attach it to an https.Client or requests.Session so that all requests to a given url prefix use the same retry logic?
@sullivancolin it doesn’t append itself to the calls themselves so it can’t know. it only knows about functions or code blocks.
@hynek Ah, I was thinking about something like this which uses the Urlib3 Retry object and the http adapter.
@sullivancolin yeah if you need this fine control, you need to use native, more aware tools. IME it's usually not necessary tho.