Asynchronous gzip file reader/writer with aiocsv support.
Project description
aiogzip ⚡️
An asynchronous library for reading and writing gzip-compressed files.
aiogzip provides a fast, simple, and asyncio-native interface for handling .gz files, making it a useful complement to Python's built-in gzip module for asynchronous applications.
Features
- Truly Asynchronous: Built with
asyncioandaiofiles. - High-Performance: Optimized buffer handling for fast I/O.
- Drop-in Replacement: Mimics
gzip.open()with asyncseek,tell,peek, andreadintosupport; verified against tarfile-style access patterns and aiocsv workflows. - Reproducible Archives: Control gzip
mtimeand embedded filenames. - Type-Safe: Distinct
AsyncGzipBinaryFileandAsyncGzipTextFile. aiocsvReady: Seamless integration for CSV pipelines.- Predictable Performance: Backward seeks rewind the stream and re-decompress data (same as
gzip.GzipFile), so treat random access as O(n) and prefer forward-only patterns when possible.
Quickstart
pip install aiogzip
import asyncio
from aiogzip import AsyncGzipFile
async def main():
# Write
async with AsyncGzipFile("file.gz", "wb") as f:
await f.write(b"Hello, async world!")
# Read
async with AsyncGzipFile("file.gz", "rb") as f:
print(await f.read())
asyncio.run(main())
# Deterministic metadata
async with AsyncGzipFile(
"dataset.gz", "wb", mtime=0, original_filename="dataset.csv"
) as f:
await f.write(b"stable bytes")
Performance
- Text I/O: Often ~2-3x faster than standard
gzipin bulk text workflows. - Binary I/O: Typically near parity for bulk reads/writes, and can be slower for very small chunk sizes.
- Concurrency: Non-blocking I/O can improve throughput in latency-bound multi-file workloads.
- Memory: Optimized buffer management for stable memory usage.
See the Performance Guide for detailed benchmarks.
Contributing
See CONTRIBUTING.md for development instructions.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file aiogzip-1.3.0.tar.gz.
File metadata
- Download URL: aiogzip-1.3.0.tar.gz
- Upload date:
- Size: 49.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.22 {"installer":{"name":"uv","version":"0.9.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"25.10","id":"questing","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
617b5ebdcd236a874484ed40a7f38d77363e71d852c941a8e2e46468e9d2d485
|
|
| MD5 |
f286e5a8d95b7806bf09a1369c4a8fd3
|
|
| BLAKE2b-256 |
793283a7e543ec8e3d6b6d620c952d783ec0201a411a0631a4b9d383dcec0eb2
|
File details
Details for the file aiogzip-1.3.0-py3-none-any.whl.
File metadata
- Download URL: aiogzip-1.3.0-py3-none-any.whl
- Upload date:
- Size: 22.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.22 {"installer":{"name":"uv","version":"0.9.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"25.10","id":"questing","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d0ea08150d8ad33cde2c96c8057927be45c57e1a2447d6c6c7293017df086aab
|
|
| MD5 |
02908cd1d9473484862474bcbf896696
|
|
| BLAKE2b-256 |
cee1c07814f35f28c4723533f686d54b852955352c2ef4eaba7314f48f2f2333
|