Skip to main content

Because asyncio.gather() is not enough!

Project description

aioplus

PyPI Version PyPI Downloads License Python Version Documentation

Key Features

  • builtins, itertools and more-itertools - but asynchronous;
  • Seamless sync-async bridging (awaitify, anextify, etc.);
  • Early returns never cause unawaited coroutine warnings.

Getting Started

Installation

The library is available as aioplus on PyPI:

pip install aioplus

Usage

CallerThreadExecutor

For more, see the documentation.

>>> executor = CallerThreadExecutor()
>>> loop = asyncio.new_event_loop()
>>> loop.set_default_executor(executor)

aall

For more, see the documentation.

>>> aiterable = arange(23)
>>> await aall(aiterable)
False

aany

For more, see the documentation.

>>> aiterable = arange(23)
>>> await aany(aiterable)
True

abatched

For more, see the documentation.

>>> aiterable = arange(23)
>>> [batch async for batch in abatched(aiterable, n=3)]
[(0, 1, 2), (3, 4, 5), ..., (18, 19, 20), (21, 22)]

acount

For more, see the documentation.

>>> [num async for num in acount(start=23, step=4)]
[23, 27, 31, 35, 39, 43, 47, ...]

acycle

For more, see the documentation.

>>> aiterable = arange(23)
>>> [num async for num in acycle(aiterable)]
[0, 1, ..., 22, 23, 0, 1, ..., 22, 23, ...]

aenumerate

For more, see the documentation.

>>> aiterable = arange(4, 23)
>>> [(index, num) async for index, num in aenumerate(aiterable)]
[(0, 4), (1, 5), (2, 6), (3, 7), ..., (17, 21), (18, 22)]

afirst

For more, see the documentation.

>>> aiterable = arange(23)
>>> await afirst(aiterable)
0

ahead

For more, see the documentation.

>>> aiterable = arange(23)
>>> [num async for num in ahead(aiterable, n=4)]
[0, 1, 2, 3]

aislice

For more, see the documentation.

>>> aiterable = arange(2003)
>>> [num async for num in aislice(aiterable, 4, 23)]
[4, 5, 6, 7, 8, ..., 20, 21, 22]

alast

For more, see the documentation.

>>> aiterable = arange(23)
>>> await alast(aiterable)
22

alen

For more, see the documentation.

>>> aiterable = arange(23)
>>> await alen(aiterable)
23

amax

For more, see the documentation.

>>> aiterable = arange(23)
>>> await amax(aiterable)
22

amin

For more, see the documentation.

>>> aiterable = arange(23)
>>> await amin(aiterable)
0

aminmax

For more, see the documentation.

>>> aiterable = arange(23)
>>> await aminmax(aiterable)
(0, 22)

anextify

For more, see the documentation.

>>> iterable = [0, 1, 2, 3, 4, 5]
>>> aiterable = anextify(iterable)
>>> [num async for num in aiterable]
[0, 1, 2, 3, 4, 5]

anth

For more, see the documentation.

>>> aiterable = arange(23)
>>> await anth(aiterable, n=4)
4

apairwise

For more, see the documentation.

>>> aiterable = arange(23)
>>> [pair async for pair in apairwise(aiterable)]
[(0, 1), (1, 2), (2, 3), ..., (20, 21), (21, 22)]

arange

For more, see the documentation.

>>> [num async for num in arange(23)]
[0, 1, 2, 3, 4, ..., 19, 20, 21, 22]

arepeat

For more, see the documentation.

>>> [num async for num in arepeat(23, times=4)]
[23, 23, 23, 23]

areversed

For more, see the documentation.

>>> aiterable = arange(23)
>>> [num async for num in areversed(aiterable)]
[22, 21, 20, 19, 18, ..., 4, 3, 2, 1, 0]

asum

For more, see the documentation.

>>> aiterable = arange(23)
>>> await asum(aiterable)
253

atail

For more, see the documentation.

>>> aiterable = arange(23)
>>> [num async for num in atail(aiterable, n=4)]
[19, 20, 21, 22]

atriplewise

For more, see the documentation.

>>> aiterable = arange(23)
>>> [triplet async for triplet in atriplewise(aiterable)]
[(0, 1, 2), (1, 2, 3), ..., (19, 20, 21), (20, 21, 22)]

awaitify

For more, see the documentation.

>>> aprint = awaitify(print)
>>> await aprint("4 -> 23")
4 -> 23

awindowed

For more, see the documentation.

>>> aiterable = arange(23)
>>> [window async for window in awindowed(aiterable, n=3)]
[(0, 1, 2), (1, 2, 3), ..., (19, 20, 21), (20, 21, 22)]

License

MIT License, Copyright (c) 2025 Sergei Y. Bogdanov. See LICENSE file.

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

aioplus-0.5.0.tar.gz (14.6 kB view details)

Uploaded Source

Built Distribution

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

aioplus-0.5.0-py3-none-any.whl (30.9 kB view details)

Uploaded Python 3

File details

Details for the file aioplus-0.5.0.tar.gz.

File metadata

  • Download URL: aioplus-0.5.0.tar.gz
  • Upload date:
  • Size: 14.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.13.5 Windows/10

File hashes

Hashes for aioplus-0.5.0.tar.gz
Algorithm Hash digest
SHA256 03ca2cdfc4b148464ddeff657e5f0e945a593be9aecd854ce911a98d09a9d830
MD5 4c1d013bcbcc7a77a000f036fb4a5605
BLAKE2b-256 2a180a3bb7d019c576bb871d7d09a3efdfed354d4ed7f77eeb1aadfc647f2c8f

See more details on using hashes here.

File details

Details for the file aioplus-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: aioplus-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 30.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.13.5 Windows/10

File hashes

Hashes for aioplus-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0d1dac6113c536532a9fbaf86a2efb5996ed246d6d21147b6b54173029cb0ecc
MD5 342632460d9e5d8428bfba89fcaaeaf4
BLAKE2b-256 2653a3686b89f2c60f27d62da861930dc8d30c0b0ca82dc7d2fd9ea94998a09f

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