Skip to main content

Pure-Python implementation of starfix Arrow logical hasher

Project description

starfix-python

Pure-Python implementation of the starfix Arrow logical hasher.

Produces stable SHA-256 hashes of Arrow tables, record batches, and arrays that are:

  • Column-order independent — reordering columns does not change the hash
  • Batch-split independent — splitting data across batches does not change the hash
  • Cross-language compatible — identical hashes to the Rust implementation

Installation

pip install starfix

Usage

import pyarrow as pa
from starfix import ArrowDigester

schema = pa.schema([
    pa.field("id", pa.int32(), nullable=False),
    pa.field("value", pa.float64(), nullable=True),
])

# Hash a full table
table = pa.table({"id": [1, 2, 3], "value": [1.1, 2.2, 3.3]}, schema=schema)
digest = ArrowDigester.hash_table(table)

# Streaming: feed record batches incrementally
digester = ArrowDigester(schema)
for batch in batches:
    digester.update(batch)
digest = digester.finalize()

Metadata hashing

By default, Arrow schema- and field-level metadata are excluded from the hash, preserving hash format 0.0.1 stability. Pass include_metadata=True to any entry point to include them:

# One-shot
digest = ArrowDigester.hash_table(table, include_metadata=True)

# Streaming
digester = ArrowDigester(schema, include_metadata=True)
for batch in batches:
    digester.update(batch)
digest = digester.finalize()

When include_metadata=True, adding or changing any metadata key or value on any field (including nested struct children and list element fields) produces a different hash. Metadata key ordering is deterministic — the hash is stable regardless of insertion order.

A schema with no metadata produces the same hash regardless of include_metadata (empty-metadata invariant).

License

MIT OR Apache-2.0

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

starfix-0.4.0.tar.gz (71.8 kB view details)

Uploaded Source

Built Distribution

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

starfix-0.4.0-py3-none-any.whl (10.8 kB view details)

Uploaded Python 3

File details

Details for the file starfix-0.4.0.tar.gz.

File metadata

  • Download URL: starfix-0.4.0.tar.gz
  • Upload date:
  • Size: 71.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.25 {"installer":{"name":"uv","version":"0.11.25","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for starfix-0.4.0.tar.gz
Algorithm Hash digest
SHA256 e63711756640d4618d34c58f9d80ed7de9722f50ff806ec0ceecdcf151f26e48
MD5 c32ceb8abcbb29aa18d1fdf174b66756
BLAKE2b-256 fcc1f3269cca708e13d47bf86c5459f9575e436e99d88cd29fec9e5cfd1d6003

See more details on using hashes here.

File details

Details for the file starfix-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: starfix-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 10.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.25 {"installer":{"name":"uv","version":"0.11.25","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for starfix-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3ec6c423eb131bfde1471a03219eea46389603753c30d90bdf3bfbe2bf8863c3
MD5 0baa3bffd5a424d62c33f2d1c58f1b72
BLAKE2b-256 1fa2b08c4c9e3e95e6e4224ad1fe857a2eaef1e473d9db6063d8151f5e8ac21f

See more details on using hashes here.

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