boost-histogram
The Boost::Histogram Python wrapper.
What it is and what it does
boost-histogram is a Python wrapper around Boost::Histogram, a high-performance C++ histogram library. It lets you create and manipulate histograms with flexible axis types (regular, variable-width, categorical, boolean), multiple storage backends (double, integer, weighted, mean), and advanced indexing following the UHI (Universal Histogram Indexing) protocol. The package is designed for scientific computing and data analysis workflows where speed and expressiveness matter.
You compose histograms by specifying axes and storage types, fill them with data (including weighted or sample data), and query results via NumPy array views or specialized accessors. It supports slicing, projection, rebinning, and arithmetic operations on histograms. The library integrates with the broader scikit-HEP ecosystem, including Hist (an analyst-friendly wrapper), mplhep (plotting), and dask-histogram (distributed computing).
Use it for:
- Build multidimensional histograms for physics or astronomy data analysis with fast filling and slicing.
- Accumulate weighted or mean-valued samples using specialized storage types for statistical analysis.
- Create histograms with custom axis transforms (log, sqrt, power) for non-linear binning schemes.
- Project and rebin histograms on the fly to explore data along different dimensions.
- Integrate histogram operations into Dask workflows for distributed data processing.
- Plot histograms via UHI-compatible libraries like mplhep without manual conversion.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
boost-histogram provides Python bindings to Boost::Histogram, a C++14 library for fast histogram creation and manipulation with support for multiple axis types, storage modes, and advanced indexing.
Yes. boost-histogram is actively maintained, permissively licensed, widely available as pre-built wheels, and has no known vulnerabilities. It is a solid choice if you need fast, flexible histogramming for scientific or data analysis work. Install friction is moderate due to C++ compilation, but wheels mitigate this for common platforms and Python versions.
Install
boost-histogram on PyPI
pip
pip install boost-histogramuv
uv add boost-histogrampoetry
poetry add boost-histogramInstalling boost-histogram
Before you install
Medium install friction due to compiled C++ extensions; pre-built wheels available for Python 3.10–3.15 across macOS (x86_64 and ARM64), Linux (x86_64 and aarch64), Windows, and musl-based systems. Active maintenance with a release 7 days ago.
License in practice
Dual-licensed under BSD-3-Clause and BSL-1.0 (permissive); both allow commercial and private use with minimal restrictions, making it safe for most projects.
Quickstart
import boost_histogram as bh
import numpy as np
hist = bh.Histogram(bh.axis.Regular(10, 0, 1))
hist.fill([0.1, 0.5, 0.9])
values = hist.values()
Requires Python ≥3.10; numpy is a runtime dependency.
Verify before relying
- Performance comparison claims ('one of the fastest libraries') lack quantitative benchmarks in the fact sheet.
- Thread-safety guarantees for AtomicInt64 storage and growing axes under concurrent load are not detailed.
Package facts
| License | BSD-3-Clause AND BSL-1.0 (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | 1 — numpy |
| Maintenance | actively maintained — 7 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 967,952/month — #4,616 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: boost_histogram-1.8.0-cp310-cp310-macosx_10_9_x86_64.whl; boost_histogram-1.8.0-cp310-cp310-macosx_11_0_arm64.whl; boost_histogram-1.8.0-cp310-cp310-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl; boost_histogram-1.8.0-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl; boost_histogram-1.8.0-cp310-cp310-musllinux_1_2_aarch64.whl; boost_histogram-1.8.0-cp310-cp310-musllinux_1_2_x86_64.whl; boost_histogram-1.8.0-cp310-cp310-win32.whl; boost_histogram-1.8.0-cp310-cp310-win_amd64.whl; boost_histogram-1.8.0-cp310-cp310-win_arm64.whl; boost_histogram-1.8.0-cp311-cp311-macosx_10_9_x86_64.whl; boost_histogram-1.8.0-cp311-cp311-macosx_11_0_arm64.whl; boost_histogram-1.8.0-cp311-cp311-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl; boost_histogram-1.8.0-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl; boost_histogram-1.8.0-cp311-cp311-musllinux_1_2_aarch64.whl; boost_histogram-1.8.0-cp311-cp311-musllinux_1_2_x86_64.whl; boost_histogram-1.8.0-cp311-cp311-win32.whl; boost_histogram-1.8.0-cp311-cp311-win_amd64.whl; boost_histogram-1.8.0-cp311-cp311-win_arm64.whl; boost_histogram-1.8.0-cp312-cp312-macosx_10_13_x86_64.whl; boost_histogram-1.8.0-cp312-cp312-macosx_11_0_arm64.whl
Keywords: boost-histogram, histogram
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
histHist provides a user-friendly interface for…
permissive · top 15,000 on PyPI
hdrhistogramRecords and analyzes high-precision latency and…
permissive · top 15,000 on PyPI
uhiUHI defines and documents a standard interface…
permissive · top 15,000 on PyPI
fastjetFastJet provides Python bindings to the FastJet…
permissive · top 15,000 on PyPI
histoprintHistoprint renders NumPy histograms and…
permissive · top 15,000 on PyPI
fast-array-utilsConverts and computes statistics across sparse,…
copyleft · top 15,000 on PyPI
spatial_imagespatial-image provides an N-dimensional spatial…
permissive · top 15,000 on PyPI
correctionlibProvides a JSON-based format and evaluator for…
permissive · top 15,000 on PyPI
opencv-contrib-pythonopencv-contrib-python provides Python bindings…
permissive · top 5,000 on PyPI