Install & Compatibility
Where this runs
tested against v1.1.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 89.9MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 3.6s · import 0.000s · 86MB
90MB installed
● package 90MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
annotations
✓ from uhi import annotations
✗ from uhi import Histogram
This quickstart demonstrates creating a histogram using the `hist` library, wrapping it with `uhi.hist.Histogram`, accessing its view, and then serializing and deserializing it using UHI's built-in functionality introduced in v1.0.0.
import numpy as np
import hist
from uhi.hist import Histogram
from uhi.serialization import serialize, deserialize
import tempfile
import os
# Create a sample histogram using the 'hist' library (uhi's recommended backend)
h = (
hist.new.Reg(10, 0, 10, name="x", label="X-axis")
.Reg(5, -5, 5, name="y", label="Y-axis")
.Double()
)
h.fill(x=np.random.rand(100) * 10, y=np.random.randn(100) * 5)
# Wrap it in UHI Histogram for a consistent interface
uhi_h = Histogram(h)
# Access data view
print(f"Sum of entries: {uhi_h.view().sum()}")
# Serialization example (major feature in v1.0.0)
with tempfile.TemporaryDirectory() as tmpdir:
filepath_hdf5 = os.path.join(tmpdir, "my_histogram.hdf5")
serialize(uhi_h, filepath_hdf5) # Automatically infers format from extension
print(f"Serialized histogram to {filepath_hdf5}")
deserialized_uhi_h = deserialize(filepath_hdf5)
print(f"Deserialized histogram. Sum: {deserialized_uhi_h.view().sum()}")
assert np.allclose(uhi_h.view(), deserialized_uhi_h.view())
print("UHI quickstart complete!")
Upgrade
Version history
1.1.1latest on PyPI · released Apr 26, 2026
Audit
Dependencies
histrequiredUHI works with and recommends the `hist` library as a primary backend for histogram objects.
numpyrequiredRequired for array operations and data manipulation within histogram backends.