summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/annoy/default.nix
blob: 9e9b16baf70eb1ed50a323d253477ad6fb181f01 (plain)
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
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,

  # build-system
  setuptools,

  # nativeBuildInputs
  h5py,

  # tests
  numpy,
  pytestCheckHook,
}:

buildPythonPackage rec {
  pname = "annoy";
  version = "1.17.3";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "spotify";
    repo = "annoy";
    tag = "v${version}";
    hash = "sha256-oJHW4lULRun2in35pBGOKg44s5kgLH2BKiMOzVu4rf4=";
  };

  postPatch = ''
    substituteInPlace setup.py \
      --replace-fail "'nose>=1.0'" ""
  '';

  build-system = [ setuptools ];

  nativeBuildInputs = [ h5py ];

  nativeCheckInputs = [
    numpy
    pytestCheckHook
  ];

  preCheck = ''
    rm -rf annoy
  '';

  disabledTestPaths = [
    # network access
    "test/accuracy_test.py"
  ];

  pythonImportsCheck = [ "annoy" ];

  meta = {
    description = "Approximate Nearest Neighbors in C++/Python optimized for memory usage and loading/saving to disk";
    homepage = "https://github.com/spotify/annoy";
    changelog = "https://github.com/spotify/annoy/releases/tag/v${version}";
    license = lib.licenses.asl20;
    maintainers = with lib.maintainers; [ timokau ];
    badPlatforms = [
      # Several tests fail with AssertionError
      lib.systems.inspect.patterns.isDarwin
    ];
  };
}