1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 h5py,
6 numpy,
7 pytestCheckHook,
8 pythonOlder,
9 setuptools,
10}:
11
12buildPythonPackage rec {
13 pname = "annoy";
14 version = "1.17.3";
15 pyproject = true;
16
17 disabled = pythonOlder "3.7";
18
19 src = fetchFromGitHub {
20 owner = "spotify";
21 repo = "annoy";
22 rev = "refs/tags/v${version}";
23 hash = "sha256-oJHW4lULRun2in35pBGOKg44s5kgLH2BKiMOzVu4rf4=";
24 };
25
26 postPatch = ''
27 substituteInPlace setup.py \
28 --replace-fail "'nose>=1.0'" ""
29 '';
30
31 build-system = [ setuptools ];
32
33 nativeBuildInputs = [ h5py ];
34
35 nativeCheckInputs = [
36 numpy
37 pytestCheckHook
38 ];
39
40 preCheck = ''
41 rm -rf annoy
42 '';
43
44 disabledTestPaths = [
45 # network access
46 "test/accuracy_test.py"
47 ];
48
49 pythonImportsCheck = [ "annoy" ];
50
51 meta = with lib; {
52 description = "Approximate Nearest Neighbors in C++/Python optimized for memory usage and loading/saving to disk";
53 homepage = "https://github.com/spotify/annoy";
54 changelog = "https://github.com/spotify/annoy/releases/tag/v${version}";
55 license = licenses.asl20;
56 maintainers = with maintainers; [ timokau ];
57 };
58}