Skip to main content

simple-async-sqs

simple-async-sqs is a opinionated minimalistic async Python client to interact with SQS.

simple-async-sqs is for developers who are tired of repeated configurations in task frameworks and prefer a simple message processing library.

Installation

uv add simple-async-sqs

Optionally add the type stubs for used in development:

uv add --dev simple-async-sqs[stubs]

Usage

A consumer can be simply created by Client.consume which is simply an AsyncIterator.

Messages must be either ack'd or nack'd after processing.

import asyncio

from simple_async_sqs.queue_client import QueueClient


async def process(client: QueueClient):
    async for message in client.consume():
        try:
            print(message.get("Body"))
            ...
        except Exception:
            await client.nack(message, retry_timeout=20)
        else:
            await client.ack(message)


async def process_single():
    async with QueueClient.create("my-queue") as client:
        await process(client)

We can also easily parallelise the work here using asyncio.TaskGroup:

async def process_parallel(workers: int):
    async with QueueClient.create("my-queue") as client:
        async with asyncio.TaskGroup() as tg:
            for _ in range(workers):
                tg.create_task(process(client))

Lifecycles

Lifecycles define what happens during message processing - on success, error, and during processing. They provide a way to handle retries, heartbeats, and other message lifecycle concerns automatically.

RetryLifeCycle

Retries failed messages after a fixed interval indefinitely. The number of retries can be configured via SQS DLQ settings.

from simple_async_sqs.lifecycle import RetryLifeCycle

async def process_with_retry():
    async with QueueClient.create("my-queue") as client:
        lifecycle = RetryLifeCycle(client, retry_interval=30)
        async for message in client.consume():
            async with lifecycle(message) as msg:
                # Process message
                print(msg.get("Body"))
                # On exception: automatically retries after 30 seconds
                # On success: automatically acks the message

ExponentialRetryLifeCycle

Retries failed messages with exponential backoff. Each retry doubles the wait time based on the message's receive count.

from simple_async_sqs.lifecycle import ExponentialRetryLifeCycle

async def process_with_exponential_retry():
    async with QueueClient.create("my-queue") as client:
        lifecycle = ExponentialRetryLifeCycle(client, retry_interval=10)
        async for message in client.consume():
            async with lifecycle(message) as msg:
                # Process message
                print(msg.get("Body"))
                # On exception: retries with exponential backoff (10s, 20s, 40s, etc.)
                # On success: automatically acks the message

HeartbeatLifeCycle

Keeps messages alive by extending their visibility timeout with periodic heartbeats. Useful for long-running message processing.

from simple_async_sqs.lifecycle import HeartbeatLifeCycle, RetryLifeCycle

async def process_with_heartbeat():
    async with QueueClient.create("my-queue") as client:
        # Heartbeat every 60 seconds, with retry on failure
        lifecycle = HeartbeatLifeCycle(
            client, 
            interval=60, 
            inner_life_cycle=RetryLifeCycle(client, retry_interval=30)
        )
        async for message in client.consume():
            async with lifecycle(message) as msg:
                # Message visibility extended automatically every 60 seconds
                await asyncio.sleep(300)  # Long processing
                print(msg.get("Body"))
                # On exception: retries after 30 seconds
                # On success: automatically acks the message

Producer

We can simply produce a message by:

await client.producer("my_message_payload", delay=10)

Release files for simple-async-sqs 0.2.0

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

Source distribution (sdist)

Source distribution for simple-async-sqs 0.2.0
File Size Uploaded
simple_async_sqs-0.2.0.tar.gz 3.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for simple-async-sqs 0.2.0
File Interpreter ABI Platform
simple_async_sqs-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 8.3 kB

Release files / simple_async_sqs-0.2.0.tar.gz

Download URL simple_async_sqs-0.2.0.tar.gz
Size 3.4 kB
Tags Source
SHA-256 checksum
How to use checksums
4fe9f275435da74db49d9ab808ecd8cd82e552952b0192d7953eede949d29153
BLAKE2b-256 checksum
How to use checksums
28d21eecb6425c2042aa9725a09e80a6b2def5faa5724bbe4b5afc8e8485c695
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 19, 2026.

Transparency log

Release files / simple_async_sqs-0.2.0-py3-none-any.whl

Download URL simple_async_sqs-0.2.0-py3-none-any.whl
Size 4.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d73dd275ad2619e76222539482ee7e3c230e98cdee8e1736be7e74c32a58638c
BLAKE2b-256 checksum
How to use checksums
0bc740cc0a17818a977313130b1ccdf579adc6b4b3feb63dbe37f2579cc8b3d0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 19, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.1

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