huntZip
A lightweight Python module that provides a single, consistent API for compressing and extracting files across multiple archive formats. It automatically determines the appropriate compression method based on the file extension.
Supported Formats
| Format | Extension | Pack | Unpack | Backend |
|---|---|---|---|---|
| ZIP | .zip |
Yes | Yes | zipfile (built-in, with Zip64) |
| 7-Zip | .7z |
Yes | Yes | py7zr (external) |
| TAR | .tar |
Yes | Yes | tarfile (built-in) |
| Gzip TAR | .tar.gz |
Yes | Yes | tarfile + gzip (built-in) |
| Bzip2 TAR | .tar.bz2 |
Yes | Yes | tarfile + bz2 (built-in) |
| XZ TAR | .tar.xz |
Yes | Yes | tarfile + lzma (built-in) |
Prerequisites
The script uses built-in Python modules for most formats. Support for .7z archives requires the py7zr package.
pip install py7zr
Usage
Compression (pack)
The pack function handles both single files and directories. It recursively processes directories while preserving the relative internal structure.
from archiver import pack
# Compress a directory to ZIP
pack(source_path="data/my_folder", archive_name="backup.zip")
# Compress a directory to 7z
pack(source_path="data/my_folder", archive_name="archive.7z")
# Compress a single file to TAR.GZ
pack(source_path="data/document.pdf", archive_name="document.tar.gz")
Extraction (unpack)
The unpack function automatically detects the archive format and extracts its contents to the target directory. If the destination directory does not exist, it will be created.
from archiver import unpack
# Extract to the current directory
unpack(archive_path="backup.zip")
# Extract to a specific directory
unpack(archive_path="archive.7z", extract_to="extracted_data")
# Extract a compressed TAR archive
unpack(archive_path="document.tar.gz", extract_to="output/docs")
Error Handling
FileNotFoundError: Raised if the source path for archiving or the target archive for extraction does not exist.ValueError: Raised if the file extension is missing or not supported by the module.
Metadata
Release files for huntzip 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| huntzip-0.1.0.tar.gz | 2.2 kB | Without provenance | Details for huntzip-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| huntzip-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for huntzip-0.1.0-py3-none-any.whl |
Total release size: 5.0 kB
Release files / huntzip-0.1.0.tar.gz
| Download URL | huntzip-0.1.0.tar.gz |
|---|---|
| Size | 2.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
460788b71991c7c11add8a79fc363870ea5500af564c48984ff0bf67271662fa
|
|
BLAKE2b-256 checksum How to use checksums |
9135c893865d0ee647ceae81a07421423232469ed659ab650ec6270770e3adb7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
Hatch/1.18.0 {"ci":null,"cpu":"AMD64","implementation":{"name":"CPython","version":"3.13.7"},"installer":{"name":"hatch","version":"1.18.0"},"openssl_version":"OpenSSL 3.0.16 11 Feb 2025","python":"3.13.7","system":{"name":"Windows","release":"11"}} HTTPX2/2.10.0
|
Release files / huntzip-0.1.0-py3-none-any.whl
| Download URL | huntzip-0.1.0-py3-none-any.whl |
|---|---|
| Size | 2.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9166dbabe0465eae2fae718fcc67daa0387eae46fed25a11af078afa75b3eaab
|
|
BLAKE2b-256 checksum How to use checksums |
b785a758dd7802a4a027bdb27cea323b5db36186832935531dfe1aaed8357832
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
Hatch/1.18.0 {"ci":null,"cpu":"AMD64","implementation":{"name":"CPython","version":"3.13.7"},"installer":{"name":"hatch","version":"1.18.0"},"openssl_version":"OpenSSL 3.0.16 11 Feb 2025","python":"3.13.7","system":{"name":"Windows","release":"11"}} HTTPX2/2.10.0
|
Security for huntzip 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.