wheel (GitLab)
wheel (GHA via
nightly.link
)
We have moved to https://codeberg.org/implode-compression-impls/pkblast.py, grab new versions there.
Under the disguise of "better security" Micro$oft-owned GitHub has discriminated users of 1FA passwords while having commercial interest in success of FIDO 1FA specifications and Windows Hello implementation which it promotes as a replacement for passwords. It will result in dire consequencies and is competely inacceptable, read why.
If you don't want to participate in harming yourself, it is recommended to follow the lead and migrate somewhere away of GitHub and Micro$oft. Here is the list of alternatives and rationales to do it. If they delete the discussion, there are certain well-known places where you can get a copy of it. Read why you should also leave GitHub.
This are free and Open-Source ctypes-based bindings to libblast
by Mark @madler Adler, which is a Free Open-Source implementation of a decompressor of PKWare Data Compression Library (DCL) compression format.
For compression you need pkimplode.py
a separate wrapper to a separate library by another author.
For decompression you can alternatively use pwexplode
a pure-python impl, but it is licensed under GPL-3.0-or-later.
Benefits of CTypes-based impl:
- Supports python versions other than CPython
- No need to recompile python module after python version upgrade
Drawbacks:
- performance and overhead may be worse, than in the case of a cext.
In order to make it work you need a package with liblast
itself installed into your system using your distro package manager. If your distro doesn't provide one, you can build it yourself using CMake CPack from the sources by the link. You will get 3 packages, one with the headers, another one with the shared library, and yet another one with the CLI tool. Only the one with the lib is mandatory.
The package contains multiple functions. They have names matching the regular expression ^decompress(Stream|Bytes(Whole|Chunked))To(Stream|Bytes)$
.
The first subgroup describes the type of input argument, the second subgroup describes the type of output.
- If input is
Bytes
, then you needWhole
, which means that the lib gots a pointer to whole array with compressed data. This is considered to be the optimal input format.Chunked
(which means the data are processed in reality bydecompressStreamTo$3
) was created mainly for convenience of testing.
- Otherwise it is an object acting like a stream. In this case you can also provide
chunkSize
, because streams are processed in chunks. Larger the chunk - less the count of chunks in the stream, so less overhead on calls of callbacks, but more memory is needed to store the chunk.
The second subgroup describes the type of the result.
- The internal type of the result is always a
Stream
. This is considered to be the optimal output format. It is because we don't know the size of output ahead of time, so have to use streams. Bytes
are only for your convenience and just wrap thedecompress$1ToStream
with a context withBytesIO
.