Repository navigation
Home
Welcome to the official documentation of bit7z-python β a Python binding for the powerful bit7z library, providing fast and feature-rich archive compression and extraction using 7βzip.
Here is a minimal example to get you started:
import bit7z_python as b7z
lib = b7z.Bit7zLibrary()
compressor = b7z.BitFileCompressor(lib, b7z.FORMAT_7Z)
# Compress an entire directory
compressor.compress_directory_contents("./my_folder", "./archive.7z")
# Extract the archive
extractor = b7z.BitFileExtractor(lib, b7z.FORMAT_AUTO)
extractor.extract("./archive.7z", "./output/")Tip: You can find a more comprehensive test script in the repository.
Clone the repository with Git LFS support (the test archives are stored with LFS):
git clone https://github.com/ZhouSicheng-2011/bit7z-python.git
β οΈ Important: Do not download the source code as a ZIP archive β the test files use Git LFS and will be corrupted if downloaded without LFS support.
| Topic | Description |
|---|---|
| Bit7zLibrary | Loading and configuring the 7βzip shared library. |
| BitFileCompressor | Compressing files and directories to the filesystem. |
| BitFileExtractor | Extracting archives from the filesystem. |
| Formats | Format classes (BitInFormat, BitInOutFormat) and all available format constants. |
| Enumerations | All enum types (compression level, method, error codes, policies, etc.). |
| Callback definitions | Signatures and examples for all supported callbacks (progress, password, file, etc.). |
Support for integrating with GUI applications (e.g., progress bars in Qt or Tkinter) is planned for a future release. Stay tuned!
Special thanks to Riccardo (rikyoz), the author of bit7z, for creating such a clean and well-documented C++ library. His work made it possible to build this Python binding efficiently and with confidence.