Catalog PyPI
Back to packageRELEASE DETAILS

1.2.0

PyPI

aiobreaker

Python implementation of the Circuit Breaker pattern.

Published17 May 2021
Direct dependencies14
Transitive dependenciesNot calculated

README

Version 1.2.0 documentation

aiobreaker

aiobreaker is a Python implementation of the Circuit Breaker pattern, described in Michael T. Nygard's book Release It!_.

Circuit breakers exist to allow one subsystem to fail without destroying the entire system. This is done by wrapping dangerous operations (typically integration points) with a component that can circumvent calls when the system is not healthy.

This project is a fork of pybreaker_ by Daniel Fernandes Martins that replaces tornado with native asyncio, originally so I could practice packaging and learn about that shiny new typing package.

.. _Release It!: https://pragprog.com/titles/mnee2/release-it-second-edition/ .. _pybreaker: https://github.com/danielfm/pybreaker

Features

  • Configurable list of excluded exceptions (e.g. business exceptions)
  • Configurable failure threshold and reset timeout
  • Support for several event listeners per circuit breaker
  • Can guard generator functions
  • Functions and properties for easy monitoring and management
  • asyncio support
  • Optional redis backing
  • Synchronous and asynchronous event listeners

Requirements

All you need is python 3.6 or higher.

Installation

To install, simply download from pypi:

.. code:: bash

pip install aiobreaker

Usage

The first step is to create an instance of CircuitBreaker for each integration point you want to protect against.

.. code:: python

from aiobreaker import CircuitBreaker

# Used in database integration points
db_breaker = CircuitBreaker(fail_max=5, reset_timeout=timedelta(seconds=60))

@db_breaker
async def outside_integration():
    """Hits the api"""
    ...

At that point, go ahead and get familiar with the documentation.

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Declared dependencies 14

Native requirements
14 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
sphinx
Environment
{
  "extras": "",
  "marker": "extra == 'docs'",
  "requires_python": ">=3.6",
  "evaluation": "NOT_EVALUATED"
}
sphinx ; extra == 'docs'runtime
sphinx-rtd-theme
Environment
{
  "extras": "",
  "marker": "extra == 'docs'",
  "requires_python": ">=3.6",
  "evaluation": "NOT_EVALUATED"
}
sphinx-rtd-theme ; extra == 'docs'runtime
sphinx-autobuild
Environment
{
  "extras": "",
  "marker": "extra == 'docs'",
  "requires_python": ">=3.6",
  "evaluation": "NOT_EVALUATED"
}
sphinx-autobuild ; extra == 'docs'runtime
sphinx-autodoc-typehints
Environment
{
  "extras": "",
  "marker": "extra == 'docs'",
  "requires_python": ">=3.6",
  "evaluation": "NOT_EVALUATED"
}
sphinx-autodoc-typehints ; extra == 'docs'runtime
redis
Environment
{
  "extras": "",
  "marker": "extra == 'redis'",
  "requires_python": ">=3.6",
  "evaluation": "NOT_EVALUATED"
}
redis ; extra == 'redis'runtime
fakeredis
Environment
{
  "extras": "",
  "marker": "extra == 'test'",
  "requires_python": ">=3.6",
  "evaluation": "NOT_EVALUATED"
}
fakeredis ; extra == 'test'runtime
pytest
Environment
{
  "extras": "",
  "marker": "extra == 'test'",
  "requires_python": ">=3.6",
  "evaluation": "NOT_EVALUATED"
}
pytest (>4) ; extra == 'test'runtime
pytest-asyncio
Environment
{
  "extras": "",
  "marker": "extra == 'test'",
  "requires_python": ">=3.6",
  "evaluation": "NOT_EVALUATED"
}
pytest-asyncio ; extra == 'test'runtime
mypy
Environment
{
  "extras": "",
  "marker": "extra == 'test'",
  "requires_python": ">=3.6",
  "evaluation": "NOT_EVALUATED"
}
mypy ; extra == 'test'runtime
pylint
Environment
{
  "extras": "",
  "marker": "extra == 'test'",
  "requires_python": ">=3.6",
  "evaluation": "NOT_EVALUATED"
}
pylint ; extra == 'test'runtime
safety
Environment
{
  "extras": "",
  "marker": "extra == 'test'",
  "requires_python": ">=3.6",
  "evaluation": "NOT_EVALUATED"
}
safety ; extra == 'test'runtime
bandit
Environment
{
  "extras": "",
  "marker": "extra == 'test'",
  "requires_python": ">=3.6",
  "evaluation": "NOT_EVALUATED"
}
bandit ; extra == 'test'runtime
codecov
Environment
{
  "extras": "",
  "marker": "extra == 'test'",
  "requires_python": ">=3.6",
  "evaluation": "NOT_EVALUATED"
}
codecov ; extra == 'test'runtime
pytest-cov
Environment
{
  "extras": "",
  "marker": "extra == 'test'",
  "requires_python": ">=3.6",
  "evaluation": "NOT_EVALUATED"
}
pytest-cov ; extra == 'test'runtime

Distribution files

2 collected
aiobreaker-1.2.0-py3-none-any.whl

bdist_wheel · 20.21 KB · Python py3

Source file
aiobreaker-1.2.0.tar.gz

sdist · 15.57 KB · Python source

Source file

Repository

PENDING
arlyon/aiobreaker

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 21 Oct, 11:41 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package_version:292cabde9b16a2bb888b85ae7c80c113fed4de7239f2b0516e4bf690a8ed8076

Other collected versions

View all collected versions →