1{ lib
2, fetchFromGitHub
3, buildPythonPackage
4, cmake
5, boost
6, eigen
7, gmp
8, cgal_5 # see https://github.com/NixOS/nixpkgs/pull/94875 about cgal
9, mpfr
10, tbb
11, numpy
12, cython
13, pybind11
14, matplotlib
15, scipy
16, pytest
17, enableTBB ? false
18}:
19
20buildPythonPackage rec {
21 pname = "gudhi";
22 version = "3.4.1";
23
24 src = fetchFromGitHub {
25 owner = "GUDHI";
26 repo = "gudhi-devel";
27 rev = "tags/gudhi-release-${version}";
28 fetchSubmodules = true;
29 sha256 = "1m03qazzfraxn62l1cb11icjz4x8q2sg9c2k3syw5v0yv9ndgx1v";
30 };
31
32 patches = [ ./remove_explicit_PYTHONPATH.patch ];
33
34 nativeBuildInputs = [ cmake numpy cython pybind11 matplotlib ];
35 buildInputs = [ boost eigen gmp cgal_5 mpfr ]
36 ++ lib.optionals enableTBB [ tbb ];
37 propagatedBuildInputs = [ numpy scipy ];
38 checkInputs = [ pytest ];
39
40 cmakeFlags = [
41 "-DCMAKE_BUILD_TYPE=Release"
42 "-DWITH_GUDHI_PYTHON=ON"
43 "-DPython_ADDITIONAL_VERSIONS=3"
44 ];
45
46 preBuild = ''
47 cd src/python
48 '';
49
50 checkPhase = ''
51 rm -r gudhi
52 ${cmake}/bin/ctest --output-on-failure
53 '';
54
55 pythonImportsCheck = [ "gudhi" "gudhi.hera" "gudhi.point_cloud" "gudhi.clustering" ];
56
57 meta = {
58 description = "Library for Computational Topology and Topological Data Analysis (TDA)";
59 homepage = "https://gudhi.inria.fr/python/latest/";
60 downloadPage = "https://github.com/GUDHI/gudhi-devel";
61 license = with lib.licenses; [ mit gpl3 ];
62 maintainers = with lib.maintainers; [ yl3dy ];
63 };
64}