Skip to main content
Documentation Status Continuous Integration Status Code Coverage Report

Purgatory is an implementation of the circuit breaker pattern.

Why another Circuit Breaker implementation ?

The Purgatory library has been develop to be used in blacksmith where the library aiobreaker was used but I encountered limitation so, I decide to build my own implementation that feet well with blacksmith.

Features

Purgatory supports the creation of many circuit breakers easily, that can be used as context manager or decorator. Circuit breaker can be asynchronous or synchronous.

Example with a context manager for an async API

from purgatory import AsyncCircuitBreakerFactory

circuitbreaker = AsyncCircuitBreakerFactory()
async with await circuitbreaker.get_breaker("my_circuit"):
   ...

Example with a decorator

from purgatory import AsyncCircuitBreakerFactory

circuitbreaker = AsyncCircuitBreakerFactory()

@circuitbreaker("another circuit")
async def function_that_may_fail():
   ...

Example with a context manager for an synchronous API

from purgatory import SyncCircuitBreakerFactory

circuitbreaker = SyncCircuitBreakerFactory()
with circuitbreaker.get_breaker("my_circuit"):
   ...

Circuit breakers states and monitoring

The state of every circuits can be stored in memory, shared in redis, or be completly customized.

It also support monitoring, using event hook.

Purgatory is fully typed and fully tested.

Read More

You can read the full documentation of this library here.

Alternatives

Here is a list of alternatives, which may or may not support coroutines.

Metadata

Release files for purgatory-circuitbreaker 0.7.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for purgatory-circuitbreaker 0.7.2
File Size Uploaded
purgatory-circuitbreaker-0.7.2.tar.gz 12.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for purgatory-circuitbreaker 0.7.2
File Interpreter ABI Platform
purgatory_circuitbreaker-0.7.2-py3-none-any.whl Python 3 none any Details

Total release size: 32.2 kB

Release files / purgatory-circuitbreaker-0.7.2.tar.gz

Download URL purgatory-circuitbreaker-0.7.2.tar.gz
Size 12.3 kB
Tags Source
SHA-256 checksum
How to use checksums
7de4282822d11fe2ebe5cb7982da932c32284134c25630ab4dacd597ffafb8a4
BLAKE2b-256 checksum
How to use checksums
8d904136c2dd4e86b79390c94f88c6deaf215eea1feb506da55a1355743d78c1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.12 CPython/3.10.1 Linux/5.15.11-arch2-1

Release files / purgatory_circuitbreaker-0.7.2-py3-none-any.whl

Download URL purgatory_circuitbreaker-0.7.2-py3-none-any.whl
Size 19.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
094b5abc10dba502532ca9510af3606cee05f7fbdf54f2c2acd6f85bc8f7f72f
BLAKE2b-256 checksum
How to use checksums
d210c54b75b392c7baa8e73bd03d554c8cda619b56ee5f0131dd92074a2ddbbe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.12 CPython/3.10.1 Linux/5.15.11-arch2-1

Release history Release notifications | RSS feed

This release

0.7.2 This release

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release 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