Skip to main content

Bulkhead pattern implementation with Trio for structured concurrency and resilient circuit breaking

Project description

Bulkman

Enterprise-Grade Bulkhead Pattern for Python

Bulkman is a robust, production-ready implementation of the Bulkhead pattern, designed to isolate resources and prevent cascading failures in mission-critical distributed systems. It supports both modern async (Trio) and traditional synchronous (Threading) workloads with zero overhead.

Key Capabilities

  • Resource Isolation: Limits concurrent access to prevent service exhaustion.
  • Circuit Breaker Integration: Built-in distributed circuit breaking via resilient-circuit.
  • Dual Mode:
    • Async: Native Trio support for high-concurrency IO.
    • Sync: Zero-overhead ThreadPoolExecutor implementation for CPU-bound or blocking IO tasks.
  • Observability: Full contextvars support for distributed tracing (OpenTelemetry/Datadog).
  • Type Safe: 100% type-hinted and rigorously tested (>92% coverage).

Documentation

Quick Install

pip install bulkman

Quick Example (Blocking/Threading)

For legacy or synchronous applications, use BulkheadThreading:

from bulkman import BulkheadThreading, BulkheadConfig

# Configure
config = BulkheadConfig(name="db_writer", max_concurrent_calls=10, timeout_seconds=5.0)
bulkhead = BulkheadThreading(config)

# Execute
try:
    future = bulkhead.execute(my_blocking_function, data)
    result = future.result(timeout=5.0)
    print(result.result)
except TimeoutError:
    print("System overloaded")

👉 See the User Guide for Async/Trio examples

License

Licensed under the Apache License 2.0.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bulkman-1.2.2.tar.gz (31.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bulkman-1.2.2-py3-none-any.whl (19.4 kB view details)

Uploaded Python 3

File details

Details for the file bulkman-1.2.2.tar.gz.

File metadata

  • Download URL: bulkman-1.2.2.tar.gz
  • Upload date:
  • Size: 31.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for bulkman-1.2.2.tar.gz
Algorithm Hash digest
SHA256 5b68a221a783ad8970e0ce1a4fb8bd534a64e9a396fee3f768da5c21dbc948e8
MD5 28c6a30e555641675084606f83df38c5
BLAKE2b-256 3134899ccca1fa2f872df3c09cb194997239cf5cd0858747d6631e06649b8879

See more details on using hashes here.

File details

Details for the file bulkman-1.2.2-py3-none-any.whl.

File metadata

  • Download URL: bulkman-1.2.2-py3-none-any.whl
  • Upload date:
  • Size: 19.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for bulkman-1.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 3a508e077af9f68b1d0376c49bc9e155760db7ff4ed53303e4dbba2c80d3e032
MD5 7f602d1f5430bd1f7b73e6c9a9b56c9d
BLAKE2b-256 b93271a24dd92b4b7438902bac200f73f83ca8911d9a639ff524752c6e496227

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page