Histogramming as a Service (HistServ)
Install from PyPI
pip install histserv
Install from conda-forge
conda install -c conda-forge histserv
Quickstart
Start the async gRPC server (or just ./example/start_server.sh):
histserv --port 50051
# 2026-03-26 11:58:00.643 INFO:histserv:server (listening at [::]:50051) started with port=50051, prune_after=24.00 h, prune_interval=5.00 min, stats_interval=5.00 s
Then run:
from hist import Hist
from histserv import Client
import numpy as np
# initialize hist locally
H_local = Hist.new.Reg(30, -3, 3, name="x", label="x-axis").Double()
with Client(address="[::]:50051") as client:
# initialize it on the server and receive a remote hist to interact with it
H_remote = client.init(H_local)
# fill the remote hist; the client pre-bins locally and sends dense storage
H_remote.fill(x=np.random.normal(size=1000))
# retrieve it back as a ChunkedHist, drop it from the server, and materialize it locally
H_snapshot = H_remote.snapshot(delete_from_server=True)
print(H_snapshot.to_hist())
# local hist hasn't been filled
assert np.all(H_local.view(True) == 0)
Output in ipython:
┌────────────────────────────────────────────────────────────────────────────┐
[-inf, -3) 1 │▋ │
[ -3, -2.8) 0 │ │
[-2.8, -2.6) 1 │▋ │
[-2.6, -2.4) 1 │▋ │
[-2.4, -2.2) 6 │████ │
[-2.2, -2) 11 │███████▍ │
[ -2, -1.8) 12 │████████ │
[-1.8, -1.6) 20 │█████████████▍ │
[-1.6, -1.4) 19 │████████████▊ │
[-1.4, -1.2) 33 │██████████████████████▏ │
[-1.2, -1) 50 │█████████████████████████████████▌ │
[ -1, -0.8) 70 │██████████████████████████████████████████████▉ │
[-0.8, -0.6) 49 │████████████████████████████████▉ │
[-0.6, -0.4) 88 │███████████████████████████████████████████████████████████ │
[-0.4, -0.2) 63 │██████████████████████████████████████████▎ │
[-0.2, 0) 65 │███████████████████████████████████████████▋ │
[ 0, 0.2) 85 │█████████████████████████████████████████████████████████ │
[ 0.2, 0.4) 77 │███████████████████████████████████████████████████▋ │
[ 0.4, 0.6) 65 │███████████████████████████████████████████▋ │
[ 0.6, 0.8) 61 │████████████████████████████████████████▉ │
[ 0.8, 1) 63 │██████████████████████████████████████████▎ │
[ 1, 1.2) 45 │██████████████████████████████▏ │
[ 1.2, 1.4) 36 │████████████████████████▏ │
[ 1.4, 1.6) 32 │█████████████████████▌ │
[ 1.6, 1.8) 15 │██████████ │
[ 1.8, 2) 11 │███████▍ │
[ 2, 2.2) 10 │██████▊ │
[ 2.2, 2.4) 3 │██ │
[ 2.4, 2.6) 5 │███▍ │
[ 2.6, 2.8) 2 │█▍ │
[ 2.8, 3) 1 │▋ │
[ 3, inf) 0 │ │
└────────────────────────────────────────────────────────────────────────────┘
Dashboard
See more information about setting up the histserv dashboard in the corresponding dashboard README.
Examples
See example/ for more examples.
Run example client:
python example/client.py
# Remote hist initialized: RemoteHist(hist_id='52c77c93da8146f2a72c53af269d1ab5', address='[::]:50051', token=None)
# Remote hist fill succeeded.
# Snapshotting current hist: ChunkedHist(...)
# Remote hist fill succeeded.
# Remote hist fill succeeded.
# Remote hist flushed successfully to hist.h5.
Or check out how to use remote histogram filling with an example coffea Processor in example/coffea_processor.py.
Useful client methods on RemoteHist:
fill(...)fill_many([...])snapshot(delete_from_server=False)reset()exists()get_connection_info()RemoteHist.from_connection_info(...)flush(destination="hist.h5")delete()
Current supported types
Axis support:
hist.axis.Regularwithout transformshist.axis.Booleanhist.axis.Variablehist.axis.Integerhist.axis.IntCategoryhist.axis.StrCategory
Storage support:
hist.storage.Doublehist.storage.Int64boost_histogram.storage.AtomicInt64hist.storage.Weightboost_histogram.storage.Unlimited
Unsupported today:
- transformed
hist.axis.Regular boost_histogram.storage.Meanboost_histogram.storage.WeightedMean- overflow bins on
IntCategory/StrCategorychunk axes are not preserved acrossfrom_hist()/to_hist()(categorical overflow is silently dropped)
Notes:
- Growable categorical axes (
IntCategory,StrCategory) are treated as chunk keys rather than dense axes. - Histograms with one or more growable categorical axes are supported; the categorical values must be provided as scalars when filling.
- On the wire, fills are sent as dense per-chunk payloads rather than as generic Python objects.
RemoteHist.snapshot()returns aChunkedHist; call.to_hist()to materialize a localhist.Hist.fill_many(...)is useful for bundling several fills into one gRPC request.- Dense ndarray transport is generic over NumPy dtypes, but object arrays are not supported on the wire.
Developer Info
Install
uv sync --dev
Test
python -m pytest -q
uvx ty check src
Protobuf Codegen
python -m grpc_tools.protoc -Isrc/histserv/protos --python_out=src/histserv/protos --pyi_out=src/histserv/protos --grpc_python_out=src/histserv/protos src/histserv/protos/hist.proto
After regeneration, ensure src/histserv/protos/hist_pb2_grpc.py keeps the
package-relative import:
from . import hist_pb2 as hist__pb2
Metadata
Release files for histserv 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| histserv-0.2.1.tar.gz | 222.1 kB | With provenance | Details for histserv-0.2.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| histserv-0.2.1-py3-none-any.whl | Python 3 | none | any | Details for histserv-0.2.1-py3-none-any.whl |
Total release size: 323.4 kB
Release files / histserv-0.2.1.tar.gz
| Download URL | histserv-0.2.1.tar.gz |
|---|---|
| Size | 222.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a00c59a36ab68cf2f32d299b56d0df0ca8a8d1cbeb6cd859464d98f8ecb48651
|
|
BLAKE2b-256 checksum How to use checksums |
195a986f21084226be9be3e4b83ca1c1f7e802b7e8e52c55ba3681b27e87a54b
|
| 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 Jul 31, 2026.
Transparency logRelease files / histserv-0.2.1-py3-none-any.whl
| Download URL | histserv-0.2.1-py3-none-any.whl |
|---|---|
| Size | 101.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f971c8c3f84db8809a91231fc5ff4dddd605613102cdf94fb5cf97fb8b4205d5
|
|
BLAKE2b-256 checksum How to use checksums |
001df681722f2a358b74ab29ddaca04eca925db3af049696bb49b1600146f894
|
| 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 Jul 31, 2026.
Transparency logSecurity for histserv 0.2.1
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.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for histserv-0.2.1.tar.gz
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 Jul 31, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.