{"id":333,"library":"tenacity","title":"Tenacity","description":"Tenacity is a general-purpose retrying library for Python, designed to simplify adding retry behavior to functions. The current version is 9.1.4, released on February 7, 2026. It follows a regular release cadence, with recent updates addressing Python 3.14 support and improvements to retry annotations. ([pypi.org](https://pypi.org/project/tenacity/?utm_source=openai))","status":"active","version":"9.1.4","language":"python","source_language":"en","source_url":"https://github.com/jd/tenacity","tags":["retry","decorator","Python"],"install":[{"cmd":"pip install tenacity","lang":"bash","label":"Install Tenacity"}],"dependencies":[{"reason":"Tenacity is a fork of the 'retrying' library, offering enhanced functionality and fixes.","package":"retrying"}],"imports":[{"note":"Ensure 'retry' is imported from 'tenacity' to utilize its retrying capabilities.","symbol":"retry","correct":"from tenacity import retry"}],"quickstart":{"code":"import random\nfrom tenacity import retry\n\n@retry\ndef do_something_unreliable():\n    if random.randint(0, 10) > 1:\n        raise IOError('Broken sauce, everything is hosed!!!111one')\n    else:\n        return 'Awesome sauce!'\n\nprint(do_something_unreliable())","lang":"python","description":"A simple example demonstrating the use of Tenacity to retry a function that may raise an IOError."},"warnings":[{"fix":"Update code to use Tenacity's API.","message":"Tenacity is a fork of the 'retrying' library and is not API compatible with it.","severity":"breaking","affected_versions":"All"},{"fix":"Use 'from tenacity import retry' in your imports.","message":"Ensure 'retry' is imported from 'tenacity' to utilize its retrying capabilities.","severity":"gotcha","affected_versions":"All"}],"env_vars":null,"search_vec":"'/project/tenacity/?utm_source=openai))':51 '2026':29 '3.14':41 '7':28 '9.1.4':24 'ad':15 'address':39 'annot':47 'behavior':17 'cadenc':35 'current':21 'decor':53 'design':12 'februari':27 'follow':31 'function':19 'general':6 'general-purpos':5 'improv':44 'librari':9 'purpos':7 'pypi.org':48,50 'pypi.org/project/tenacity/?utm_source=openai))':49 'python':11,40,54 'recent':37 'regular':33 'releas':25,34 'retri':8,16,46,52 'simplifi':14 'support':42 'tenac':1,2 'updat':38 'version':22","created_at":"2026-03-28T08:31:46.325513+00:00","updated_at":"2026-04-16T22:45:24.808425+00:00","problems":[{"fix":"pip install tenacity","cause":"The 'tenacity' library has not been installed in the current Python environment.","error":"ModuleNotFoundError: No module named 'tenacity'"},{"fix":"Add 'from tenacity import retry' at the top of your Python file.","cause":"The 'retry' decorator was used in the code without being imported from the 'tenacity' library.","error":"NameError: name 'retry' is not defined"},{"fix":"Use tenacity helper functions such as 'wait_fixed(N)' or 'stop_after_attempt(N)' for the 'wait' and 'stop' parameters, e.g., '@retry(wait=wait_fixed(2))'.","cause":"The 'wait' or 'stop' parameters of the 'retry' decorator were provided with a non-callable value like an integer, instead of a 'tenacity' helper function.","error":"TypeError: 'int' object is not callable"},{"fix":"Replace 'max_attempts=N' with 'stop=stop_after_attempt(N)' to specify the desired maximum number of attempts.","cause":"The 'retry' decorator does not accept a direct 'max_attempts' argument; the maximum number of attempts is configured using the 'stop' parameter.","error":"TypeError: retry() got an unexpected keyword argument 'max_attempts'"}],"ecosystem":"pypi","meta_description":null,"install_score":100,"quickstart_score":80,"quickstart_tag":"verified","pypi_latest":"9.1.4","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/jd/tenacity","docs":null,"changelog":null,"pypi":"https://pypi.org/project/tenacity/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops","http-networking","testing"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-28","last_verified":"2026-08-27","next_check":"2026-07-28","install_tag":"verified"}}