bz2file
Read and write bzip2-compressed files.
What it is and what it does
Bz2file is a bzip2 file handler for Python that mimics the interface of the standard library's bz2 module. It was designed to backport newer bz2 features (like multi-stream support and additional I/O methods) to older Python versions that lacked them. The package reads and writes bzip2-compressed files, supports both text and binary modes, and can work with any file-like object.
The package is now abandoned and has not been updated since 2014-01-19. It remains in the top 15000 PyPI packages by download count, but that reflects historical usage rather than active adoption. High install friction and lack of maintenance make it a poor choice for new projects.
Use it for:
- Decompress multi-stream bzip2 files on Python versions where the standard bz2 module lacks that support.
- Use peek() or read1() methods for incremental bzip2 decompression when the standard library interface is insufficient.
- Maintain legacy code written for older Python versions that relied on bz2file's extended interface.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides a drop-in replacement for Python's standard library bz2 module with support for multi-stream bzip2 files and additional methods like peek(), read1(), and readinto().
No. The package is abandoned, receives no maintenance or security updates, and has high install friction. Unless you are specifically supporting Python 2.6, 2.7, or 3.0 through 3.4 (all end-of-life), use the built-in bz2 module instead.
Install
bz2file on PyPI
pip
pip install bz2fileuv
uv add bz2filepoetry
poetry add bz2fileInstalling bz2file
Before you install
High install friction due to source distribution format. Package is abandoned—last release was 2014-01-19 and last commit 2020-07-18—so no active maintenance or security updates are forthcoming.
License in practice
Licensed under Apache License, Version 2.0 (permissive), so commercial and private use are permitted without restriction.
Quickstart
pip install bz2file
import bz2file
with bz2file.open('file.bz2', 'rb') as f:
data = f.read()
Package is abandoned and untested on modern Python versions; compatibility beyond 3.4 is unverified.
Verify before relying
- Whether the package works reliably on modern Python versions, given its abandonment and age.
- Whether multi-stream bzip2 support is actually needed for your use case, or if the standard library bz2 suffices.
- Current compatibility with Python versions released after 3.4.
Package facts
| License | Apache License, Version 2.0 (permissive) |
| Python support | not specified |
| Install friction | high — source build required |
| Runtime dependencies | none |
| Maintenance | abandoned — 4,590 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 326,812/month — #7,572 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: bz2file-0.98.tar.gz
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
xopenxopen provides a drop-in replacement for…
permissive · top 5,000 on PyPI
compress-pickleWraps Python's standard pickle serialization…
permissive · top 15,000 on PyPI
in-placeProvides an InPlace class for reading and…
permissive · top 15,000 on PyPI
lz4Python bindings for the LZ4 compression…
permissive · top 1,000 on PyPI
zlib-ngProvides faster zlib and gzip compression and…
permissive · top 5,000 on PyPI
pyppmdCompresses and decompresses data using the PPMd…
copyleft · top 5,000 on PyPI
pyzstdProvides Python bindings to the Zstandard…
permissive · top 5,000 on PyPI
stream-unzipStreams unzip operations on ZIP archives…
permissive · top 5,000 on PyPI
indexed-gzipProvides fast random access to gzip-compressed…
permissive · top 15,000 on PyPI
mgzipmgzip provides a drop-in replacement for…
permissive · top 15,000 on PyPI