Hilbert Bytes
Hilbert Bytes is a python library for converting to and from points in d-dimensions and their corresponding index on a hilbert curve. It's similar to hilbertcurve and numpy-hilbert-curve but is faster and more space efficient than either by keeping manipulations at the byte level, and using numba to compile the results. It also uses arbitrary precision integers, allowing you to make the grid arbitrarily fine
Installation
pip install hilbert-bytes
Usage
import hilbert_bytes
import numpy as np
points = ... # arbitrary d-dimensional points
num, dim = points.shape
# convert to big-endian bytes
points_bytes = points[..., None].astype(">u8").view("u1")
index_bytes = hilbert_bytes.encode(points_bytes) # indices as big-endian ints
new_points_bytes = hilbert_bytes.decode(index_bytes, dim)
If you want the indices as multi-byte ints, you can do a similar trick in reverse:
index_bytes = ... # an array of big-endian ints
indices = index_bytes.view(">u8").astype("u8")[..., -1]
But note that this will only work if your index fits in 8 bytes
Publishing
Releases are cut with the cut workflow, run manually from the Actions tab with
a patch, minor, or major version bump. It bumps the version and tags it,
then starts the release workflow, which uploads to PyPI via
trusted publishing and creates a
GitHub release, and the docs workflow, which builds and deploys the docs.
Metadata
Release files for hilbert-bytes 0.8.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| hilbert_bytes-0.8.0.tar.gz | 105.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| hilbert_bytes-0.8.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 111.3 kB
Release files / hilbert_bytes-0.8.0.tar.gz
| Download URL | hilbert_bytes-0.8.0.tar.gz |
|---|---|
| Size | 105.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
942e25cdefb136eb350a25ffba1cda691945b83e30717335505959cf5f96573c
|
|
BLAKE2b-256 checksum How to use checksums |
e2366c1e043a2801a9ebc8863f922767d3d64189f03ac4e58e4665ce42344bed
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Oct 7, 2026.
Transparency logRelease files / hilbert_bytes-0.8.0-py3-none-any.whl
| Download URL | hilbert_bytes-0.8.0-py3-none-any.whl |
|---|---|
| Size | 5.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1047ae0f4ef00d80533aa19bc25116ac8abc08b27441c7bc94b669c284a9c593
|
|
BLAKE2b-256 checksum How to use checksums |
819206cdf7c1c1dc21ec86fbb482c4087fe99488cdec41e24ccdc32e67f69ecc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Oct 7, 2026.
Transparency log