Registry / data / mgzip
library0.2.5pypypi✓ verified 90d ago

A multi-threading implementation of Python's gzip module, providing drop-in replacements for gzip.open, gzip.compress, and gzip.decompress with parallel compression/decompression. Current version 0.2.5 supports Python 3.8-3.14. Active development with regular releases.

pip install mgzip
INSTALL
IMPORT
SIG · MGZIP
M
mgzip
datapythonv0.2.5
Install
1.6s avg
Import
52ms
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v0.2.5 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.056s · 17.9MB
glibc
py 3.10–3.95 runs
installs and imports cleanly · install 1.6s · import 0.048s · 18MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

open
✓ from mgzip import open
✗ import gzip (then using gzip.open)
Using gzip.open instead of mgzip.open won't use multithreading.
compress
✓ from mgzip import compress
decompress
✓ from mgzip import decompress

Basic usage of mgzip.open for writing and reading gzip files with multiple threads.

from mgzip import open # Multithreaded gzip compression with open('example.txt.gz', 'wt', compresslevel=5, thread=4) as f: f.write('Hello, world!') # Multithreaded decompression with open('example.txt.gz', 'rt', thread=4) as f: print(f.read())
Debug
Known issues
gotchaThe parameter for number of threads is 'thread' (singular), not 'threads' or 'num_workers'.
fix
Use keyword argument 'thread' when opening files.
affects: all
gotchamgzip may be slower than gzip for small files or low block counts due to threading overhead.
fix
Consider using standard gzip for files < 1 MB.
affects: all
deprecatedThe old class name 'MultiGzipFile' is deprecated; use 'open' function instead.
fix
Replace 'MultiGzipFile' with mgzip.open() or mgzip.MultiGzipFile is still available but not recommended.
affects: >=0.2.1
breakingPython 3.12+ removed some internal attributes (e.g., _read_exact, unconsumed_tail); mgzip 0.2.3+ fixed this, but older versions break on Python 3.12+.
fix
Upgrade to mgzip >=0.2.3.
affects: <0.2.3
Errors
Common errors & fixes
AttributeError: '_MultiGzipReader' object has no attribute '_read_exact'
Python 3.12+ removed internal gzip._read_exact method.
fix
Upgrade mgzip to >=0.2.3.
AttributeError: 'Decompress' object has no attribute 'unconsumed_tail'
Python 3.12+ changed zlib decompressobj API.
fix
Upgrade mgzip to >=0.2.3.
ResourceWarning: unclosed <socket> for multiprocessing pool
Multiprocessing pool not cleaned properly in mgzip <0.2.2.
fix
Upgrade mgzip to >=0.2.2.
TypeError: 'thread' is an invalid keyword argument for this function
Using 'threads' or 'num_threads' instead of 'thread'.
fix
Use thread=<N> as keyword argument.
Upgrade
Version history
0.2.5latest on PyPI · released Feb 28, 2026
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
mgzip — pip install mgzip · libregistry