Metadata-Version: 2.4
Name: larzretry
Version: 0.1.0
Summary: Resilience - retry with backoff and a circuit breaker for flaky operations, zero dependencies
Author: larz-scripter
License: MIT
Project-URL: Homepage, https://github.com/larz-scripter/larzretry
Project-URL: Repository, https://github.com/larz-scripter/larzretry
Project-URL: Issues, https://github.com/larz-scripter/larzretry/issues
Keywords: retry,resilience,circuit-breaker,backoff,production,learn-to-code,building-blocks,reliability,zero-dependency,pure-python
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# larzretry

**Resilience for flaky operations — retry with backoff, and a circuit breaker.**

Real apps call things that fail intermittently: networks blip, services hiccup,
databases briefly stall. larzretry makes those operations resilient — retry a
failing call a few times (with optional exponential backoff), or wrap a
troublesome dependency in a circuit breaker that stops hammering it once it's
clearly down. Sleep and clock are injectable, so it's fully testable. Zero
dependencies.

## Install

```bash
pip install larzretry
```

## Use

```python
from larzretry import retry, call, CircuitBreaker

@retry(times=3, backoff=0.1)
def fetch():
    return risky_network_call()

call(fetch, times=5, exceptions=(ConnectionError,))

breaker = CircuitBreaker(threshold=3, reset_after=30)
breaker.call(fetch)     # fails fast once the dependency is clearly down
```

## Learn to code with Larz

Part of the **learn-to-code toolkit** in the [Larz stack](https://github.com/larz-scripter) —
see the [Learn to Code platform](https://larzos.com/learn/). A building block for
reliable production apps.

## Tests

```bash
python -m unittest discover -s tests -v   # 7 tests
```

## License

MIT (c) larz-scripter
