Skip to main content

Pure Python implementation of ALP (Adaptive Lossless floating-Point) compression — port of QTSurfer/alp-java.

Project description

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

🚧 Pre-release — repository scaffold while we port the codec from Java. The first published release will be 0.8.0 to align with alp-java.

Install

pip install alp-codec

Usage (planned API)

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

alp_codec-0.8.0.tar.gz (12.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

alp_codec-0.8.0-py3-none-any.whl (11.6 kB view details)

Uploaded Python 3

File details

Details for the file alp_codec-0.8.0.tar.gz.

File metadata

  • Download URL: alp_codec-0.8.0.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

Hashes for alp_codec-0.8.0.tar.gz
Algorithm Hash digest
SHA256 602b2b4a4ed34592f091a9ae5aa44bb89984389a310d7426763229d276b2998e
MD5 31ffd0b095ea827a0a79eb82dce7a623
BLAKE2b-256 b05c0a145f30d6391ce725dcc5eb88cb7d53e114d293e2d370de351a66a23bc8

See more details on using hashes here.

Provenance

The following attestation bundles were made for alp_codec-0.8.0.tar.gz:

Publisher: release.yml on QTSurfer/alp-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file alp_codec-0.8.0-py3-none-any.whl.

File metadata

  • Download URL: alp_codec-0.8.0-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

Hashes for alp_codec-0.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3181b42ac06919ac2f214c993baea506a53ecc00ec7993d89df9a808a930c6eb
MD5 d972a55591d54cdaf0d0fcff0da292ab
BLAKE2b-256 3e4cd251e11f23db0d23ed3bb52f0a4e6299d3192284b97eef7df0978e8e2fb1

See more details on using hashes here.

Provenance

The following attestation bundles were made for alp_codec-0.8.0-py3-none-any.whl:

Publisher: release.yml on QTSurfer/alp-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page