1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5
6 # build-system
7 cmake,
8 cython,
9 ninja,
10 oldest-supported-numpy,
11 pkg-config,
12 scikit-build,
13 setuptools,
14 wheel,
15
16 # c library
17 c-blosc2,
18
19 # propagates
20 msgpack,
21 ndindex,
22 numexpr,
23 numpy,
24 py-cpuinfo,
25 rich,
26
27 # tests
28 psutil,
29 pytestCheckHook,
30 torch,
31}:
32
33buildPythonPackage rec {
34 pname = "blosc2";
35 version = "2.7.1";
36 pyproject = true;
37
38 src = fetchFromGitHub {
39 owner = "Blosc";
40 repo = "python-blosc2";
41 rev = "refs/tags/v${version}";
42 hash = "sha256-2aLfyd+/I8cy9OqdU4yNXY/bkf0AdXu+hZPLDdM3g5g=";
43 };
44
45 postPatch = ''
46 substituteInPlace pyproject.toml \
47 --replace-fail "numpy>=2.0.0" "numpy"
48 substituteInPlace requirements-runtime.txt \
49 --replace "pytest" ""
50 '';
51
52 pythonRelaxDeps = [ "numpy" ];
53
54 nativeBuildInputs = [
55 cmake
56 cython
57 ninja
58 oldest-supported-numpy
59 pkg-config
60 scikit-build
61 setuptools
62 wheel
63 ];
64
65 buildInputs = [ c-blosc2 ];
66
67 dontUseCmakeConfigure = true;
68 env.CMAKE_ARGS = "-DUSE_SYSTEM_BLOSC2:BOOL=YES";
69
70 propagatedBuildInputs = [
71 msgpack
72 ndindex
73 numexpr
74 numpy
75 py-cpuinfo
76 rich
77 ];
78
79 nativeCheckInputs = [
80 psutil
81 pytestCheckHook
82 torch
83 ];
84
85 passthru.c-blosc2 = c-blosc2;
86
87 meta = with lib; {
88 description = "Python wrapper for the extremely fast Blosc2 compression library";
89 homepage = "https://github.com/Blosc/python-blosc2";
90 changelog = "https://github.com/Blosc/python-blosc2/releases/tag/v${version}";
91 license = licenses.bsd3;
92 maintainers = with maintainers; [ ris ];
93 };
94}