Skip to main content

itertools and builtins for AsyncIO and mixed iterables

Project description


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

build status code coverage version license code style


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

$ pip install aioitertools


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,, and for full documentation of functions and abilities.


aioitertools is copyright John 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.

Files for aioitertools, version 0.8.0
Filename, size File type Python version Upload date Hashes
Filename, size aioitertools-0.8.0-py3-none-any.whl (21.6 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size aioitertools-0.8.0.tar.gz (30.3 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page