1{
2 lib,
3 fetchFromGitHub,
4 buildPythonPackage,
5 cmake,
6 setuptools,
7 boost,
8 eigen,
9 gmp,
10 cgal, # see https://github.com/NixOS/nixpkgs/pull/94875 about 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.9.0";
25 pyproject = true;
26
27 src = fetchFromGitHub {
28 owner = "GUDHI";
29 repo = "gudhi-devel";
30 rev = "tags/gudhi-release-${version}";
31 fetchSubmodules = true;
32 hash = "sha256-VL6RIPe8a2/cUHnHOql9e9EUMBB9QU311kMCaMZTbGI=";
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 ] ++ lib.optionals enableTBB [ tbb ];
50 propagatedBuildInputs = [
51 numpy
52 scipy
53 ];
54 nativeCheckInputs = [ pytest ];
55
56 cmakeFlags = [
57 (lib.cmakeBool "WITH_GUDHI_PYTHON" true)
58 (lib.cmakeFeature "Python_ADDITIONAL_VERSIONS" "3")
59 ];
60
61 prePatch = ''
62 substituteInPlace src/python/CMakeLists.txt \
63 --replace '"''${GUDHI_PYTHON_PATH_ENV}"' ""
64 '';
65
66 preBuild = ''
67 cd src/python
68 '';
69
70 checkPhase = ''
71 runHook preCheck
72
73 rm -r gudhi
74 ctest --output-on-failure
75
76 runHook postCheck
77 '';
78
79 pythonImportsCheck = [
80 "gudhi"
81 "gudhi.hera"
82 "gudhi.point_cloud"
83 "gudhi.clustering"
84 ];
85
86 meta = {
87 description = "Library for Computational Topology and Topological Data Analysis (TDA)";
88 homepage = "https://gudhi.inria.fr/python/latest/";
89 downloadPage = "https://github.com/GUDHI/gudhi-devel";
90 license = with lib.licenses; [
91 mit
92 gpl3
93 ];
94 maintainers = with lib.maintainers; [ yl3dy ];
95 };
96}