Skip to main content

pico-resilience

PyPI Ask DeepWiki License: MIT CI (tox matrix) codecov Quality Gate Status Duplicated Lines (%) Maintainability Rating PyPI Downloads Docs Interactive Lab

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.

AI Coding Skills

Install Claude Code or OpenAI Codex skills for AI-assisted development with pico-resilience:

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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pico_resilience-0.2.0.tar.gz (27.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pico_resilience-0.2.0-py3-none-any.whl (12.2 kB view details)

Uploaded Python 3

File details

Details for the file pico_resilience-0.2.0.tar.gz.

File metadata

  • Download URL: pico_resilience-0.2.0.tar.gz
  • Upload date:
  • Size: 27.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pico_resilience-0.2.0.tar.gz
Algorithm Hash digest
SHA256 f0f9a525560eac583067caa1fecf89d4f90618f617fb97d07c8e8ab74b83be06
MD5 b52a06d07bf16520ccb697fc241127c9
BLAKE2b-256 8c19eb612a84e67153ec9f30325ea03bec640ea63d99e5953dede85ed0be1bb0

See more details on using hashes here.

Provenance

The following attestation bundles were made for pico_resilience-0.2.0.tar.gz:

Publisher: publish-to-pypi.yml on dperezcabrera/pico-resilience

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pico_resilience-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: pico_resilience-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 12.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pico_resilience-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9bdcddf54626d4c0e10bed395902c47f68f1a73202e46852aa503d8189be6131
MD5 f8f1360ccb85a31fd1b05b34eab01225
BLAKE2b-256 0e947ff2752e16a437014111cc3507ad0b2231aacf73d426795718d717b0612f

See more details on using hashes here.

Provenance

The following attestation bundles were made for pico_resilience-0.2.0-py3-none-any.whl:

Publisher: publish-to-pypi.yml on dperezcabrera/pico-resilience

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.2.1

2 files

This release

0.2.0 This release

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page