{"id":21832,"library":"python-retry","title":"python-retry","description":"A simple, lightweight Python package for retrying operations with configurable retry counts, delays, and backoff strategies. Version 0.0.1 is the initial release, with minimal API surface and basic functionality. The package is in early development with slow release cadence.","status":"active","version":"0.0.1","language":"python","source_language":"en","source_url":"https://github.com/pyprogrammerblog/python-retry","tags":["retry","decorator","error-handling","utility"],"install":[{"cmd":"pip install python-retry","lang":"bash","label":"Standard install"}],"dependencies":[],"imports":[{"note":"Correct import path from the package","wrong":null,"symbol":"retry","correct":"from retry import retry"},{"note":"Retry class is in retry submodule","wrong":"from retry import Retry","symbol":"Retry","correct":"from retry.retry import Retry"}],"quickstart":{"code":"from retry import retry\n\n@retry(count=3, delay=1, backoff=2)\ndef unstable_call():\n    import random\n    if random.random() < 0.7:\n        raise ValueError(\"transient error\")\n    return \"success\"\n\nprint(unstable_call())","lang":"python","description":"Decorate a function to retry up to 3 times with exponential backoff."},"warnings":[{"fix":"Ensure your functions raise Exception subclasses, or use the 'exceptions' parameter to specify custom exception types.","message":"The @retry decorator does not catch exceptions by default; it only retries on exceptions that inherit from Exception. If your function raises BaseException directly (e.g., SystemExit), it will not be retried.","severity":"gotcha","affected_versions":"all"},{"fix":"Set backoff=1 for constant delay; otherwise, calculate expected delays accordingly.","message":"The backoff parameter is multiplicative, not additive. For example, with delay=1 and backoff=2, delays are 1, 2, 4 seconds. Users often expect additive backoff (e.g., 1, 2, 3).","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Use pip install python-retry and then from retry import retry.","cause":"Trying to import from the wrong package or the module structure has changed.","error":"ImportError: cannot import name 'retry' from 'retry'"},{"fix":"from retry.retry import Retry","cause":"Importing Retry from the top-level module instead of the submodule.","error":"AttributeError: module 'retry' has no attribute 'Retry'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}