1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchPypi,
6 python,
7 pythonOlder,
8
9 # build-system
10 setuptools,
11 setuptools-scm,
12 cython,
13 py-cpuinfo,
14
15 # dependencies
16 numpy,
17
18 # tests
19 msgpack,
20 pytestCheckHook,
21 importlib-metadata,
22}:
23
24buildPythonPackage rec {
25 pname = "numcodecs";
26 version = "0.13.1";
27 pyproject = true;
28
29 disabled = pythonOlder "3.8";
30
31 src = fetchPypi {
32 inherit pname version;
33 hash = "sha256-o883iB3wiY86nA1Ed9+IEz/oUYW//le6MbzC+iB3Cbw=";
34 };
35
36 build-system = [
37 setuptools
38 setuptools-scm
39 cython
40 py-cpuinfo
41 ];
42
43 dependencies = [ numpy ];
44
45 optional-dependencies = {
46 msgpack = [ msgpack ];
47 # zfpy = [ zfpy ];
48 };
49
50 preBuild = lib.optionalString (stdenv.hostPlatform.isx86 && !stdenv.hostPlatform.avx2Support) ''
51 export DISABLE_NUMCODECS_AVX2=1
52 '';
53
54 nativeCheckInputs = [
55 pytestCheckHook
56 msgpack
57 importlib-metadata
58 ];
59
60 # https://github.com/NixOS/nixpkgs/issues/255262
61 pytestFlagsArray = [ "$out/${python.sitePackages}/numcodecs" ];
62
63 meta = {
64 homepage = "https://github.com/zarr-developers/numcodecs";
65 license = lib.licenses.mit;
66 description = "Buffer compression and transformation codecs for use in data storage and communication applications";
67 maintainers = with lib.maintainers; [ doronbehar ];
68 };
69}