109 lines
3.2 KiB
Plaintext
109 lines
3.2 KiB
Plaintext
Metadata-Version: 2.4
|
||
Name: aioitertools
|
||
Version: 0.13.0
|
||
Summary: itertools and builtins for AsyncIO and mixed iterables
|
||
Author-email: Amethyst Reese <amethyst@n7.gg>
|
||
Requires-Python: >=3.9
|
||
Description-Content-Type: text/markdown
|
||
License-Expression: MIT
|
||
Classifier: Framework :: AsyncIO
|
||
Classifier: Intended Audience :: Developers
|
||
Classifier: Topic :: Software Development :: Libraries
|
||
License-File: LICENSE
|
||
Requires-Dist: typing_extensions>=4.0; python_version < '3.10'
|
||
Project-URL: Changelog, https://aioitertools.omnilib.dev/en/latest/changelog.html
|
||
Project-URL: Documentation, https://aioitertools.omnilib.dev
|
||
Project-URL: Github, https://github.com/omnilib/aioitertools
|
||
|
||
aioitertools
|
||
============
|
||
|
||
Implementation of itertools, builtins, and more for AsyncIO and mixed-type iterables.
|
||
|
||
[](https://aioitertools.omnilib.dev)
|
||
[](https://pypi.org/project/aioitertools)
|
||
[](https://aioitertools.omnilib.dev/en/latest/changelog.html)
|
||
[](https://github.com/omnilib/aioitertools/blob/main/LICENSE)
|
||
|
||
|
||
Install
|
||
-------
|
||
|
||
aioitertools requires Python 3.9 or newer.
|
||
You can install it from PyPI:
|
||
|
||
```sh
|
||
$ 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:
|
||
|
||
```python
|
||
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:
|
||
|
||
```python
|
||
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](https://noswap.com), 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.
|
||
|
||
|
||
[builtins.py]: https://github.com/omnilib/aioitertools/blob/main/aioitertools/builtins.py
|
||
[itertools.py]: https://github.com/omnilib/aioitertools/blob/main/aioitertools/itertools.py
|
||
[more_itertools.py]: https://github.com/omnilib/aioitertools/blob/main/aioitertools/more_itertools.py
|
||
|