1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchpatch,
6 fetchPypi,
7 setuptools,
8 setuptools-scm,
9 cython,
10 numpy,
11 msgpack,
12 py-cpuinfo,
13 pytestCheckHook,
14 python,
15 pythonOlder,
16}:
17
18buildPythonPackage rec {
19 pname = "numcodecs";
20 version = "0.12.1";
21 pyproject = true;
22
23 disabled = pythonOlder "3.8";
24
25 src = fetchPypi {
26 inherit pname version;
27 hash = "sha256-BdkaQzcz5+7yaNfoDsImoCMtokQolhSo84JpAa7BCY4=";
28 };
29
30 patches = [
31 # https://github.com/zarr-developers/numcodecs/pull/487
32 (fetchpatch {
33 name = "fix-tests.patch";
34 url = "https://github.com/zarr-developers/numcodecs/commit/4896680087d3ff1f959401c51cf5aea0fd56554e.patch";
35 hash = "sha256-+lMWK5IsNzJ7H2SmLckgxbSSRIIcC7FtGYSBKQtuo+Y=";
36 })
37 ];
38
39 nativeBuildInputs = [
40 setuptools
41 setuptools-scm
42 cython
43 py-cpuinfo
44 ];
45
46 propagatedBuildInputs = [ numpy ];
47
48 passthru.optional-dependencies = {
49 msgpack = [ msgpack ];
50 # zfpy = [ zfpy ];
51 };
52
53 preBuild =
54 if (stdenv.hostPlatform.isx86 && !stdenv.hostPlatform.avx2Support) then
55 ''
56 export DISABLE_NUMCODECS_AVX2=
57 ''
58 else
59 null;
60
61 nativeCheckInputs = [
62 pytestCheckHook
63 msgpack
64 ];
65
66 pytestFlagsArray = [ "$out/${python.sitePackages}/numcodecs" ];
67
68 disabledTests = [
69 "test_backwards_compatibility"
70
71 "test_encode_decode"
72 "test_legacy_codec_broken"
73 "test_bytes"
74
75 # ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (3,) + inhomogeneous part.
76 # with numpy 1.24
77 "test_non_numpy_inputs"
78 ];
79
80 meta = with lib; {
81 homepage = "https://github.com/zarr-developers/numcodecs";
82 license = licenses.mit;
83 description = "Buffer compression and transformation codecs for use in data storage and communication applications";
84 maintainers = [ ];
85 };
86}