about summary refs log tree commit diff
path: root/pkgs/development/python-modules/apricot-select/default.nix
blob: 254c14527c5ae09d12dc8ea690a36093893a9375 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  apricot-select,
  numba,
  numpy,
  nose,
  pytestCheckHook,
  pythonOlder,
  scikit-learn,
  scipy,
  setuptools,
  torchvision,
  tqdm,
}:

buildPythonPackage rec {
  pname = "apricot-select";
  version = "0.6.1";
  pyproject = true;

  disabled = pythonOlder "3.7";

  src = fetchFromGitHub {
    owner = "jmschrei";
    repo = "apricot";
    rev = "refs/tags/${version}";
    hash = "sha256-v9BHFxmlbwXVipPze/nV35YijdFBuka3gAl85AlsffQ=";
  };

  postPatch = ''
    sed -i '/"nose"/d' setup.py
  '';

  build-system = [ setuptools ];

  dependencies = [
    numba
    numpy
    scikit-learn
    scipy
    torchvision
    tqdm
  ];

  nativeCheckInputs = [
    nose
    pytestCheckHook
  ];

  pythonImportsCheck = [ "apricot" ];

  disabledTestPaths = [
    # Tests require nose
    "tests/test_optimizers/test_knapsack_facility_location.py"
    "tests/test_optimizers/test_knapsack_feature_based.py"
  ];

  # NOTE: These tests seem to be flaky.
  disabledTests = [
    "test_digits_modular"
    "test_digits_modular_object"
    "test_digits_modular_sparse"
    "test_digits_sqrt_modular"
    "test_digits_sqrt_modular_object"
    "test_digits_sqrt_modular_sparse"
  ];

  # NOTE: Tests are disabled by default because they can run for hours and timeout on Hydra.
  doCheck = false;

  passthru.tests.check = apricot-select.overridePythonAttrs { doCheck = true; };

  meta = with lib; {
    description = "Module for submodular optimization for the purpose of selecting subsets of massive data sets";
    homepage = "https://github.com/jmschrei/apricot";
    changelog = "https://github.com/jmschrei/apricot/releases/tag/${version}";
    license = licenses.mit;
    maintainers = with maintainers; [ fab ];
  };
}