1{
2 lib,
3 buildPythonPackage,
4 pythonOlder,
5 fetchFromGitHub,
6 pkg-config,
7 setuptools,
8 igraph,
9 texttable,
10 cairocffi,
11 matplotlib,
12 plotly,
13 pytestCheckHook,
14}:
15
16buildPythonPackage rec {
17 pname = "igraph";
18 version = "0.11.8";
19
20 disabled = pythonOlder "3.8";
21
22 pyproject = true;
23
24 src = fetchFromGitHub {
25 owner = "igraph";
26 repo = "python-igraph";
27 tag = version;
28 postFetch = ''
29 # export-subst prevents reproducability
30 rm $out/.git_archival.json
31 '';
32 hash = "sha256-FEp9kwUAPSAnGcAuxApAq1AXiT0klXuXE2M6xNVilRg=";
33 };
34
35 postPatch = ''
36 rm -r vendor
37
38 # TODO remove starting with 0.11.9
39 substituteInPlace pyproject.toml \
40 --replace-fail "setuptools>=64,<72.2.0" setuptools
41 '';
42
43 nativeBuildInputs = [ pkg-config ];
44
45 build-system = [ setuptools ];
46
47 buildInputs = [ igraph ];
48
49 dependencies = [ texttable ];
50
51 optional-dependencies = {
52 cairo = [ cairocffi ];
53 matplotlib = [ matplotlib ];
54 plotly = [ plotly ];
55 plotting = [ cairocffi ];
56 };
57
58 # NB: We want to use our igraph, not vendored igraph, but even with
59 # pkg-config on the PATH, their custom setup.py still needs to be explicitly
60 # told to do it. ~ C.
61 env.IGRAPH_USE_PKG_CONFIG = true;
62
63 nativeCheckInputs = [
64 pytestCheckHook
65 ] ++ lib.flatten (lib.attrValues optional-dependencies);
66
67 disabledTests = [
68 "testAuthorityScore"
69 "test_labels"
70 ];
71
72 pythonImportsCheck = [ "igraph" ];
73
74 meta = with lib; {
75 description = "High performance graph data structures and algorithms";
76 mainProgram = "igraph";
77 homepage = "https://igraph.org/python/";
78 changelog = "https://github.com/igraph/python-igraph/blob/${src.rev}/CHANGELOG.md";
79 license = licenses.gpl2Plus;
80 maintainers = with maintainers; [
81 MostAwesomeDude
82 dotlambda
83 ];
84 };
85}