Skip to main content

alp-py

CI PyPI License

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

Bit-exact aligned with alp-java — encode + decode round-trip verified against fixtures emitted by the Java reference. See the PyPI badge above for the latest version.

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.

Metadata

Release files for alp-codec 0.8.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for alp-codec 0.8.3
File Size Uploaded
alp_codec-0.8.3.tar.gz 13.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for alp-codec 0.8.3
File Interpreter ABI Platform
alp_codec-0.8.3-py3-none-any.whl Python 3 none any Details

Total release size: 25.8 kB

Release files / alp_codec-0.8.3.tar.gz

Download URL alp_codec-0.8.3.tar.gz
Size 13.7 kB
Tags Source
SHA-256 checksum
How to use checksums
d34e2bdffa54c2f4aa3d3e4d1d853c449e332efa11e0bb66a42bf1ee1d9be4f3
BLAKE2b-256 checksum
How to use checksums
996e0142483a6d6e929720583718cbeae07126fe087ef23fca2d5a377619e6e2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Jul 13, 2026.

Transparency log

Release files / alp_codec-0.8.3-py3-none-any.whl

Download URL alp_codec-0.8.3-py3-none-any.whl
Size 12.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
36e4db6f83b4b2c7f619dba697196e123118f74e559de340ce3e6dddb490110d
BLAKE2b-256 checksum
How to use checksums
90c513508f2702c5ba6f0948bfcb4302cc3340aa6c7babebdfca306cd12173e8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Jul 13, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.8.3 This release

2 release files

0.8.2

2 release files

0.8.1

2 release files

0.8.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page