1{
2 lib,
3 buildPythonPackage,
4 fetchPypi,
5
6 # build-system
7 cython,
8 numpy,
9 setuptools,
10
11 # native dependencies
12 openmp,
13
14 # tests
15 pytestCheckHook,
16}:
17
18buildPythonPackage rec {
19 pname = "pykdtree";
20 version = "1.3.12";
21 pyproject = true;
22
23 src = fetchPypi {
24 inherit pname version;
25 hash = "sha256-zCCypnxkBWSFoxTSwrbbo1SvfuHI+42uG+byk2o3Q0E=";
26 };
27
28 postPatch = ''
29 substituteInPlace pyproject.toml \
30 --replace-warn "numpy>=2.0.0rc1,<3" "numpy"
31 '';
32
33 nativeBuildInputs = [
34 cython
35 numpy
36 setuptools
37 ];
38
39 buildInputs = [ openmp ];
40
41 propagatedBuildInputs = [ numpy ];
42
43 preCheck = ''
44 # make sure we don't import pykdtree from the source tree
45 mv pykdtree/test_tree.py .
46 rm -rf pykdtree
47 '';
48
49 nativeCheckInputs = [ pytestCheckHook ];
50
51 meta = with lib; {
52 description = "kd-tree implementation for fast nearest neighbour search in Python";
53 homepage = "https://github.com/storpipfugl/pykdtree";
54 license = licenses.lgpl3;
55 maintainers = with maintainers; [ psyanticy ];
56 };
57}