{"id":23684,"library":"eth-retry","title":"eth-retry","description":"eth-retry provides a decorator that automatically catches known transient exceptions common in the Ethereum/EVM ecosystem (RPC errors, rate limits, timeouts) and retries the decorated function. Current version is 0.3.7, with an active release cadence. Requires Python >=3.10.","status":"active","version":"0.3.7","language":"python","source_language":"en","source_url":"https://github.com/BobTheBuidler/eth_retry","tags":["ethereum","retry","decorator","web3","rpc"],"install":[{"cmd":"pip install eth-retry","lang":"bash","label":"Install via pip"}],"dependencies":[],"imports":[{"note":"Python packages use underscores, not hyphens, in module names.","wrong":"import eth-retry","symbol":"eth_retry","correct":"from eth_retry import eth_retry"},{"note":"The async decorator is named eth_retry_async.","wrong":"from eth_retry import async_retry","symbol":"eth_retry_async","correct":"from eth_retry import eth_retry_async"}],"quickstart":{"code":"import os\nfrom eth_retry import eth_retry, eth_retry_async\n\n# Synchronous usage\n@eth_retry\ndef fetch_balance(address: str) -> int:\n    # Simulate RPC call that might fail\n    return 100\n\nresult = fetch_balance('0x...')\nprint(result)\n\n# Async usage\n@eth_retry_async\nasync def fetch_balance_async(address: str) -> int:\n    return 100\n\nimport asyncio\nasyncio.run(fetch_balance_async('0x...'))","lang":"python","description":"Basic usage of eth-retry for synchronous and asynchronous functions."},"warnings":[{"fix":"If you need to retry on other exceptions, pass them via exceptions=[...] in the decorator.","message":"The decorator only retries on specific known transient exceptions (e.g., RPC errors, rate limits, timeouts). Custom exceptions are not retried unless you use the `exceptions` parameter.","severity":"gotcha","affected_versions":"all"},{"fix":"Set environment variables before importing eth_retry, or use decorator kwargs to override.","message":"When using environment variables (e.g., ETH_RETRY_MAX_RETRIES), they are read at import time. Changes to environment variables after import will not affect behavior unless explicitly overridden in decorator kwargs.","severity":"gotcha","affected_versions":"all"},{"fix":"Upgrade to Python 3.10+ or pin eth-retry to <=0.3.5.","message":"Python 3.8 and 3.9 are no longer supported as of v0.3.6. v0.3.5 was the last version with Python 3.8/3.9 support.","severity":"breaking","affected_versions":">=0.3.6"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Install with pip install eth-retry, but import as from eth_retry import eth_retry.","cause":"Using pip install eth-retry with hyphen in the package name, Python import uses underscores.","error":"ModuleNotFoundError: No module named 'eth-retry'"},{"fix":"Ensure the decorated function is async and called with await: result = await my_async_func().","cause":"Using eth_retry_async incorrectly on a non-async function or failing to await the decorated function.","error":"TypeError: 'AsyncDecorator' object is not callable"},{"fix":"Do not attempt to access .retry. The decorator does not add such attribute.","cause":"Trying to access a .retry attribute on the decorated function, which does not exist.","error":"AttributeError: 'function' object has no attribute 'retry'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}