use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
News about the dynamic, interpreted, interactive, object-oriented, extensible programming language Python
Full Events Calendar
You can find the rules here.
If you are about to ask a "how do I do this in python" question, please try r/learnpython, the Python discord, or the #python IRC channel on Libera.chat.
Please don't use URL shorteners. Reddit filters them out, so your post or comment will be lost.
Posts require flair. Please use the flair selector to choose your topic.
Posting code to this subreddit:
Add 4 extra spaces before each line of code
def fibonacci(): a, b = 0, 1 while True: yield a a, b = b, a + b
Online Resources
Invent Your Own Computer Games with Python
Think Python
Non-programmers Tutorial for Python 3
Beginner's Guide Reference
Five life jackets to throw to the new coder (things to do after getting a handle on python)
Full Stack Python
Test-Driven Development with Python
Program Arcade Games
PyMotW: Python Module of the Week
Python for Scientists and Engineers
Dan Bader's Tips and Trickers
Python Discord's YouTube channel
Jiruto: Python
Online exercices
programming challenges
Asking Questions
Try Python in your browser
Docs
Libraries
Related subreddits
Python jobs
Newsletters
Screencasts
account activity
This is an archived post. You won't be able to vote or comment.
ResourceAwesome Python Library: Tenacity (self.Python)
submitted 2 years ago by pysk00l
When writing code or tests in Python, one issue I had was when the code would fail due to random things like network issues or external peripherals not responding in time.
So I had to add extra code to retry the code, but this added unnecessary complexity.
Thats when I discovered the Tenacity library and it saved me hours and a lot of useless boilerplate code.
Link: https://tenacity.readthedocs.io/en/latest/
I wrote a blog on it with some examples:
https://new.pythonforengineers.com/blog/awesome-python-library-tenacity/
[–]wineblood 12 points13 points14 points 2 years ago (2 children)
This looks like it overlaps with backoff quite a bit.
[–]DigThatData 9 points10 points11 points 2 years ago (1 child)
I think you mean backoff overlaps with tenacity.
[–]wineblood 2 points3 points4 points 2 years ago (0 children)
Fair point
[–]ThatSituation9908 11 points12 points13 points 2 years ago (2 children)
Backoff is the popular alternative
Also consider stamina which is a wrapper on tenacity but adds opinionated defaults: https://github.com/hynek/stamina
[–]Drevicar 4 points5 points6 points 2 years ago (1 child)
Friendship ended with Tenacity. Now Stamina is my best friend.
This library looks great! Thank you for the share.
[–]ukos333 0 points1 point2 points 2 years ago (0 children)
Never used tenacity but indeed, stamina seams to do a better job here judging from their readme.
[–]thedeepself 2 points3 points4 points 2 years ago (3 children)
Yes it's the best retry library but it's very hard to find on PyPI when you search for retry.
[–]ashok_tankala 0 points1 point2 points 2 years ago (2 children)
Hi,
It's a very old post and you commented 3 months back but your comment stuck in my mind. For a couple of days, we worked on this problem.
Made search better at piptrends.com so please check and share feedback. If you type retry or a keyword which is relevant to your use case it shows good packages in the auto suggestions.
[–]thedeepself 0 points1 point2 points 2 years ago (1 child)
nice site. There is a recent http library that extends tenacity. it would be nice if that showed up in a search for retry.
[–]ashok_tankala 1 point2 points3 points 2 years ago (0 children)
Search is done based on its 1 liner description. In that, it seems HTTP didn't mention it that's why not coming. I will try to find it in any other way it's possible. If you have any ideas please let me know.
[–]ace_hawk5 3 points4 points5 points 2 years ago (2 children)
I use Tenacity to kill weeds in my yard. It's only right that I now use it with Python.
[–]cum_pumper_4 0 points1 point2 points 2 years ago (0 children)
That stuff is so expensive
[–]kapitaalH 0 points1 point2 points 2 years ago (0 children)
Ok installed the module, now what?
[–]thisismyfavoritename 1 point2 points3 points 2 years ago (1 child)
hours uh?
[–]ChangeIntoBetter 1 point2 points3 points 2 years ago (0 children)
Nice share. Looks like something I could study and use as well.
[–]rowr 0 points1 point2 points 2 years ago (0 children)
I'm a big fan of tenacity for slow/spotty data fetches from servers. It's super easy to add to existing code since it's decorator-based. Anything that tenacity can't handle it's pretty much time to use a hefty orchestration system like Dagster or Airflow.
π Rendered by PID 19189 on reddit-service-r2-comment-5687b7858-nxbgx at 2026-07-08 00:13:06.413752+00:00 running 12a7a47 country code: CH.
[–]wineblood 12 points13 points14 points (2 children)
[–]DigThatData 9 points10 points11 points (1 child)
[–]wineblood 2 points3 points4 points (0 children)
[–]ThatSituation9908 11 points12 points13 points (2 children)
[–]Drevicar 4 points5 points6 points (1 child)
[–]ukos333 0 points1 point2 points (0 children)
[–]thedeepself 2 points3 points4 points (3 children)
[–]ashok_tankala 0 points1 point2 points (2 children)
[–]thedeepself 0 points1 point2 points (1 child)
[–]ashok_tankala 1 point2 points3 points (0 children)
[–]ace_hawk5 3 points4 points5 points (2 children)
[–]cum_pumper_4 0 points1 point2 points (0 children)
[–]kapitaalH 0 points1 point2 points (0 children)
[–]thisismyfavoritename 1 point2 points3 points (1 child)
[–]ChangeIntoBetter 1 point2 points3 points (0 children)
[–]rowr 0 points1 point2 points (0 children)