Pure Python implementation of ALP (Adaptive Lossless floating-Point) compression — port of QTSurfer/alp-java.
Project description
alp-py
Pure Python implementation of the ALP (Adaptive Lossless floating-Point) compression algorithm.
Based on: Afroozeh & Boncz, "ALP: Adaptive Lossless floating-Point Compression", ACM SIGMOD 2024. (paper · pdf)
Python port of the QTSurfer/alp-java reference implementation. Bit-exact byte-level compatibility with alp-java — files written by either implementation can be read by the other.
Status
0.8.0 — first published release, bit-exact aligned with alp-java 0.2.1. Encode + decode round-trip verified against fixtures emitted by the Java reference.
Install
pip install alp-codec
Usage
import numpy as np
from alp import encode, decode
values = np.array([65007.28, 65007.31, 65007.30, 65007.32], dtype=np.float64)
# Encode to bytes
blob = encode(values)
# Decode back to a NumPy float64 array
recovered = decode(blob)
assert np.array_equal(values, recovered)
Why ALP
ALP applies semantic compression to decimal floating-point arrays. For a typical financial price column at 2 decimal places it reaches 3-4 bits per value — about an order of magnitude better than Gorilla XOR or block-compressed PLAIN encodings.
The algorithm picks an (e, f) pair per block such that value × 10^e × 2^-f is exactly representable as a small int64, encodes the integers via Frame-Of-Reference + bit-packing, and stores any non-conforming values as outliers with a position list.
Reference implementations
| Language | Repo | Status |
|---|---|---|
| Java | QTSurfer/alp-java | Reference |
| Python | QTSurfer/alp-py | This repo |
License
Copyright 2026 Wualabs LTD. Apache License 2.0 — see LICENSE.
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 Distribution
Built Distribution
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 alp_codec-0.8.1.tar.gz.
File metadata
- Download URL: alp_codec-0.8.1.tar.gz
- Upload date:
- Size: 12.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0a4044fd235b337ef8c510e71e3ebc3b951fc17eb240d04668f1897851d4f550
|
|
| MD5 |
18bed14e50246c024a42ca0053c3ca52
|
|
| BLAKE2b-256 |
54cc410f40cb7d0bf6165b4018da9a65f5123a8d7f4e89862ad23eaf9b8fb276
|
Provenance
The following attestation bundles were made for alp_codec-0.8.1.tar.gz:
Publisher:
release.yml on QTSurfer/alp-py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
alp_codec-0.8.1.tar.gz -
Subject digest:
0a4044fd235b337ef8c510e71e3ebc3b951fc17eb240d04668f1897851d4f550 - Sigstore transparency entry: 1391858323
- Sigstore integration time:
-
Permalink:
QTSurfer/alp-py@a01422e5ab761aff51fc8d1a81979b6ce25be82c -
Branch / Tag:
refs/tags/0.8.1 - Owner: https://github.com/QTSurfer
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@a01422e5ab761aff51fc8d1a81979b6ce25be82c -
Trigger Event:
push
-
Statement type:
File details
Details for the file alp_codec-0.8.1-py3-none-any.whl.
File metadata
- Download URL: alp_codec-0.8.1-py3-none-any.whl
- Upload date:
- Size: 11.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e707a6cca0d16b626f9243b36c90e8f847189020f65ab0b460317b2c13bff675
|
|
| MD5 |
d1242a182281cdc197b99987b770a63a
|
|
| BLAKE2b-256 |
54db503d000cb836cbe25cf3f3a715fe5ee8374359e3d43f7bd10ddc27f131e4
|
Provenance
The following attestation bundles were made for alp_codec-0.8.1-py3-none-any.whl:
Publisher:
release.yml on QTSurfer/alp-py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
alp_codec-0.8.1-py3-none-any.whl -
Subject digest:
e707a6cca0d16b626f9243b36c90e8f847189020f65ab0b460317b2c13bff675 - Sigstore transparency entry: 1391858326
- Sigstore integration time:
-
Permalink:
QTSurfer/alp-py@a01422e5ab761aff51fc8d1a81979b6ce25be82c -
Branch / Tag:
refs/tags/0.8.1 - Owner: https://github.com/QTSurfer
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@a01422e5ab761aff51fc8d1a81979b6ce25be82c -
Trigger Event:
push
-
Statement type: