1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 fetchpatch2,
6 apricot-select,
7 numba,
8 numpy,
9 pytestCheckHook,
10 pythonOlder,
11 scikit-learn,
12 scipy,
13 setuptools,
14 torchvision,
15 tqdm,
16}:
17
18buildPythonPackage rec {
19 pname = "apricot-select";
20 version = "0.6.1";
21 pyproject = true;
22
23 disabled = pythonOlder "3.7";
24
25 src = fetchFromGitHub {
26 owner = "jmschrei";
27 repo = "apricot";
28 tag = version;
29 hash = "sha256-v9BHFxmlbwXVipPze/nV35YijdFBuka3gAl85AlsffQ=";
30 };
31
32 patches = [
33 # migrate to pytest, https://github.com/jmschrei/apricot/pull/43
34 (fetchpatch2 {
35 url = "https://github.com/jmschrei/apricot/commit/ffa5cce97292775c0d6890671a19cacd2294383f.patch?full_index=1";
36 hash = "sha256-9A49m4587kAPK/kzZBqMRPwuA40S3HinLXaslYUcWdM=";
37 })
38 ];
39
40 build-system = [ setuptools ];
41
42 dependencies = [
43 numba
44 numpy
45 scikit-learn
46 scipy
47 torchvision
48 tqdm
49 ];
50
51 nativeCheckInputs = [ pytestCheckHook ];
52
53 pythonImportsCheck = [ "apricot" ];
54
55 disabledTestPaths = [
56 # Tests require nose
57 "tests/test_optimizers/test_knapsack_facility_location.py"
58 "tests/test_optimizers/test_knapsack_feature_based.py"
59 ];
60
61 # NOTE: These tests seem to be flaky.
62 disabledTests = [
63 "test_digits_modular"
64 "test_digits_modular_object"
65 "test_digits_modular_sparse"
66 "test_digits_sqrt_modular"
67 "test_digits_sqrt_modular_object"
68 "test_digits_sqrt_modular_sparse"
69 ];
70
71 # NOTE: Tests are disabled by default because they can run for hours and timeout on Hydra.
72 doCheck = false;
73
74 passthru.tests.check = apricot-select.overridePythonAttrs { doCheck = true; };
75
76 meta = with lib; {
77 description = "Module for submodular optimization for the purpose of selecting subsets of massive data sets";
78 homepage = "https://github.com/jmschrei/apricot";
79 changelog = "https://github.com/jmschrei/apricot/releases/tag/${version}";
80 license = licenses.mit;
81 maintainers = with maintainers; [ fab ];
82 };
83}