aplib
A pure Python module for decompressing aPLib compressed data
Adapted from the original C source code from http://ibsensoftware.com/files/aPLib-1.1.1.zip
Approximately 20 times faster than other Python implementations.
Compatible with both Python 2 and 3.
Usage
import aplib
data = aplib.decompress(packed) # raw aPLib stream or AP32 headered data
data = aplib.decompress(packed, max_size=1 << 20) # lower the limit for the unpacked size
data = aplib.decompress(packed, headered=False) # never parse an AP32 header
data = aplib.decompress(packed, strict=False) # keep the data decoded before the first stream error
Decompression errors raise aplib.APLibError, a subclass of RuntimeError.
Untrusted input
The defaults are meant to be safe for untrusted input, such as data extracted from malware:
max_sizelimits the unpacked data toaplib.DEFAULT_MAX_SIZE(64 MiB) by default. Exceeding it raisesAPLibError, even withstrict=False. Unpacking up to 64 MiB in pure Python can still take several seconds of CPU time, so pass a smallermax_sizewhen processing many untrusted inputs.max_size=Nonedisables the limit; only use it for trusted input.- If an AP32 header is parsed, the original size in the header limits the unpacked data too, even with
strict=False(exceeding it raisesAPLibError). To salvage a stream whose header has a wrong original size, slice past the header and passheadered=False, strict=False. strict=True(the default) rejects malformed data, and checks the sizes and CRC32 checksums in the AP32 header. CRC32 detects accidental corruption, not deliberate tampering.headered=None(the default) treats input of at least 24 bytes starting withAP32as having an AP32 header; an invalid header size raisesAPLibError, even withstrict=False. Passheadered=Trueto require a complete AP32 header (raisingAPLibErrorif it is missing or truncated), orheadered=Falseto ignore any header.
Changes in 0.8
decompress()is strict by default (strict=True).decompress()andAPLiblimit the unpacked data toDEFAULT_MAX_SIZEby default, and exceedingmax_sizeraisesAPLibErrorin non-strict mode too, instead of truncating the output.- An AP32 header with an invalid header size (or a missing or truncated header when
headered=True) raisesAPLibErrorin non-strict mode too, instead of being decompressed as data, and the original size in the header limits the unpacked data in both modes. - New
headeredargument fordecompress(). - Input that isn't a bytes-like object, such as an integer, raises
TypeError. MemoryErrorandOverflowErrorin the decompression loop raiseAPLibError, even in non-strict mode (converting the final output buffer tobytescan still raiseMemoryError).
Metadata
Release files for aplib 0.8
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 |
|---|---|---|---|---|
| aplib-0.8.tar.gz | 46.7 kB | With provenance | Details for aplib-0.8.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| aplib-0.8-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details for aplib-0.8-py2.py3-none-any.whl |
Total release size: 76.5 kB
Release files / aplib-0.8.tar.gz
| Download URL | aplib-0.8.tar.gz |
|---|---|
| Size | 46.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f01c4297152849d18d985a0b85da8a5e36e882e22e7fa86a26a7b95f61f5b8ce
|
|
BLAKE2b-256 checksum How to use checksums |
658248764f34b0641c4d8ce03b71d8403a4c5b94a5925fe4204e7ae0d7133de6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 10, 2026.
Transparency logRelease files / aplib-0.8-py2.py3-none-any.whl
| Download URL | aplib-0.8-py2.py3-none-any.whl |
|---|---|
| Size | 29.8 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
a015bb3ed6bf95d9d20a7b93f4f55bbdfdeb8cf8ab5fdee05152f114aa49dfd4
|
|
BLAKE2b-256 checksum How to use checksums |
74dc0e2a69ab1a5d955d989665e439c7bce1cb9821567a400fbfc16a9d73f080
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 10, 2026.
Transparency logSecurity for aplib 0.8
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for aplib-0.8.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 10, 2026.
Transparency logA 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.