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.
Hot config reload
resilience.enabled reacts live to container.refresh_config() (or pico-actuator's POST /actuator/refresh) — pico-ioc >= 2.3.0:
data["resilience"]["enabled"] = False
container.refresh_config() # every policy passes through from this moment
Hot reload is on by default and requires an EventBus (pico_ioc.event_bus in init(modules=[...])); without one, startup fails fast. Opt out explicitly with resilience.hot_reload: false. See the Hot Config Reload how-to.
Documentation
Full docs at dperezcabrera.github.io/pico-resilience.
Built for AI-assisted development
pico-resilience is part of an ecosystem designed for humans and coding agents building software together. Every package ships AGENTS.md working conventions, an llms.txt machine-readable docs index and documented behaviour pinned by regression tests; pico-testing gives agents a verification loop for their own changes, and releases are gated by the whole ecosystem booting together against real infrastructure. The full story: Built for AI-assisted development.
Install the agent skills for Claude Code or OpenAI Codex:
curl -sL https://raw.githubusercontent.com/dperezcabrera/pico-skills/main/install.sh | bash
The pico-conventions skill teaches the assistant this module's API surface and invariants; /add-component and /add-tests scaffold components and tests that use it.
License
MIT
Metadata
Release files for pico-resilience 0.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pico_resilience-0.2.2.tar.gz | 30.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pico_resilience-0.2.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 41.9 kB
Release files / pico_resilience-0.2.2.tar.gz
| Download URL | pico_resilience-0.2.2.tar.gz |
|---|---|
| Size | 30.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5a0318c5be3c3ce457d6dd9a53e301515b0adffdc6c6b0834a8e216a87b22dc1
|
|
BLAKE2b-256 checksum How to use checksums |
f101b3cbbeefd369c12001ee022df29265934ba3d0fcb5fb6042060a88ed86f7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 29, 2026.
Transparency logRelease files / pico_resilience-0.2.2-py3-none-any.whl
| Download URL | pico_resilience-0.2.2-py3-none-any.whl |
|---|---|
| Size | 11.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1c48ece760ee2b3ea685e16e760c862eeef82acc5ea9b6dd32dc905d572ecff2
|
|
BLAKE2b-256 checksum How to use checksums |
0cdcd4867041b2833325aaffb9b0508f093eb3f94106cddfced7929bda209597
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 29, 2026.
Transparency log