Retrydec - smart, zero-dependency retry decorator for python supporting sync and async functions with jitter.
📦Installation
pip install retrydec
⚡Quick Start
from retrydec import retry
attempts_num = 0
@retry(attempts=5, delay=0.3)
def example():
# ↓ Your custom code goes here
global attempts_num
attempts_num += 1
if attempts_num == 3:
raise TimeoutError("Error: 504")
✨Retrydec Features
- No dependencies
- Smart supporting sync and async functions with jitter
- Very easy to use
- Exponential backoff algorithm
- Custom exception filtering
📃Usage
Library import:
from retrydec import retry
Initialize and run retry decorator with sync or async functions:
@retry()
Decorator arguments
| Parameter | Type | Default | Description |
|---|---|---|---|
attempts |
int |
1 |
Maximumu numbers of execution attempts. |
delay |
float |
1.0 |
Base delay between attempts in seconds. |
exceptions |
tuple |
(Exception) |
Tuple of exceptions to catch and retry. |
jitter |
bool |
False |
Enables random noise to prevent server stampede. |
Note: all decorator arguments work the same way for both async and sync functions.
Base example:
from retrydec import retry
import asyncio
attempts_num = 0
print("----------Sync test----------")
@retry(attempts=5, delay=0.3)
def example():
global attempts_num
attempts_num += 1
print(f"Attempt number: {attempts_num}")
raise TimeoutError("Error: 504") # Server error simulation
try:
example()
except TimeoutError:
print("Sync test: OK!")
attempts_num = 0
print("----------Async test----------")
@retry(jitter=True, exceptions=(TimeoutError))
async def example():
global attempts_num
attempts_num += 1
print(f"Attempt number: {attempts_num}")
if attempts_num == 1:
raise TimeoutError("Error: 504") # Server error simulation
asyncio.run(example())
print("Async test: OK!")
❔Why is it convenient?
- Clean code It replaces the cumbersome
try-except-whileconstructs with a single decorator. - Unified API There is no need to support different tools - retrydec uses a single smart decorator that determines whether a function is
syncorasync. - Zero dependencies Provides light weight
- Safety The built-in backoff and jitter protect your servers from overload during failures.
👦🏻 About the developer
My name is Andrey Egupov, I'm 12 years old. I've been programming for several years. I started in Scratch, now I write in Python, JavaScript, and I'm working with Arduino. The idea for this project came from a desire to create something that would greatly help developers and fill a gap in the Python ecosystem.
📄 License
MIT © 2026 Andrey Egupov
Metadata
Release files for retrydec 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| retrydec-0.1.0.tar.gz | 3.3 kB | Without provenance | Details for retrydec-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| retrydec-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for retrydec-0.1.0-py3-none-any.whl |
Total release size: 6.9 kB
Release files / retrydec-0.1.0.tar.gz
| Download URL | retrydec-0.1.0.tar.gz |
|---|---|
| Size | 3.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
16bff8cf9524e805596a3b92b18bdedb71fd67876dda6f838176f5e3744b558a
|
|
BLAKE2b-256 checksum How to use checksums |
08934610498b31ab502795490078724ad3995fea752d573ea8a6699eab5f9b0f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.0
|
Release files / retrydec-0.1.0-py3-none-any.whl
| Download URL | retrydec-0.1.0-py3-none-any.whl |
|---|---|
| Size | 3.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c299fa106a11dfb5f5d6d82f70aa0d422630a10f494c919ebdcd9fa8573c2840
|
|
BLAKE2b-256 checksum How to use checksums |
4974001c28e266860f88cab2e01344b5e6b0c39f5fa7026596de8029f29719a7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.0
|
Security for retrydec 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.