{"categories":[{"label":"Monitoring","url":"https://skillfed.io/packages/category/system-monitoring"}],"enrichment":{"capability":"A Python decorator that implements the Circuit Breaker pattern to prevent cascading failures in distributed systems by monitoring function calls, counting failures, and stopping execution after a threshold is reached.","skillfed_tags":["resilience","fault-tolerance","distributed-systems"],"use_cases":["Protect HTTP clients from repeatedly calling unavailable external APIs by opening the circuit after connection failures.","Prevent database connection pools from exhausting resources when a database is temporarily down.","Implement graceful degradation in microservices by using fallback functions when downstream services are unavailable.","Monitor the health of multiple integration points across your application via CircuitBreakerMonitor.","Rate-limit or fail fast on specific HTTP errors (e.g., 429 Too Many Requests) using custom exception logic."],"what_it_does":"CircuitBreaker is a Python decorator that implements the Circuit Breaker pattern to protect distributed systems from cascading failures. When you decorate a function with @circuit, the decorator monitors execution, counts failures, and stops calling the function after a configurable threshold (default: 5 failures) is reached. After a recovery timeout (default: 30 seconds), it enters a half-open state to test whether the integration point has recovered.\n\nThe decorator supports both synchronous and asynchronous functions, and you can customize which exceptions trigger the circuit to open, set different failure thresholds and recovery timeouts, and provide fallback functions to execute when the circuit is open. It also integrates with a CircuitBreakerMonitor to track the health and state of all active circuit breakers in your application.","worth_installing":"Yes. CircuitBreaker is a straightforward, dependency-free implementation of a well-established resilience pattern. It works with both sync and async code, has no install friction, and carries a permissive license. The aging maintenance status (last release 501 days ago) is a minor concern for a stable, narrowly-scoped library, but verify that its feature set and behavior match your needs before adopting it in production."},"id":"circuitbreaker","links":{"html":"https://skillfed.io/packages/circuitbreaker","md":"https://skillfed.io/packages/circuitbreaker.md","pypi":"https://pypi.org/project/circuitbreaker/"},"maintenance":{"status":"aging"},"meta":{"latest_release":"2025-03-31","license_spdx":null,"license_treatment":"permissive","name":"circuitbreaker","python_support":"unspecified","summary":"Python Circuit Breaker pattern implementation"},"popularity":{"monthly_downloads":10803044,"position":1433,"tier":"top_5000"},"security":{"n_vulnerabilities":0},"version":"2.1.3"}
