Skip to main content

Because asyncio.gather() is not enough!

Project description

aioplus

PyPI Version PyPI Downloads License Python Version Documentation

Key Features

  • As easy as built-ins - but asynchronous;
  • Early returns never cause unawaited coroutine warnings;
  • Nearly the same API as the Python 3.13 standard blocking API.

Getting Started

Installation

The library is available as aioplus on PyPI:

pip install aioplus

Usage

aall

For more, see the documentation.

import asyncio

from aioplus import aall, arange

async def main() -> None:
    """Run the program."""
    aiterable = (num > 0 async for num in arange(2304))
    flg = await aall(aiterable)

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

aany

For more, see the documentation.

import asyncio

from aioplus import aany, arange

async def main() -> None:
    """Run the program."""
    aiterable = (num % 2 == 0 async for num in arange(2304))
    flg = await aany(aiterable)

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

abatched

For more, see the documentation.

import asyncio

from aioplus import abatched, arange

async def main() -> None:
    """Run the program."""
    async for batch in abatched(arange(23), n=4):
        print(batch)

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

acount

For more, see the documentation.

import asyncio

from aioplus import acount

async def main() -> None:
    """Run the program."""
    async for num in acount(start=23, step=4):
        print(num)

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

acycle

For more, see the documentation.

import asyncio

from aioplus import acycle, arange

async def main() -> None:
    """Run the program."""
    async for num in acycle(arange(23)):
        print(num)

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

aenumerate

For more, see the documentation.

import asyncio

from aioplus import aenumerate, arange

async def main() -> None:
    """Run the program."""
    async for index, num in aenumerate(arange(2304)):
        print(index, num)

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

afirst

For more, see the documentation.

import asyncio

from aioplus import afirst, arange

async def main() -> None:
    """Run the program."""
    aiterable = arange(4, 23)
    num = await afirst(aiterable)
    print(f"aiterable[0] = {num}")

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

ahead

For more, see the documentation.

import asyncio

from aioplus import ahead, arange

async def main() -> None:
    """Run the program."""
    async for num in ahead(arange(23), n=4):
        print(num)

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

aislice

For more, see the documentation.

import asyncio

from aioplus import aislice, arange

async def main() -> None:
    """Run the program."""
    async for num in aislice(arange(23), 4):
        print(num)

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

alast

For more, see the documentation.

import asyncio

from aioplus import alast, arange

async def main() -> None:
    """Run the program."""
    aiterable = arange(4, 23)
    num = await alast(aiterable)
    print(f"aiterable[-1] = {num}")

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

alen

For more, see the documentation.

import asyncio

from aioplus import alen, arange

async def main() -> None:
    """Run the program."""
    aiterable = arange(2304)
    length = await alen(aiterable)
    print(f"len(aiterable) == {length}")

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

amax

For more, see the documentation.

import asyncio

from aioplus import amax, arange

async def main() -> None:
    """Run the program."""
    aiterable = arange(23)
    largest = await amax(aiterable)
    print(f"max(aiterable) == {largest}")

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

amin

For more, see the documentation.

import asyncio

from aioplus import amin, arange

async def main() -> None:
    """Run the program."""
    aiterable = arange(23)
    smallest = await amin(aiterable)
    print(f"min(aiterable) == {smallest}")

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

aminmax

For more, see the documentation.

import asyncio

from aioplus import aminmax, arange

async def main() -> None:
    """Run the program."""
    aiterable = arange(23)
    smallest, largest = await aminmax(aiterable)
    print(f"min(aiterable) == {smallest}")
    print(f"max(aiterable) == {largest}")

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

anth

For more, see the documentation.

import asyncio

from aioplus import anth, arange

async def main() -> None:
    """Run the program."""
    aiterable = arange(23)
    value = await anth(aiterable, n=4)
    print(f"value = {value}")

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

apairwise

For more, see the documentation.

import asyncio

from aioplus import apairwise, arange

async def main() -> None:
    """Run the program."""
    async for left, right in apairwise(arange(23)):
        print(f"pair = ({left}, {right})")

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

arange

For more, see the documentation.

import asyncio

from aioplus import arange

async def main() -> None:
    """Run the program."""
    async for num in arange(2304):
        print(num)

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

arepeat

For more, see the documentation.

import asyncio

from aioplus import arepeat

async def main() -> None:
    """Run the program."""
    async for num in arepeat(23, times=4):
        print(num)

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

areversed

For more, see the documentation.

import asyncio

from aioplus import arange, areversed

async def main() -> None:
    """Run the program."""
    async for num in areversed(arange(2304)):
        print(num)

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

atail

For more, see the documentation.

import asyncio

from aioplus import arange, atail

async def main() -> None:
    """Run the program."""
    async for num in atail(arange(23), n=4):
        print(num)

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

atriplewise

For more, see the documentation.

import asyncio

from aioplus import arange, atriplewise

async def main() -> None:
    """Run the program."""
    async for left, middle, right in atriplewise(arange(23)):
        print(f"window = ({left}, {middle}, {right})")

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

awaitify

For more, see the documentation.

import asyncio

from aioplus import awaitify

def func(num: int) -> None:
    """Print the number."""
    print(f"Num: {num}")

async def main() -> None:
    """Run the program."""
    afunc = awaitify(func)
    await afunc(num=2304)

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

awindowed

For more, see the documentation.

import asyncio

from aioplus import arange, awindowed

async def main() -> None:
    """Run the program."""
    async for window in awindowed(arange(23), n=4):
        print(f"window = {window}")

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

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.3.0.tar.gz (12.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.3.0-py3-none-any.whl (28.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: aioplus-0.3.0.tar.gz
  • Upload date:
  • Size: 12.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.3.0.tar.gz
Algorithm Hash digest
SHA256 2d8c4ecfe96e1e664f32e8dcb96049a752ada23a41f7c4c1a76dbf8465161379
MD5 43120bcf331e7e2bc52d604f0438069a
BLAKE2b-256 e0d58a2ed0fb97ada00db4d9cce5400aaf8053c663bc0b047d66df4b4f76931d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: aioplus-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 28.8 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.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3114fd5fc52e57ea977a0b684f7d4c8c11fae0918fb38f4471734dd4f80c8232
MD5 ff7b4007e662dfefc53c11d001d89d96
BLAKE2b-256 2826a91b493b63094d3affa5867769368b563e7e4d7e571d39e1bcc6a064fc57

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