Skip to main content

An async python Background task system using Azure Service Bus Queues

Project description

Boilermaker

Async Python background tasks with Azure ServiceBus

Tests PyPI version Python 3.11+ Documentation

Boilermaker is a lightweight task runner exclusively for async Python and Azure Service Bus Queues. If you need a fully-featured task runner with multiple backends, consider Celery instead.

Quick Start

Install

pip install "boilermaker-servicebus"

Basic Usage

import asyncio
from boilermaker import Boilermaker, retries
from boilermaker.config import Config
from boilermaker.service_bus import AzureServiceBus

# Configure (loads from environment variables)
config = Config()
service_bus = AzureServiceBus.from_config(config)

# Create app with shared state
class AppState:
    def __init__(self):
        self.data = {"count": 0}

app = Boilermaker(AppState(), service_bus)

# Define background task
async def process_data(state, data_id):
    """state is injected automatically as first parameter"""
    print(f"Processing {data_id}")
    state.data["count"] += 1
    return f"Processed {data_id}"

# Register task
app.register_async(process_data, policy=retries.RetryPolicy.default())

# Publish task
async def main():
    await app.apply_async(process_data, "item_123")

# Run worker (separate process)
async def worker():
    await app.run()  # Runs forever

if __name__ == "__main__":
    asyncio.run(main())

Environment Variables

export SERVICE_BUS_NAMESPACE_URL="https://your-namespace.servicebus.windows.net/"
export SERVICE_BUS_QUEUE_NAME="your-queue-name"

Key Features

  • Async-only: Built for async Python applications
  • Retry Policies: Exponential, linear, and fixed backoff strategies
  • Task Chaining: Success/failure callbacks and workflows

Documentation

📖 Complete Documentation

Requirements

  • Python 3.11+
  • Azure ServiceBus namespace and queue
  • All task arguments must be JSON-serializable

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

boilermaker_servicebus-1.0.0.dev4.tar.gz (99.6 kB view details)

Uploaded Source

Built Distribution

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

boilermaker_servicebus-1.0.0.dev4-py3-none-any.whl (118.8 kB view details)

Uploaded Python 3

File details

Details for the file boilermaker_servicebus-1.0.0.dev4.tar.gz.

File metadata

File hashes

Hashes for boilermaker_servicebus-1.0.0.dev4.tar.gz
Algorithm Hash digest
SHA256 d581ffbad3f204c3469796c720cb091c29d4dfe6103b1bd4856e1e7e85df70a4
MD5 044366770f23488b1f13f66d473c4e95
BLAKE2b-256 6ba34b0d17f8ded491426dc27a06ae11a0aa81fff7b79725ffa4b94598cc7d52

See more details on using hashes here.

Provenance

The following attestation bundles were made for boilermaker_servicebus-1.0.0.dev4.tar.gz:

Publisher: release.yaml on MulliganFunding/boilermaker-servicebus

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file boilermaker_servicebus-1.0.0.dev4-py3-none-any.whl.

File metadata

File hashes

Hashes for boilermaker_servicebus-1.0.0.dev4-py3-none-any.whl
Algorithm Hash digest
SHA256 5da3066d435680f742951e608fea794000445e5d51d702b1efdefe30a23e451a
MD5 e872efb3c922b0bb9c37254ad8978edb
BLAKE2b-256 87d9f370e1ea55221ad52188d852e3f405c76b1e5a7f1d6a54229204864f79ea

See more details on using hashes here.

Provenance

The following attestation bundles were made for boilermaker_servicebus-1.0.0.dev4-py3-none-any.whl:

Publisher: release.yaml on MulliganFunding/boilermaker-servicebus

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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