1{
2 lib,
3 fetchFromGitHub,
4 buildPythonPackage,
5 cmake,
6 setuptools,
7 boost,
8 eigen,
9 gmp,
10 cgal,
11 mpfr,
12 tbb,
13 numpy,
14 cython,
15 pybind11,
16 matplotlib,
17 scipy,
18 pytest,
19 enableTBB ? false,
20}:
21
22buildPythonPackage rec {
23 pname = "gudhi";
24 version = "3.11.0";
25 pyproject = true;
26
27 src = fetchFromGitHub {
28 owner = "GUDHI";
29 repo = "gudhi-devel";
30 tag = "tags/gudhi-release-${version}";
31 fetchSubmodules = true;
32 hash = "sha256-EebPvmioTYBv3VR6SNEfiqi2GC4sZn8WEj0fu42B8yM=";
33 };
34
35 nativeBuildInputs = [
36 cmake
37 numpy
38 cython
39 pybind11
40 matplotlib
41 setuptools
42 ];
43 buildInputs = [
44 boost
45 eigen
46 gmp
47 cgal
48 mpfr
49 ]
50 ++ lib.optionals enableTBB [ tbb ];
51 propagatedBuildInputs = [
52 numpy
53 scipy
54 ];
55 nativeCheckInputs = [ pytest ];
56
57 cmakeFlags = [
58 (lib.cmakeBool "WITH_GUDHI_PYTHON" true)
59 (lib.cmakeFeature "Python_ADDITIONAL_VERSIONS" "3")
60 ];
61
62 prePatch = ''
63 substituteInPlace src/python/CMakeLists.txt \
64 --replace '"''${GUDHI_PYTHON_PATH_ENV}"' ""
65 '';
66
67 preBuild = ''
68 cd src/python
69 '';
70
71 checkPhase = ''
72 runHook preCheck
73
74 rm -r gudhi
75 ctest --output-on-failure
76
77 runHook postCheck
78 '';
79
80 pythonImportsCheck = [
81 "gudhi"
82 "gudhi.hera"
83 "gudhi.point_cloud"
84 "gudhi.clustering"
85 ];
86
87 meta = {
88 description = "Library for Computational Topology and Topological Data Analysis (TDA)";
89 homepage = "https://gudhi.inria.fr/python/latest/";
90 downloadPage = "https://github.com/GUDHI/gudhi-devel";
91 license = with lib.licenses; [
92 mit
93 gpl3
94 ];
95 maintainers = with lib.maintainers; [ yl3dy ];
96 };
97}