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

TLA+ Specs Running

# Safety (exhaustive, terminates):
java -jar tla2tools.jar -workers auto \
    -config specs/TaskGraphTinySafety.cfg specs/TaskGraphTiny.tla

# Liveness (simulation, bounded depth: not exhaustive but practical):
java -jar tla2tools.jar -simulate num=100000 -depth 200 \
    -config specs/TaskGraphTiny.cfg specs/TaskGraphTiny.tla

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.1a1.tar.gz (143.2 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.1a1-py3-none-any.whl (169.8 kB view details)

Uploaded Python 3

File details

Details for the file boilermaker_servicebus-1.0.1a1.tar.gz.

File metadata

  • Download URL: boilermaker_servicebus-1.0.1a1.tar.gz
  • Upload date:
  • Size: 143.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for boilermaker_servicebus-1.0.1a1.tar.gz
Algorithm Hash digest
SHA256 3d79fcee15f2913a6ff38dac54156f370b571cbbd3044de4f4e1b1f0d3b86c59
MD5 06a44ad4169cbdd802702e5ed612c207
BLAKE2b-256 7258db0e7042e14d5b9dc6c243fea21d1a1afef2e140be185a36356a4495eaac

See more details on using hashes here.

Provenance

The following attestation bundles were made for boilermaker_servicebus-1.0.1a1.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.1a1-py3-none-any.whl.

File metadata

File hashes

Hashes for boilermaker_servicebus-1.0.1a1-py3-none-any.whl
Algorithm Hash digest
SHA256 1377172d89d93a1f7b16c8b64db579b45a92519cf7754b6330daa08f721be1e1
MD5 753312da0f1c31d83499f88f9a3ff8e5
BLAKE2b-256 68e0e191ce70f71a8f476ed6d88a3d3b0f6a978533ffb57a26925aaf5013de30

See more details on using hashes here.

Provenance

The following attestation bundles were made for boilermaker_servicebus-1.0.1a1-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