--- id: iterable-io version: "1.0.4" license: LGPL-3.0-only license_treatment: copyleft maintenance: active --- # iterable-io — Adapt generators and other iterables to a file-like interface License: copyleft · Maintenance: active · Downloads: 665.6K/mo ## 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 above — 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 pip install iterable-io uv add iterable-io poetry add iterable-io ## Installing 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_current - Install friction: low - Maintenance: active - Downloads: 665.6K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags generator to file-like object, iterable file adapter, streaming data interface, read from generator, file-like wrapper for iterables, convert iterable to file object, generator file interface, file-like-adapter, streaming, interface-glue [View on SkillFed](https://skillfed.io/packages/iterable-io) · [View on PyPI](https://pypi.org/project/iterable-io/)