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.1.tar.gz (27.4 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.1-py3-none-any.whl (12.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pico_resilience-0.2.1.tar.gz
  • Upload date:
  • Size: 27.4 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.1.tar.gz
Algorithm Hash digest
SHA256 16f5cd6a31fb757f43e0337c79b71f3cc56767d3189a5ffed277c89d9e8e27dd
MD5 b057967ce39bcfd86ce33d103d26931f
BLAKE2b-256 d2a4eb18b99b532e33287cbad8d7ef6de7bafb5f29b7298a4fd8375b49c24d0b

See more details on using hashes here.

Provenance

The following attestation bundles were made for pico_resilience-0.2.1.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.1-py3-none-any.whl.

File metadata

  • Download URL: pico_resilience-0.2.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 530b147fce64b97721c2cc4071526fa53fc452ed80c7d15ea6ae864838568ec0
MD5 93d7905aab7db34813bae352120ea314
BLAKE2b-256 0ec3a64bfeba390702b520baf5ffc5cb385dad7255bd2c399b39bba8d6e28e20

See more details on using hashes here.

Provenance

The following attestation bundles were made for pico_resilience-0.2.1-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

This release

0.2.1 This release

2 files

0.2.0

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