iterable-io is a lightweight Python library (current version 1.0.1) that provides an `IterableIO` class to adapt any byte-iterable (like generators, lists, or custom iterators) into a file-like object conforming to the `io.RawIOBase` interface. This allows iterables to be used in contexts expecting file-like objects, such as `zipfile.ZipFile`, `tarfile.TarFile`, or HTTP request bodies. The library is stable with a slow, focused release cadence.
pip install iterable-ioVerified import paths — ran on the pinned version, not inferred.
Demonstrates creating an `IterableIO` from a byte generator and using it directly or wrapping it with `io.TextIOWrapper` for string-based operations.
Ensure the underlying iterable yields `bytes` objects, or use `io.TextIOWrapper(IterableIO(byte_iterable), encoding='utf-8')` for text handling.
This library is designed for reading from iterables. If write functionality is needed, a different approach or library should be used, or a custom class inheriting from `io.RawIOBase` that implements writable methods.
Always check the return value of `read()` for `b''` to detect end-of-file, rather than assuming it will return exactly `size` bytes or `None`.
No dependency data recorded yet.