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