1{
2 lib,
3 buildPythonPackage,
4 pythonOlder,
5 fetchFromGitHub,
6 replaceVars,
7 graphviz,
8 coreutils,
9 pkg-config,
10 setuptools,
11 pytest,
12}:
13
14buildPythonPackage rec {
15 pname = "pygraphviz";
16 version = "1.14";
17 pyproject = true;
18
19 disabled = pythonOlder "3.10";
20
21 src = fetchFromGitHub {
22 owner = "pygraphviz";
23 repo = "pygraphviz";
24 tag = "pygraphviz-${version}";
25 hash = "sha256-RyUmT2djj2GnVG82xO9HULMAJZb2LYMUGDRvCwaYBg8=";
26 };
27
28 patches = [
29 # pygraphviz depends on graphviz executables and wc being in PATH
30 (replaceVars ./path.patch {
31 path = lib.makeBinPath [
32 graphviz
33 coreutils
34 ];
35 })
36 ];
37
38 nativeBuildInputs = [
39 pkg-config
40 setuptools
41 ];
42
43 buildInputs = [ graphviz ];
44
45 nativeCheckInputs = [ pytest ];
46
47 checkPhase = ''
48 runHook preCheck
49 pytest --pyargs pygraphviz
50 runHook postCheck
51 '';
52
53 pythonImportsCheck = [ "pygraphviz" ];
54
55 meta = with lib; {
56 description = "Python interface to Graphviz graph drawing package";
57 homepage = "https://github.com/pygraphviz/pygraphviz";
58 license = licenses.bsd3;
59 maintainers = with maintainers; [
60 matthiasbeyer
61 dotlambda
62 ];
63 };
64}