1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchFromGitHub,
6
7 # build-system
8 cmake,
9 cython,
10 ninja,
11 pkg-config,
12 scikit-build-core,
13
14 # native dependencies
15 c-blosc2,
16
17 # dependencies
18 msgpack,
19 ndindex,
20 numexpr,
21 numpy,
22 platformdirs,
23 py-cpuinfo,
24 requests,
25
26 # tests
27 psutil,
28 pytestCheckHook,
29 torch,
30 runTorchTests ? lib.meta.availableOn stdenv.hostPlatform torch,
31}:
32
33buildPythonPackage rec {
34 pname = "blosc2";
35 version = "3.7.1";
36 pyproject = true;
37
38 src = fetchFromGitHub {
39 owner = "Blosc";
40 repo = "python-blosc2";
41 tag = "v${version}";
42 hash = "sha256-mA7/8i77wtl9b6IT4Wp/uFDYp/IacnPnAsRoXe64+z4=";
43 };
44
45 nativeBuildInputs = [
46 cmake
47 ninja
48 pkg-config
49 ];
50
51 dontUseCmakeConfigure = true;
52 env.CMAKE_ARGS = lib.cmakeBool "USE_SYSTEM_BLOSC2" true;
53
54 build-system = [
55 cython
56 numpy
57 scikit-build-core
58 ];
59
60 buildInputs = [ c-blosc2 ];
61
62 dependencies = [
63 msgpack
64 ndindex
65 numexpr
66 numpy
67 platformdirs
68 py-cpuinfo
69 requests
70 ];
71
72 nativeCheckInputs = [
73 psutil
74 pytestCheckHook
75 ]
76 ++ lib.optionals runTorchTests [ torch ];
77
78 disabledTests = [
79 # attempts external network requests
80 "test_with_remote"
81 ];
82
83 passthru.c-blosc2 = c-blosc2;
84
85 meta = with lib; {
86 description = "Python wrapper for the extremely fast Blosc2 compression library";
87 homepage = "https://github.com/Blosc/python-blosc2";
88 changelog = "https://github.com/Blosc/python-blosc2/releases/tag/${src.tag}";
89 license = licenses.bsd3;
90 maintainers = with maintainers; [ ris ];
91 };
92}