summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/blosc2/default.nix
blob: b0c754f05411ccfdf7e2019c82f14c93beed5b33 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
{
  lib,
  stdenv,
  buildPythonPackage,
  fetchFromGitHub,
  pythonAtLeast,

  # build-system
  cmake,
  cython,
  ninja,
  pkg-config,
  scikit-build-core,

  # native dependencies
  c-blosc2,

  # dependencies
  msgpack,
  ndindex,
  numexpr,
  numpy,
  platformdirs,
  py-cpuinfo,
  requests,

  # tests
  psutil,
  pytestCheckHook,
  torch,
  runTorchTests ? lib.meta.availableOn stdenv.hostPlatform torch,
}:

buildPythonPackage rec {
  pname = "blosc2";
  version = "3.12.2";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "Blosc";
    repo = "python-blosc2";
    tag = "v${version}";
    hash = "sha256-t2tf8s2WwG4vEQbh8HACMtUjVrwmGby1yKd+IlL39PY=";
  };

  nativeBuildInputs = [
    cmake
    ninja
    pkg-config
  ];

  dontUseCmakeConfigure = true;
  env.CMAKE_ARGS = lib.cmakeBool "USE_SYSTEM_BLOSC2" true;

  build-system = [
    cython
    numpy
    scikit-build-core
  ];

  buildInputs = [ c-blosc2 ];

  dependencies = [
    msgpack
    ndindex
    numexpr
    numpy
    platformdirs
    py-cpuinfo
    requests
  ];

  nativeCheckInputs = [
    psutil
    pytestCheckHook
  ]
  ++ lib.optionals runTorchTests [ torch ];

  disabledTestMarks = [
    "network"
  ];

  disabledTests = [
    # attempts external network requests
    "test_with_remote"
  ]
  ++ lib.optionals (pythonAtLeast "3.14") [
    # https://github.com/Blosc/python-blosc2/issues/551
    "test_expand_dims"
  ];

  disabledTestPaths = [
    # Threads grow without limit
    # https://github.com/Blosc/python-blosc2/issues/556
    "tests/ndarray/test_lazyexpr.py"
    "tests/ndarray/test_lazyexpr_fields.py"
    "tests/ndarray/test_reductions.py"
  ];

  passthru.c-blosc2 = c-blosc2;

  meta = {
    description = "Python wrapper for the extremely fast Blosc2 compression library";
    homepage = "https://github.com/Blosc/python-blosc2";
    changelog = "https://github.com/Blosc/python-blosc2/releases/tag/${src.tag}";
    license = lib.licenses.bsd3;
    maintainers = with lib.maintainers; [ ris ];
  };
}