iterable-io
Adapt generators and other iterables to a file-like interface
What it is and what it does
iterable-io bridges a common interface mismatch: when one part of your code has a generator or other iterable producing data, but another part expects a file-like object with a `.read()` method. Rather than materializing the entire iterable into a temporary file (which is slow and memory-intensive), this library streams data on demand, pulling from the iterable as `.read()` is called.
The package exports a single function, `open_iterable()`, designed to mimic Python's builtin `open()`. It accepts an iterable, a mode string ('rb', 'rt', etc.), and optional parameters like encoding and buffering, returning a file-like object. This is useful for gluing together incompatible APIs—for example, when a library expects a file handle but your data comes from a generator of bytes or lines.
Use it for:
- Adapt a generator of bytes to feed into a library that requires a file-like object (e.g., image processing, archive extraction).
- Stream text data line-by-line from a generator without materializing the full dataset into memory.
- Convert network streams or database result iterators into file-like interfaces for downstream processing.
- Avoid temporary file creation when bridging APIs that produce and consume data differently.
- Read compressed or encoded data from a generator while handling text-mode decoding transparently.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Wraps iterables (generators, lists, etc.) as file-like objects so code expecting `.read()` can consume streaming data without buffering to disk.
Yes. The package solves a real interface-adaptation problem with zero dependencies, low install friction, active maintenance, and no known vulnerabilities. The copyleft license (LGPL-3.0-only) is straightforward for most use cases but requires review if you plan to modify or redistribute the code. Install it when you need to feed an iterable into code expecting a file-like object.
Install
iterable-io on PyPI
pip
pip install iterable-iouv
uv add iterable-iopoetry
poetry add iterable-ioInstalling iterable-io
Before you install
No runtime dependencies and a pure-Python wheel distribution make installation straightforward. The package is actively maintained with a recent release.
License in practice
Licensed under LGPL-3.0-only (copyleft). Any derivative work or modification must be distributed under the same license; static linking or bundling requires careful attention to license compliance.
Quickstart
pip install iterable-io
from iterable_io import open_iterable
gen = (b'chunk' for _ in range(3))
fp = open_iterable(gen, 'rb')
data = fp.read(4096)
fp.close()
Verify before relying
- Whether the library handles all edge cases for text-mode encoding/decoding (e.g., multi-byte character boundaries across chunk boundaries).
- Performance characteristics when iterables produce very small chunks or very large chunks.
- Whether buffering options (if any) are configurable beyond what the docstring documents.
Package facts
| License | LGPL-3.0-only (copyleft) |
| Python support | supports the current Python release (>=3.5) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 89 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 665,646/month — #5,427 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: iterable_io-1.0.4-py3-none-any.whl
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
zipstream-ngGenerates zip files on-the-fly by streaming…
copyleft · top 5,000 on PyPI
zipstreamGenerates zip archives as an iterator of byte…
unclear · top 15,000 on PyPI
flupyFlupy provides a fluent interface for lazy…
permissive · top 5,000 on PyPI
zipstream-newGenerates zip archives as iterators of byte…
copyleft · top 15,000 on PyPI
streaming-form-dataParses multipart/form-data streams…
permissive · top 15,000 on PyPI
jsonslicerParses JSON streams and large files without…
permissive · top 15,000 on PyPI
ijsonijson is an iterative JSON parser that reads…
permissive · top 1,000 on PyPI
seekablehttpfileProvides a file-like object that fetches remote…
permissive · top 15,000 on PyPI
iterproxyWraps any iterable object to provide ORM-style…
permissive · top 5,000 on PyPI
file-read-backwardsReads files line-by-line from end to beginning…
permissive · top 15,000 on PyPI