Registry / data / uhi
library1.1.1pypypi✓ verified 24d ago

UHI provides a Unified Histogram Interface, a set of protocols and utilities to help library authors work with histograms consistently across different backends. It aims to standardize histogram operations, access, and serialization. The current version is 1.0.0, and it follows an active release cadence with regular updates.

pip install uhi
INSTALL
IMPORT
SIG · UHI
U
uhi
datapythonv1.1.1
Install
3.6s avg
Import
Disk
90MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
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
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 89.9MB
glibc
py 3.103.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!")
Debug
Known issues
breakingUHI has dropped support for older Python versions across releases. v0.4.0 dropped Python 3.6, v0.5.0 requires Python 3.8+, and v1.0.0 requires Python 3.9+.
fix
Ensure your environment is running Python 3.9 or newer. Upgrade Python if necessary.
affects: <1.0.0
gotchaThe serialization schema was experimental in v0.5.0 and finalized in v1.0.0. Histograms serialized with v0.5.0's experimental API may not be compatible with v1.0.0+.
fix
For production systems, ensure serialization and deserialization happen with v1.0.0 or later for stable compatibility. Re-serialize data if migrating from v0.5.0.
affects: 0.5.0
gotchaUHI (Unified Histogram Interface) provides protocols (like `uhi.typing.uhi.UHI`) and a concrete implementation (`uhi.hist.Histogram`). Users should instantiate `uhi.hist.Histogram` or wrap existing `hist` objects, not directly instantiate the `UHI` protocol.
fix
Always use `from uhi.hist import Histogram` to create UHI-compliant histogram objects, or wrap an existing `hist` object: `uhi_histogram = Histogram(my_hist_object)`.
affects: All
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.
Agent activity
30 hits · last 30 days
node
26
OpenAI (training)
1
Resources
uhi — pip install uhi · libregistry