asyncbreaker
asyncbreaker is an asyncio-first Python implementation of the Circuit Breaker pattern from Michael T. Nygard's book Release It!.
Circuit breakers let one subsystem fail without taking down the whole application: you wrap risky calls (often I/O or integration boundaries) so that repeated failures trip the breaker, subsequent calls fail fast for a reset timeout, then a single trial call may close the circuit again.
Lineage
- pybreaker (Daniel Fernandes Martins) — original design.
- aiobreaker fork (Alexander Lyon) — asyncio instead of Tornado, packaging experiments.
- Current line — maintained by Sergey Turbinov; substantial rewrite toward a pure async API, async storage, and async listeners. Contact: @freems on Telegram.
Features
- Async
CircuitBreaker— useawait breaker.call(...) - Configurable failure threshold (
fail_max) and reset window (timeout_duration) - Excluded exceptions and predicate callables (business vs system errors)
- Multiple async
Listenerinstances - Pluggable async storage: in-process memory or Redis via
redis.asyncio - Optional
redisextra for Redis-backed storage
Requirements
Python 3.10+ (async patterns and typing used throughout).
Installation
pip install asyncbreaker
With Redis support (redis package):
pip install asyncbreaker[redis]
Usage
Create a breaker per integration point. Only async callables are supported; the decorator
rejects ordinary def functions.
from datetime import timedelta
from asyncbreaker import CircuitBreaker
api_breaker = CircuitBreaker(fail_max=5, timeout_duration=timedelta(seconds=60))
@api_breaker
async def fetch_remote():
...
# or explicitly:
await api_breaker.call(fetch_remote)
See changelog.md for the full API story (listeners, storage, open / close / half_open,
exclusion rules). A MkDocs site will be added later.
Development
This project uses uv:
uv sync
uv run pytest test
License
BSD 3-Clause; see license.md. This project bundles copyright from the pybreaker lineage;
additional copyright applies to the asyncio rewrite (see license.md).
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file asyncbreaker-2.1.0.tar.gz.
File metadata
- Download URL: asyncbreaker-2.1.0.tar.gz
- Upload date:
- Size: 102.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ba390916431656ab16ed71f88822a4f6850ac81203b423c908bb2f86dc5d368d
|
|
| MD5 |
e86e468feca24917cdc2ae90f63048a2
|
|
| BLAKE2b-256 |
f0921d35a42a7ad1bb1b5e9f5cfedb7c78f1155401beef509f3636ba0a89ab5a
|
Provenance
The following attestation bundles were made for asyncbreaker-2.1.0.tar.gz:
Publisher:
publish.yml on freemspwnz/asyncbreaker
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
asyncbreaker-2.1.0.tar.gz -
Subject digest:
ba390916431656ab16ed71f88822a4f6850ac81203b423c908bb2f86dc5d368d - Sigstore transparency entry: 2359559978
- Sigstore integration time:
-
Permalink:
freemspwnz/asyncbreaker@8e8a3c57969f0e90f8189f21764f7a245e31707b -
Branch / Tag:
refs/tags/v2.1.0 - Owner: https://github.com/freemspwnz
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@8e8a3c57969f0e90f8189f21764f7a245e31707b -
Trigger Event:
push
-
Statement type:
File details
Details for the file asyncbreaker-2.1.0-py3-none-any.whl.
File metadata
- Download URL: asyncbreaker-2.1.0-py3-none-any.whl
- Upload date:
- Size: 21.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f89b8bde4216b896a9cee24096e18f10924dc4488c4e5b6ad2a311b7f1c5b264
|
|
| MD5 |
dc3343e1159d405986700f6aa9684c79
|
|
| BLAKE2b-256 |
33724d6810071a1d1abeaf41baac04eaa7edea9f31a10d1f0cfd42fec252a004
|
Provenance
The following attestation bundles were made for asyncbreaker-2.1.0-py3-none-any.whl:
Publisher:
publish.yml on freemspwnz/asyncbreaker
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
asyncbreaker-2.1.0-py3-none-any.whl -
Subject digest:
f89b8bde4216b896a9cee24096e18f10924dc4488c4e5b6ad2a311b7f1c5b264 - Sigstore transparency entry: 2359560531
- Sigstore integration time:
-
Permalink:
freemspwnz/asyncbreaker@8e8a3c57969f0e90f8189f21764f7a245e31707b -
Branch / Tag:
refs/tags/v2.1.0 - Owner: https://github.com/freemspwnz
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@8e8a3c57969f0e90f8189f21764f7a245e31707b -
Trigger Event:
push
-
Statement type: