Registry / data / aiostream

aiostream

JSON →
library0.7.1pypypi✓ verified 24d ago

aiostream provides a collection of stream operators that can be combined to create asynchronous pipelines of operations. It can be seen as an asynchronous version of itertools, although some aspects are are slightly different, offering features like operator pipe-lining, repeatability, and safe iteration contexts. The library is currently at version 0.7.1 and maintains an active development and release cadence.

pip install aiostream
INSTALL
IMPORT
SIG · AIOSTREAM
A
aiostream
datapythonv0.7.1
Install
1.7s avg
Import
238ms
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.7.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.250s · 18.4MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.7s · import 0.226s · 19MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

stream
from aiostream import stream
from aiostream.core import Stream
The primary stream creation methods are exposed directly under 'aiostream.stream'.
pipe
from aiostream import pipe
from aiostream.operators import pipe
Pipe operators are available directly from 'aiostream.pipe' for pipe-lining operations.

This quickstart demonstrates creating an asynchronous stream, applying transformations using pipe operators, iterating through the stream, and awaiting a stream to collect its results.

import asyncio from aiostream import stream, pipe async def main(): # Create a counting stream with a 0.1-second interval xs = stream.count(interval=0.1) # Operators can be piped using '|' to transform the stream ys = xs \ | pipe.map(lambda x: x**2) \ | pipe.take(5) # Take the first 5 elements print("Squared stream elements:") # Use a stream context for proper resource management and iterate async with ys.stream() as streamer: async for y in streamer: print(f"-> {y}") # Streams can also be awaited to get the last value after processing last_value = await (stream.range(1, 4) | pipe.list()) print(f"List from range stream: {last_value}") if __name__ == "__main__": asyncio.run(main())
Debug
Known issues
breakingIn `aiostream` v0.6.0, stream operators (e.g., `map`, `filter`) transitioned from being classes to singleton objects. This means you should directly call `stream.map(...)` instead of `stream.map().pipe(...)` or `stream.Map().pipe(...)`.
fix
Remove explicit instantiation of operators. For example, change `stream.map(func)` to `stream.map(source, func)` or `source | pipe.map(func)`.
affects: >=0.6.0
breakingIn `aiostream` v0.5.0, the `merge`, `chain`, and `ziplatest` operators no longer accept zero sources. Passing no arguments will now result in an error, as they expect at least one source stream to combine.
fix
Ensure that `stream.merge()`, `stream.chain()`, or `stream.ziplatest()` are always provided with one or more asynchronous iterable sources.
affects: >=0.5.0
gotchaStarting with `aiostream` v0.7.0, a `ValueError` is raised if `task_limit` or `ordered` arguments are provided to an operator (like `pipe.map`) when the supplied function is synchronous. These arguments are only applicable when the function being mapped is an asynchronous coroutine.
fix
When using `pipe.map` or similar operators with a synchronous function, omit the `task_limit` and `ordered` arguments. Ensure these arguments are only used with asynchronous functions.
affects: >=0.7.0
breaking`aiostream` dropped support for Python 3.8 in version 0.6.4. The library now officially requires Python 3.9 or newer.
fix
Upgrade your Python environment to version 3.9 or later to use `aiostream` versions 0.6.4 and above.
affects: >=0.6.4
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'aiostream'
The 'aiostream' package is not installed in the Python environment.
fix
Install the package using 'pip install aiostream'.
ImportError: cannot import name 'stream' from 'aiostream'
The 'stream' module is not available in the 'aiostream' package, possibly due to an incorrect import statement.
fix
Ensure the correct import statement: 'from aiostream import stream'.
TypeError: 'Stream' object is not iterable
Attempting to iterate over a 'Stream' object without using an asynchronous context.
fix
Use 'async for' within an 'async with' context: 'async with stream.stream() as s: async for item in s: ...'.
AttributeError: module 'aiostream' has no attribute 'pipe'
The 'pipe' module is not directly accessible from 'aiostream'.
fix
Import 'pipe' separately: 'from aiostream import pipe'.
RuntimeError: This event loop is already running
Calling 'asyncio.run()' inside an already running event loop, often in interactive environments like Jupyter notebooks.
fix
Use 'await' directly in an async function or use 'nest_asyncio' to allow nested event loops.
Upgrade
Version history
0.7.1latest on PyPI · released Oct 13, 2025
Audit
Dependencies

No dependency data recorded yet.

Agent activity
50 hits · last 30 days
node
42
Amazon
1
OpenAI (training)
1
Resources
aiostream — pip install aiostream · libregistry