1{ lib
2, buildPythonPackage
3, dos2unix
4, fetchpatch
5, fetchPypi
6, pytestCheckHook
7, pythonOlder
8, pandas
9, torch
10, scipy
11}:
12
13buildPythonPackage rec {
14 pname = "slicer";
15 version = "0.0.7";
16 format = "setuptools";
17 disabled = pythonOlder "3.6";
18
19 src = fetchPypi {
20 inherit pname version;
21 hash = "sha256-9dX3tF+Y0VW5wLplVPqXcMaybVeTo+d6EDD7VpEOvuw=";
22 };
23
24 prePatch = ''
25 dos2unix slicer/*
26 '';
27
28 patches = [
29 # these patches add support for numpy>=1.24
30 (fetchpatch {
31 url = "https://github.com/interpretml/slicer/commit/028e09e639c4a3c99abe1d537cce30af2eebb081.patch";
32 hash = "sha256-jh/cbz7cx2ks6jMNh1gI1n5RS/OHBtSIDZRxUGyrl/I=";
33 })
34 (fetchpatch {
35 url = "https://github.com/interpretml/slicer/commit/d4bb09f136d7e1f64711633c16a37e7bee738696.patch";
36 hash = "sha256-9rh99s4JWF4iKClZ19jvqSeRulL32xB5Use8PGkh/SA=";
37 })
38 (fetchpatch {
39 url = "https://github.com/interpretml/slicer/commit/74b3683a5a7bd982f9eaaf8d8d665dfdaf2c6604.patch";
40 hash = "sha256-R3zsC3udYPFUT93eRhb6wyc9S5n2wceiOunWJ8K+648=";
41 })
42 ];
43
44 nativeBuildInputs = [
45 dos2unix
46 ];
47
48 nativeCheckInputs = [ pytestCheckHook pandas torch scipy ];
49
50 disabledTests = [
51 # IndexError: too many indices for array
52 "test_slicer_sparse"
53 "test_operations_2d"
54 ];
55
56 meta = with lib; {
57 description = "Wraps tensor-like objects and provides a uniform slicing interface via __getitem__";
58 homepage = "https://github.com/interpretml/slicer";
59 license = licenses.mit;
60 maintainers = with maintainers; [ evax ];
61 platforms = platforms.unix;
62 };
63}