skillfed

stream-inflate

Uncompress DEFLATE streams in pure Python (albeit compiled with Cython)

stream-inflate v0.0.43 879.2K downloads/30d#4,824 on PyPI11
Permissive license Active released

What it is and what it does

stream-inflate is a pure-Python (Cython-compiled) library for decompressing DEFLATE and DEFLATE64 streams incrementally. It solves the problem of decompressing data when you don't know the total size upfront or when compressed data is followed by other bytes—common in HTTP responses and ZIP file parsing. Instead of loading the entire stream into memory, you feed it chunks and iterate over uncompressed output, making it suitable for large or streaming sources.

The library exposes two main functions: `stream_inflate()` for standard DEFLATE and `stream_inflate64()` for DEFLATE64. Both return a tuple of callables: one to feed compressed chunks, one to check if decompression is complete, and one to query unconsumed bytes. This design lets you handle edge cases like ZIP files where data follows the compressed stream without buffering everything.

Use it for:

  • Decompress HTTP responses with Content-Encoding: deflate without loading the entire response body into memory.
  • Parse ZIP files where DEFLATE-compressed entries are followed by additional metadata or other entries.
  • Stream large compressed files from disk or network in fixed-size chunks to keep memory usage bounded.
  • Handle DEFLATE64 streams in ZIP64 archives or other formats that use the extended compression method.
  • Detect the end of a DEFLATE stream and identify trailing bytes that are not part of the compressed data.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Decompresses DEFLATE and DEFLATE64 streams in pure Python, designed to handle streaming data where the compressed content length is unknown or followed by additional data.

Yes, if you need streaming DEFLATE decompression with unknown or bounded memory. The library is actively maintained, permissively licensed, has no known vulnerabilities, and solves a real problem that standard library tools don't address cleanly. Medium install friction is acceptable given broad wheel coverage. Not worth installing if you only decompress small, pre-sized payloads or can use existing tools directly.

Install

stream-inflate on PyPI

pip

pip install stream-inflate

uv

uv add stream-inflate

poetry

poetry add stream-inflate

Installing stream-inflate

Before you install

Medium install friction due to compiled Cython wheels, but broad platform coverage (macOS, Linux x86_64/aarch64, Windows, musl) for Python 3.10–3.12 reduces friction in practice. Active maintenance with recent commits.

License in practice

MIT license (permissive) — no restrictions on commercial or proprietary use, and no copyleft obligations.

Quickstart

from stream_inflate import stream_inflate

def compressed_chunks():
    # Yields bytes of a DEFLATE-compressed stream
    yield b'compressed data'

for uncompressed_chunk in stream_inflate()[0](compressed_chunks()):
    print(uncompressed_chunk)

Requires Python >=3.7.7; wheels available for Python 3.10–3.12 on common platforms.

Verify before relying

  • Performance characteristics (throughput, memory overhead) compared to standard zlib for streaming use.
  • Whether DEFLATE64 support covers all ZIP64 edge cases or has known limitations.
  • API stability: version 0.0.43 suggests pre-1.0; breaking changes possible in future releases.

Package facts

License not declared (permissive)
Python support supports the current Python release (>=3.7.7)
Install friction medium — platform-specific wheel
Runtime dependencies none
Maintenance actively maintained — 163 days since the last release
Last repo commit
First released
Downloads 879,240/month — #4,824 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: stream_inflate-0.0.43-cp310-cp310-macosx_10_9_universal2.whl; stream_inflate-0.0.43-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl; stream_inflate-0.0.43-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl; stream_inflate-0.0.43-cp310-cp310-musllinux_1_1_aarch64.whl; stream_inflate-0.0.43-cp310-cp310-musllinux_1_1_x86_64.whl; stream_inflate-0.0.43-cp310-cp310-musllinux_1_2_aarch64.whl; stream_inflate-0.0.43-cp310-cp310-musllinux_1_2_armv7l.whl; stream_inflate-0.0.43-cp310-cp310-musllinux_1_2_x86_64.whl; stream_inflate-0.0.43-cp310-cp310-win_amd64.whl; stream_inflate-0.0.43-cp311-cp311-macosx_10_9_universal2.whl; stream_inflate-0.0.43-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl; stream_inflate-0.0.43-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl; stream_inflate-0.0.43-cp311-cp311-musllinux_1_1_aarch64.whl; stream_inflate-0.0.43-cp311-cp311-musllinux_1_1_x86_64.whl; stream_inflate-0.0.43-cp311-cp311-musllinux_1_2_aarch64.whl; stream_inflate-0.0.43-cp311-cp311-musllinux_1_2_armv7l.whl; stream_inflate-0.0.43-cp311-cp311-musllinux_1_2_x86_64.whl; stream_inflate-0.0.43-cp311-cp311-win_amd64.whl; stream_inflate-0.0.43-cp312-cp312-macosx_10_13_universal2.whl; stream_inflate-0.0.43-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

License :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3Topic :: System :: Archiving :: Compression

Tags

deflate stream decompressionstreaming compression decompressiondeflate64 uncompresspure python deflatestreaming zlib decompressiondeflate stream parsingincremental deflate decompression
streaming-decompressiondeflate-codeczip-parsing

More Compression packages