Skip to main content

itertools and builtins for AsyncIO and mixed iterables

Project description

aioitertools

Implementation of itertools, builtins, and more for AsyncIO and mixed-type iterables.

documentation version changelog license

Install

aioitertools requires Python 3.9 or newer. You can install it from PyPI:

$ pip install aioitertools

Usage

aioitertools shadows the standard library whenever possible to provide asynchronous version of the modules and functions you already know. It's fully compatible with standard iterators and async iterators alike, giving you one unified, familiar interface for interacting with iterable objects:

from aioitertools import iter, next, map, zip

something = iter(...)
first_item = await next(something)

async for item in iter(something):
    ...


async def fetch(url):
    response = await aiohttp.request(...)
    return response.json

async for value in map(fetch, MANY_URLS):
    ...


async for a, b in zip(something, something_else):
    ...

aioitertools emulates the entire itertools module, offering the same function signatures, but as async generators. All functions support standard iterables and async iterables alike, and can take functions or coroutines:

from aioitertools import chain, islice

async def generator1(...):
    yield ...

async def generator2(...):
    yield ...

async for value in chain(generator1(), generator2()):
    ...

async for value in islice(generator1(), 2, None, 2):
    ...

See builtins.py, itertools.py, and more_itertools.py for full documentation of functions and abilities.

License

aioitertools is copyright Amethyst Reese, and licensed under the MIT license. I am providing code in this repository to you under an open source license. This is my personal repository; the license you receive to my code is from me and not from my employer. See the LICENSE file for details.

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

aioitertools-0.13.0.tar.gz (19.3 kB view details)

Uploaded Source

Built Distribution

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

aioitertools-0.13.0-py3-none-any.whl (24.2 kB view details)

Uploaded Python 3

File details

Details for the file aioitertools-0.13.0.tar.gz.

File metadata

  • Download URL: aioitertools-0.13.0.tar.gz
  • Upload date:
  • Size: 19.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for aioitertools-0.13.0.tar.gz
Algorithm Hash digest
SHA256 620bd241acc0bbb9ec819f1ab215866871b4bbd1f73836a55f799200ee86950c
MD5 5ce4d146a13fe022aa9a0703713a5b2d
BLAKE2b-256 fd3c53c4a17a05fb9ea2313ee1777ff53f5e001aefd5cc85aa2f4c2d982e1e38

See more details on using hashes here.

Provenance

The following attestation bundles were made for aioitertools-0.13.0.tar.gz:

Publisher: ci.yml on omnilib/aioitertools

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file aioitertools-0.13.0-py3-none-any.whl.

File metadata

  • Download URL: aioitertools-0.13.0-py3-none-any.whl
  • Upload date:
  • Size: 24.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for aioitertools-0.13.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0be0292b856f08dfac90e31f4739432f4cb6d7520ab9eb73e143f4f2fa5259be
MD5 89a907e73776953ce3ec4a54770a3e20
BLAKE2b-256 10a1510b0a7fadc6f43a6ce50152e69dbd86415240835868bb0bd9b5b88b1e06

See more details on using hashes here.

Provenance

The following attestation bundles were made for aioitertools-0.13.0-py3-none-any.whl:

Publisher: ci.yml on omnilib/aioitertools

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