Skip to content

v1.0.0

Choose a tag to compare

@bagowix bagowix released this 27 Jun 07:15
· 190 commits to main since this release
76740b9

Added

  • Core state machine: CLOSED / OPEN / HALF_OPEN plus the operator
    overrides FORCED_OPEN, DISABLED and METRICS_ONLY (shadow mode).
  • Sliding windows behind a SlidingWindow protocol, with count-based and
    time-based implementations selected via Config.window_type.
  • Failure-rate trigger with failure_rate_threshold and
    minimum_number_of_calls, and slow-call detection via
    slow_call_duration_threshold and slow_call_rate_threshold.
  • Lazy OPEN → HALF_OPEN transition with a probe limit and a concurrency cap.
  • Single public CircuitBreaker for sync and async, usable as a decorator, a
    sync/async context manager, and breaker.call(fn, ...). Decorators preserve
    the signature and sync/async nature via ParamSpec + @overload.
  • Manual control: reset(), force_open(), disable(), metrics_only().
  • Registry of named breakers with a shared default config and per-name
    overrides.
  • Immutable Config (frozen dataclass) with eager validation.
  • FailureClassifier protocol with a default policy (any raised exception is a
    failure); classification by result is supported by custom classifiers.
  • CircuitOpenError carrying the breaker name, an estimated retry_after, and
    the last recorded failure.
  • Async-first timeout primitive that turns a hang into CallTimeoutError.
  • Observability: EventListener protocol, a zero-dependency
    LoggingEventListener, and an OTelEventListener (extra interlock-cb[otel]).
  • httpx2 transport integration (extra interlock-cb[httpx2]):
    CircuitBreakerTransport and AsyncCircuitBreakerTransport apply a breaker
    per host, with an HttpStatusClassifier treating 429, 500, 502, 503, 504
    and transport exceptions as failures.
  • InterlockDeprecationWarning (subclasses UserWarning, visible by default).
  • py.typed; strict mypy and pyright; 100% test coverage.