Metadata-Version: 2.5
Name: iiapis
Version: 0.0.2
Summary: Exponential backoff delay sequences you can inspect and test.
Project-URL: Homepage, https://github.com/lqxnjk/iiapis
Author: lqxnjk
License: MIT
License-File: LICENSE
Keywords: backoff,delay,jitter,retry,schedule
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Requires-Python: >=3.10
Description-Content-Type: text/markdown

# iiapis

Compute backoff schedules as data, so you can print them, assert on them, and
hand them to a scheduler instead of hiding them inside `sleep()` calls.

## Install

```console
pip install iiapis
```

## Usage

```python
from iiapis import delay_for, delays

delays(5)
# [0.5, 1.0, 2.0, 4.0, 8.0]

delays(6, n_base=1, n_max=5)
# [1, 2, 4, 5, 5, 5]

delay_for(3)                  # 2.0
delays(3, n_jitter=0.2)       # each value up to 20% below the raw delay
```

## Jitter

Without jitter, every client that failed at the same moment retries at the same
moment — the failure becomes a thundering herd. `n_jitter` subtracts a random
fraction of each delay, spreading the retries out.

Set `n_jitter=0` (the default) when you need deterministic output for tests or
documentation.

## License

MIT
