itertools and builtins for AsyncIO and mixed iterables
Go to file
dependabot[bot] 23aeb18c2e
Bump black from 22.3.0 to 22.6.0 (#121)
Bumps [black](https://github.com/psf/black) from 22.3.0 to 22.6.0.
- [Release notes](https://github.com/psf/black/releases)
- [Changelog](https://github.com/psf/black/blob/main/CHANGES.md)
- [Commits](https://github.com/psf/black/compare/22.3.0...22.6.0)

---
updated-dependencies:
- dependency-name: black
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-08-23 21:51:05 -07:00
.github Remove codecov 2022-02-06 21:10:23 -08:00
aioitertools Fix py3.6 compatibility 2022-05-23 09:57:09 +01:00
docs Switch from m2r to sphinx-mdinclude (#87) 2021-12-09 00:19:57 -08:00
.flake8 Switch from pylint to flake8 2021-05-16 14:04:41 -07:00
.gitignore Add sphinx documentation 2020-04-28 23:07:43 -07:00
.pylint Upgrade deps, fix lint 2020-11-08 13:43:28 -08:00
.readthedocs.yml Add sphinx documentation 2020-04-28 23:07:43 -07:00
CHANGELOG.md Version bump v0.10.0 2022-02-23 19:38:11 -08:00
CODE_OF_CONDUCT.md Implement builtins 2018-06-26 20:54:16 -07:00
CONTRIBUTING.md Readme/contributing updates 2019-10-19 19:51:57 -07:00
LICENSE Initial commit 2018-06-26 09:49:46 -07:00
MANIFEST.in Add changelog, contributers, and code of conduct to sdists 2019-11-12 21:01:10 -08:00
README.md Badges 2022-02-06 21:45:33 -08:00
makefile Remove codecov, enforce 100% coverage 2022-02-06 21:21:56 -08:00
mypy.ini Switch to flit and pyproject.toml 2020-04-22 11:54:06 -07:00
pyproject.toml Reduce to 97% coverage 2022-02-06 21:25:51 -08:00
requirements-dev.txt Bump black from 22.3.0 to 22.6.0 (#121) 2022-08-23 21:51:05 -07:00
requirements.txt Deprecate loop parameter to asyncio functions 2022-02-05 00:31:56 -08:00

README.md

aioitertools

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

documentation version changelog license

Install

aioitertools requires Python 3.6 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 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.