1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 python,
6
7 # build-system
8 cython,
9 setuptools,
10
11 # optional
12 numpy,
13
14 # tests
15 hypothesis,
16 pytest-cov-stub,
17 pytestCheckHook,
18 sympy,
19}:
20
21buildPythonPackage rec {
22 pname = "ndindex";
23 version = "1.10.0";
24 pyproject = true;
25
26 src = fetchFromGitHub {
27 owner = "Quansight-Labs";
28 repo = "ndindex";
29 tag = version;
30 hash = "sha256-gPhRln7cUoRmypuTDTwoz4LyCBX3EwuKes/SEoz9NYM=";
31 };
32
33 build-system = [
34 cython
35 setuptools
36 ];
37
38 postPatch = ''
39 substituteInPlace pytest.ini \
40 --replace-fail "--flakes" ""
41 '';
42
43 optional-dependencies.arrays = [ numpy ];
44
45 pythonImportsCheck = [ "ndindex" ];
46
47 # fix Hypothesis timeouts
48 preCheck = ''
49 cd $out
50
51 echo > ${python.sitePackages}/ndindex/tests/conftest.py <<EOF
52
53 import hypothesis
54
55 hypothesis.settings.register_profile(
56 "ci",
57 deadline=None,
58 print_blob=True,
59 derandomize=True,
60 )
61 EOF
62 '';
63
64 nativeCheckInputs = [
65 hypothesis
66 pytest-cov-stub
67 pytestCheckHook
68 sympy
69 ]
70 ++ optional-dependencies.arrays;
71
72 pytestFlags = [
73 "--hypothesis-profile=ci"
74 ];
75
76 meta = with lib; {
77 description = "Python library for manipulating indices of ndarrays";
78 homepage = "https://github.com/Quansight-Labs/ndindex";
79 changelog = "https://github.com/Quansight-Labs/ndindex/releases/tag/${src.tag}";
80 license = licenses.mit;
81 maintainers = [ ];
82 };
83}