1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchFromGitHub,
6
7 # nativeBuildInputs
8 cmake,
9
10 # build-system
11 pybind11,
12 nanobind,
13 ninja,
14 scikit-build-core,
15 setuptools-scm,
16
17 # buildInputs
18 boost,
19
20 # dependencies
21 numpy,
22
23 # tests
24 pytestCheckHook,
25 pytest-benchmark,
26 pytest-xdist,
27 cloudpickle,
28 hypothesis,
29}:
30
31buildPythonPackage rec {
32 pname = "boost-histogram";
33 version = "1.5.2";
34 pyproject = true;
35
36 src = fetchFromGitHub {
37 owner = "scikit-hep";
38 repo = "boost-histogram";
39 tag = "v${version}";
40 hash = "sha256-kduE5v1oQT76MRxMuGo+snCBdJ+yOjkOJFO45twcUIs=";
41 fetchSubmodules = true;
42 };
43
44 nativeBuildInputs = [ cmake ];
45
46 dontUseCmakeConfigure = true;
47
48 build-system = [
49 pybind11
50 nanobind
51 ninja
52 scikit-build-core
53 setuptools-scm
54 ];
55
56 buildInputs = [ boost ];
57
58 dependencies = [ numpy ];
59
60 nativeCheckInputs = [
61 pytestCheckHook
62 pytest-benchmark
63 pytest-xdist
64 cloudpickle
65 hypothesis
66 ];
67
68 pytestFlags = [ "--benchmark-disable" ];
69
70 disabledTests = lib.optionals (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64) [
71 # Segfaults: boost_histogram/_internal/hist.py", line 799 in sum
72 # Fatal Python error: Segmentation fault
73 "test_numpy_conversion_4"
74 ];
75
76 pythonImportsCheck = [ "boost_histogram" ];
77
78 meta = {
79 description = "Python bindings for the C++14 Boost::Histogram library";
80 homepage = "https://github.com/scikit-hep/boost-histogram";
81 changelog = "https://github.com/scikit-hep/boost-histogram/releases/tag/${src.tag}";
82 license = lib.licenses.bsd3;
83 maintainers = with lib.maintainers; [ veprbl ];
84 };
85}