Python bindings for bit7z
Project description
bit7z-python
The Support of bit7z in Python
⚠️Notice: this package needs Python 3.9 or later
🚀 Usage
To install, just simply use this command:
pip install bit7z-python
To verify install (⚠️Not available in v0.0.1 becuase there is a minor bug), run:
python -c "import bit7z_python; print(bit7z_python.__version__)"
Quick Start
import bit7z_python as b7z
lib = b7z.Bit7zLibrary()
compressor = b7z.BitFileCompressor(lib, b7z.FORMAT_7Z)
# 压缩整个目录
compressor.compress_directory_contents("./my_folder", "./archive.7z")
# 解压
extractor = b7z.BitFileExtractor(lib, b7z.FORMAT_AUTO)
extractor.extract("./archive.7z", "./output/")
⚡ Performance
Compared to pure-Python alternatives like py7zr, bit7z-python delivers 2.2x faster decompression.
| Tool | Time | Relative Speed |
|---|---|---|
py7zr (pure Python) |
~22.0s | 1x |
bit7z-python |
~10.0s | 2.2x |
Test environment: Intel Core i5-1135G7 CPU, 16GB RAM, Windows 10 22H2, Python 3.11.
The test files are located in the test/ directory of this repository:
test/GTK4.7z— 137MB archive for extraction teststest/wx_demos/— 37MB folder for compression tests
Test code: (Needs package py7zr)
import bit7z_python
import py7zr
import time as t
import shutil
import os
print("Extract test starts.")
with py7zr.SevenZipFile(r"./GTK4.7z", "r") as fp:
print("py7zr extracting ...")
t0 = t.time()
fp.extractall()
t1 = t.time()
print(f"py7zr used time (extraction): {t1 - t0} s")
shutil.rmtree(r"./GTK4")
print("bit7z-python extracting ...")
lib = bit7z_python.Bit7zLibrary(r"7z.dll")
ext = bit7z_python.BitFileExtractor(lib, bit7z_python.FORMAT_AUTO)
t2 = t.time()
ext.extract(r"./GTK4.7z", r"./GTK4")
t3 = t.time()
print(f"bit7z-python used time (extraction): {t3 - t2} s")
shutil.rmtree(r"./GTK4")
print("Compression test starts.")
with py7zr.SevenZipFile(r"test.7z", "w") as fp:
print("py7zr compressing ...")
t4 = t.time()
fp.writeall(r"./wx_demos")
t5 = t.time()
print(f"py7zr used time (compression): {t5 - t4} s")
os.remove("test.7z")
print("bit7z-python compressing ...")
cps = bit7z_python.BitFileCompressor(lib, bit7z_python.FORMAT_7Z)
t6 = t.time()
cps.compress_directory_contents(r"./wx_demos", r"./test.7z", True, "*")
t7 = t.time()
print(f"bit7z-python used time (compression): {t7 - t6} s")
os.remove("test.7z")
Test result:
Python 3.11.9 (tags/v3.11.9:de54cf5, Apr 2 2024, 10:12:12) [MSC v.1938 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license()" for more information.
= RESTART: D:\QMDownload\Hotfix\Python\Files\test.py
Extract test starts.
py7zr extracting ...
py7zr used time (extraction): 20.60436773300171 s
bit7z-python extracting ...
bit7z-python used time (extraction): 9.123618602752686 s
Compression test starts.
py7zr compressing ...
py7zr used time (compression): 11.3125159740448 s
bit7z-python compressing ...
bit7z-python used time (compression): 5.000096797943115 s
Status
This project is still developing. However, the first release has published🚀, and more function will be added in the future releases.
🗺️ Roadmap
Hotfix release v0.0.2
Since we have found some little bugs in local tests, we will fix them, link newest bit7z, but we won't provide full support for bit7z v4.1.0
v0.1.0 (Next Release)
- Upgrade bit7z to v4.1.0
- API compatibility updates (no breaking changes)
- Performance improvements from bit7z v4.1.0
v0.2.0 ~ v1.0.0
-
BitArchiveEditor— edit existing archives (add/remove/update) -
BitArchiveWriter— create archives -
BitArchiveReader— read archive metadata
v1.0.0+
- Memory compression/decompression (
BitMemCompressor/BitMemExtractor) - Stream compression/decompression
- Nested archive support (v4.1.0 feature)
Goal
Provide a full-featured, convenient, and efficient compression library for Python.
📖 Documentation
For now, please refer to the bit7z Wiki for API details.
The Python API follows the same structure with PEP8 naming conventions:
| bit7z (C++) | bit7z-python (Python) |
|---|---|
compressFiles() |
compress_files() |
extractArchive() |
extract_archive() |
BitFileCompressor |
BitFileCompressor (same) |
Full API documentation is planned for future releases.
License
This project is under the Apache-2.0 License, see here for more details
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 Distributions
Built Distributions
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 bit7z_python-0.0.2-cp314-cp314t-win_amd64.whl.
File metadata
- Download URL: bit7z_python-0.0.2-cp314-cp314t-win_amd64.whl
- Upload date:
- Size: 2.8 MB
- Tags: CPython 3.14t, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d2d522bc09866a6bf9cdc27183b7fa64c7f784833963c11ca530a4f6a96384ae
|
|
| MD5 |
ffb5ece45405d599f4007bec8ab24ce1
|
|
| BLAKE2b-256 |
775c8fd4d1016d3b8851df0ad1a360776e15ac500749fd2a597abae27ae4372b
|
File details
Details for the file bit7z_python-0.0.2-cp314-cp314t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: bit7z_python-0.0.2-cp314-cp314t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 2.8 MB
- Tags: CPython 3.14t, manylinux: glibc 2.27+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dc6e9f3c92c8ef7af9bad4c263fdce71375a746e8dec2c0bfa911b7bfb6d2f5c
|
|
| MD5 |
d9fc0b6a9fed279e6f8aefce36fc3b1a
|
|
| BLAKE2b-256 |
f445495ee3b22ddd3dc59428e3cc656a43ffd00288ad03bb7938e2cf70b7ce0a
|
File details
Details for the file bit7z_python-0.0.2-cp314-cp314-win_amd64.whl.
File metadata
- Download URL: bit7z_python-0.0.2-cp314-cp314-win_amd64.whl
- Upload date:
- Size: 2.8 MB
- Tags: CPython 3.14, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4eb1eb367b7a6338a33067eded0123c5905c65d635386c9a8b2dc52c9819ab4b
|
|
| MD5 |
0cf460c6031889f5f1028bb8d667fbf0
|
|
| BLAKE2b-256 |
0103fa7a77b7fee4aacda4fe7ae9afa8b08c77a0dc46af13069a3ae98cfb2655
|
File details
Details for the file bit7z_python-0.0.2-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: bit7z_python-0.0.2-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 2.8 MB
- Tags: CPython 3.14, manylinux: glibc 2.27+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
61a1efe26efe0d1660a63ed5b01e5151ab1714c1725d34da2d8ad3cb469c9f22
|
|
| MD5 |
8962824b804762bb1bdd08f76f8a0a04
|
|
| BLAKE2b-256 |
9ebb87f2768a45ec70cfc366bf14127c5540aa00a78a2a6459114f8f24afb517
|
File details
Details for the file bit7z_python-0.0.2-cp313-cp313-win_amd64.whl.
File metadata
- Download URL: bit7z_python-0.0.2-cp313-cp313-win_amd64.whl
- Upload date:
- Size: 2.7 MB
- Tags: CPython 3.13, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c8b38a5b41c22d12ebd6bfaa83ff36134fb13c7f38c85b8a2ddcbbf627e1b34b
|
|
| MD5 |
15e171ee2a651e07378079e302262259
|
|
| BLAKE2b-256 |
20979a8f858a8e56ef3d5d5d96ca0db3780e11721e29107d9b9f42bd17722568
|
File details
Details for the file bit7z_python-0.0.2-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: bit7z_python-0.0.2-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 2.8 MB
- Tags: CPython 3.13, manylinux: glibc 2.27+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
67d1b855ea44acab2ea5e3f91a7ff6016ba80c71e9f2d41e2ede7fbc391a2043
|
|
| MD5 |
3405d3b94b0f89e133029a946adb7901
|
|
| BLAKE2b-256 |
71e4064ee5744dc78691b7ed31b0a1fad91feda32e7483c2230af2d2320707ec
|
File details
Details for the file bit7z_python-0.0.2-cp312-cp312-win_amd64.whl.
File metadata
- Download URL: bit7z_python-0.0.2-cp312-cp312-win_amd64.whl
- Upload date:
- Size: 2.7 MB
- Tags: CPython 3.12, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b1b4656fda1781250942c70664bf0c040034bc30c47d0fe7461dd29579f25cc0
|
|
| MD5 |
a39e62d66054c666c28fc93b3402ac4b
|
|
| BLAKE2b-256 |
b1cd3046a34048fcf85eda75c3a2968d6d24eba0b4f581290ebee7ff3cf54cbd
|
File details
Details for the file bit7z_python-0.0.2-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: bit7z_python-0.0.2-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 2.8 MB
- Tags: CPython 3.12, manylinux: glibc 2.27+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7402a6bd2553c3835b37e6762d652c49069907febf05d9967936d0d084bc7b50
|
|
| MD5 |
008316c559cd285c690d5e30e04c8793
|
|
| BLAKE2b-256 |
9c1ab2d2feae4a09d6c1eaf8d8b8ed2e6eb4c106b9b734bd2c88d8231c8f667e
|
File details
Details for the file bit7z_python-0.0.2-cp311-cp311-win_amd64.whl.
File metadata
- Download URL: bit7z_python-0.0.2-cp311-cp311-win_amd64.whl
- Upload date:
- Size: 2.7 MB
- Tags: CPython 3.11, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0763834a54187bc1a55784854a637d7d29304949f373db60a5cd6a648227caa0
|
|
| MD5 |
02192faa144c92f24204f289578deaac
|
|
| BLAKE2b-256 |
44e591fca419d8673c69a79e2139f5d7ee6105e0f8ec4f0928e8e8d7c3e9e5c7
|
File details
Details for the file bit7z_python-0.0.2-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: bit7z_python-0.0.2-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 2.8 MB
- Tags: CPython 3.11, manylinux: glibc 2.27+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
566f0acb0d1019f68fab2efe2b784e05b5f3945da9c2a4eae1eb80382ed92f47
|
|
| MD5 |
cf4a6d243672315f71b129119c01aa53
|
|
| BLAKE2b-256 |
6b0b01cde81c222fa7b0388c662494360713ad00d3c7ade8204131f14a0f45c7
|
File details
Details for the file bit7z_python-0.0.2-cp310-cp310-win_amd64.whl.
File metadata
- Download URL: bit7z_python-0.0.2-cp310-cp310-win_amd64.whl
- Upload date:
- Size: 2.7 MB
- Tags: CPython 3.10, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3b80c29bfac55d04acc66ca8b09f54979962b095b4babdeeca7176e7836913d0
|
|
| MD5 |
82bf7706dc39fb73689185a899fa0758
|
|
| BLAKE2b-256 |
728ed7b2214b37769e8b76fa2d8aa9e4b82200c388fa14ca66e0c8a7083ba3a5
|
File details
Details for the file bit7z_python-0.0.2-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: bit7z_python-0.0.2-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 2.8 MB
- Tags: CPython 3.10, manylinux: glibc 2.27+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3e0fc9761deff1aa6b4b6d0a1741524475f52cd65eb6747ed0dda64aa99953ae
|
|
| MD5 |
2c05addb9f4f5a9edc9fbaa7bc8087ac
|
|
| BLAKE2b-256 |
38accdbd5606b91a01cc465beb8fc0e5ff8afccc0a91bd756c9325f1eda87bc7
|
File details
Details for the file bit7z_python-0.0.2-cp39-cp39-win_amd64.whl.
File metadata
- Download URL: bit7z_python-0.0.2-cp39-cp39-win_amd64.whl
- Upload date:
- Size: 2.7 MB
- Tags: CPython 3.9, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
22c31aea0d273626877f3c66c788130f066a7e62d737cabe493cf0863e6e859c
|
|
| MD5 |
59249804f76a4740d1a8649adfd5a5bb
|
|
| BLAKE2b-256 |
c6e4a5d1ac2a1895ad64432ee9322b7aa3d96ba6f4e6f73b6b882903ad959777
|
File details
Details for the file bit7z_python-0.0.2-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: bit7z_python-0.0.2-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 2.8 MB
- Tags: CPython 3.9, manylinux: glibc 2.27+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
82b5b875693dfdb8793c84894d29fa2e1e8fa02e665a606653f0710183a0da3d
|
|
| MD5 |
3bd45cd7f7f5c297b38458bf1447340c
|
|
| BLAKE2b-256 |
c92fd615c9168bbbbd591ef6c9dc7705d68d2c5dcbef815083ab518037cac040
|