Resilience AOP for the Pico ecosystem: @retryable, @circuit_breaker and @timeout method interceptors.
Project description
📦 pico-resilience
Spring-style resilience annotations for the Pico ecosystem, built on pico-ioc method interception and auto-discovered by pico-boot. Zero-config.
| Decorator | Policy |
|---|---|
@retryable(max_attempts, backoff_seconds, retry_on) |
Exponential-backoff retry (sync + async) |
@circuit_breaker(failure_threshold, reset_timeout_seconds) |
Per-method circuit: closed → open → half-open |
@timeout(seconds) |
Async time budget via asyncio.timeout |
Install
pip install pico-resilience
Use
from pico_ioc import component
from pico_resilience import retryable, circuit_breaker, timeout
@component
class PaymentGateway:
@retryable(max_attempts=3, backoff_seconds=0.2, retry_on=(ConnectionError,))
@circuit_breaker(failure_threshold=5, reset_timeout_seconds=30)
def charge(self, order): ...
@timeout(2.0)
async def query_partner(self, q): ...
Failures raise RetryExhaustedError / CircuitOpenError / TimeoutError with the method name. resilience.enabled: false in application.yaml bypasses every policy (handy in tests).
Chain rule: put @retryable at the top when combining decorators (it runs innermost); @circuit_breaker/@cacheable below it then wrap the whole retry loop — the circuit counts exhausted retries and the cache stores the final result. @timeout rejects sync methods at import time: a thread cannot be cancelled, and a timeout that lies is worse than none.
Documentation
Full docs at dperezcabrera.github.io/pico-resilience.
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pico_resilience-0.1.0.tar.gz.
File metadata
- Download URL: pico_resilience-0.1.0.tar.gz
- Upload date:
- Size: 22.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
96f3cfdefbd9e880f01ae4a43387649f5707850c268871f61ab8d86fa8e59a42
|
|
| MD5 |
4c55b382756e81453756c6c60209ac5f
|
|
| BLAKE2b-256 |
feb9e43d6207c00bdde04dc5a090473a5a9b4a2e09d605980e29baefec14866e
|
Provenance
The following attestation bundles were made for pico_resilience-0.1.0.tar.gz:
Publisher:
publish-to-pypi.yml on dperezcabrera/pico-resilience
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pico_resilience-0.1.0.tar.gz -
Subject digest:
96f3cfdefbd9e880f01ae4a43387649f5707850c268871f61ab8d86fa8e59a42 - Sigstore transparency entry: 2071278385
- Sigstore integration time:
-
Permalink:
dperezcabrera/pico-resilience@a0b4ada8bc2936125a897cd4fb9785b1ffae0e9c -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/dperezcabrera
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@a0b4ada8bc2936125a897cd4fb9785b1ffae0e9c -
Trigger Event:
release
-
Statement type:
File details
Details for the file pico_resilience-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pico_resilience-0.1.0-py3-none-any.whl
- Upload date:
- Size: 10.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
da553f6db6799d6cfa79dd16a370ef856aca2867bcccb8e5dcda9943e27eb128
|
|
| MD5 |
4be8c6180ac2f2d18d2c771566fc17c2
|
|
| BLAKE2b-256 |
2d69b485f1af4fbed679300bf4aac27a63d404b32630a6d9588cc50b450dfe8d
|
Provenance
The following attestation bundles were made for pico_resilience-0.1.0-py3-none-any.whl:
Publisher:
publish-to-pypi.yml on dperezcabrera/pico-resilience
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pico_resilience-0.1.0-py3-none-any.whl -
Subject digest:
da553f6db6799d6cfa79dd16a370ef856aca2867bcccb8e5dcda9943e27eb128 - Sigstore transparency entry: 2071278429
- Sigstore integration time:
-
Permalink:
dperezcabrera/pico-resilience@a0b4ada8bc2936125a897cd4fb9785b1ffae0e9c -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/dperezcabrera
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@a0b4ada8bc2936125a897cd4fb9785b1ffae0e9c -
Trigger Event:
release
-
Statement type: