skillfed

boost-histogram

The Boost::Histogram Python wrapper.

boost-histogram v1.8.0 968.0K downloads/30d#4,616 on PyPI163
Permissive license BSD-3-Clause AND BSL-1.0 Active released

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-histogram

uv

uv add boost-histogram

poetry

poetry add boost-histogram

Installing 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

Development Status :: 5 - Production/StableIntended Audience :: DevelopersIntended Audience :: Information TechnologyIntended Audience :: Science/ResearchOperating System :: MacOSOperating System :: Microsoft :: WindowsOperating System :: POSIXOperating System :: UnixProgramming Language :: C++Programming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.15Programming Language :: Python :: Free ThreadingProgramming Language :: Python :: Free Threading :: 3 - StableProgramming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Scientific/EngineeringTopic :: Scientific/Engineering :: Information AnalysisTopic :: Scientific/Engineering :: MathematicsTopic :: Scientific/Engineering :: PhysicsTopic :: Software DevelopmentTopic :: UtilitiesTyping :: Typed

Tags

fast histogram library pythonboost histogram bindingsmultidimensional histogramshistogram with named axesscientific data binninghistogram storage typesweighted histogram accumulation
histogram-binningscientific-computingdata-analysis

More Software Development packages