Skip to main content

aioautobatch

Lightweight asyncio helper that batches many small calls into fewer async batch calls. It wraps your batch function and returns an awaitable that resolves with the corresponding result.

Install

pip install .

Python 3.11+ is required; the project targets Python 3.14 in pyproject.toml.

Usage

import asyncio
from aioautobatch import autobatch


async def batch_add(args_list: list[tuple[int, int]]) -> list[int]:
    # Called once per batch with all pending arguments.
    return [a + b for a, b in args_list]


async def main():
    add = autobatch(batch_add, start_delay=0.05, batch_size=5)

    # Each call returns a future tied to its position in the batch.
    futures = [await add(i, i + 1) for i in range(8)]
    results = await asyncio.gather(*futures)
    print(results)  # [1, 3, 5, 7, 9, 11, 13, 15]


asyncio.run(main())

Key parameters

  • start_delay: initial window (seconds) to collect the first batch.
  • batch_size: maximum items per batch; None means unbounded.
  • max_delay: max wait between batches after the first batch starts.
  • max_concurrent_batches: cap concurrent in-flight batches.
  • on_exception: optional callback invoked when a batch raises.

Tests

python3 -m unittest discover -s tests

Unit tests cover batching behavior, batch sizing, concurrency limits, and exception propagation.

Metadata

Release files for aioautobatch 0.1.4

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

Source distribution (sdist)

Source distribution for aioautobatch 0.1.4
File Size Uploaded Provenance
aioautobatch-0.1.4.tar.gz 5.5 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for aioautobatch 0.1.4
File Interpreter ABI Platform
aioautobatch-0.1.4-py3-none-any.whl Python 3 none any Details

Total release size: 9.0 kB

Release files / aioautobatch-0.1.4.tar.gz

Download URL aioautobatch-0.1.4.tar.gz
Size 5.5 kB
Tags Source
SHA-256 checksum
How to use checksums
04859c5d7a4add60a77a3c6f2eb9904409465eccfd993e16dbb81fbbb4fcc152
BLAKE2b-256 checksum
How to use checksums
6ad1498297aaca7202febac2916eddf4e3b90a3bbdef6f92dbe8b7b9934c61a9
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 30, 2026.

Transparency log

Release files / aioautobatch-0.1.4-py3-none-any.whl

Download URL aioautobatch-0.1.4-py3-none-any.whl
Size 3.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7922ed8a1308967010162728f7008b54332d9c7aefc673da5d6c14b7cba98446
BLAKE2b-256 checksum
How to use checksums
d3212def84624aa018ca1f735edca7d7c6baac8816e21774bac83d0ae7ea25f1
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 30, 2026.

Transparency log

Security for aioautobatch 0.1.4

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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for aioautobatch-0.1.4.tar.gz

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 30, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

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