1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013, 2015, 2021 Ludovic Courtès <ludo@gnu.org>
3 ;;; Copyright © 2015, 2020 Efraim Flashner <efraim@flashner.co.il>
4 ;;; Copyright © 2016 Theodoros Foradis <theodoros@foradis.org>
5 ;;; Copyright © 2017, 2018, 2019 Ricardo Wurmus <rekado@elephly.net>
6 ;;; Copyright © 2017, 2018 Tobias Geerinckx-Rice <me@tobias.gr>
7 ;;; Copyright © 2017 Gábor Boskovits <boskovits@gmail.com>
8 ;;; Copyright © 2018 Mathieu Lirzin <mthl@gnu.org>
9 ;;; Copyright © 2020, 2022 Marius Bakke <marius@gnu.org>
10 ;;; Copyright © 2020 Vincent Legoll <vincent.legoll@gmail.com>
11 ;;; Copyright © 2020 Pjotr Prins <pjotr.guix@thebird.nl>
12 ;;; Copyright © 2021 Bonface Munyoki Kilyungi <me@bonfacemunyoki.com>
13 ;;; Copyright © 2021 Giacomo Leidi <goodoldpaul@autistici.org>
14 ;;; Copyright © 2021 Justin Veilleux <terramorpha@cock.li>
16 ;;; This file is part of GNU Guix.
18 ;;; GNU Guix is free software; you can redistribute it and/or modify it
19 ;;; under the terms of the GNU General Public License as published by
20 ;;; the Free Software Foundation; either version 3 of the License, or (at
21 ;;; your option) any later version.
23 ;;; GNU Guix is distributed in the hope that it will be useful, but
24 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
25 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 ;;; GNU General Public License for more details.
28 ;;; You should have received a copy of the GNU General Public License
29 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
31 (define-module (gnu packages graphviz)
32 #:use-module (guix packages)
33 #:use-module (guix build-system gnu)
34 #:use-module (guix build-system python)
35 #:use-module (guix download)
36 #:use-module (guix git-download)
37 #:use-module (guix utils)
38 #:use-module (guix gexp)
39 #:use-module (gnu packages)
40 #:use-module (gnu packages autotools)
41 #:use-module (gnu packages bison)
42 #:use-module (gnu packages check)
43 #:use-module (gnu packages compression)
44 #:use-module (gnu packages flex)
45 #:use-module (gnu packages fontutils)
46 #:use-module (gnu packages gd)
47 #:use-module (gnu packages glib)
48 #:use-module (gnu packages gnome)
49 #:use-module (gnu packages gtk)
50 #:use-module (gnu packages guile)
51 #:use-module (gnu packages image)
52 #:use-module (gnu packages perl)
53 #:use-module (gnu packages pkg-config)
54 #:use-module (gnu packages python)
55 #:use-module (gnu packages python-build)
56 #:use-module (gnu packages python-check)
57 #:use-module (gnu packages python-xyz)
58 #:use-module (gnu packages sphinx)
59 #:use-module (gnu packages swig)
60 #:use-module (gnu packages tcl)
61 #:use-module (gnu packages tex)
62 #:use-module (gnu packages xml)
63 #:use-module (gnu packages xorg)
64 #:use-module ((guix licenses) #:prefix license:))
66 (define-public graphviz
72 (uri (string-append "https://gitlab.com/api/v4/projects/4207231"
73 "/packages/generic/graphviz-releases/"
74 version "/graphviz-" version ".tar.xz"))
77 "042s6mbi681pwgffqww2ap780230nrsrfpfiz9a41dcjb5a0m524"))))
78 (build-system gnu-build-system)
80 ;; FIXME: rtest/rtest.sh is a ksh script (!). Add ksh as an input.
83 #~(modify-phases %standard-phases
84 (add-after 'install 'move-docs
85 (lambda* (#:key outputs #:allow-other-keys)
86 (let ((out (assoc-ref outputs "out"))
87 (doc (assoc-ref outputs "doc")))
88 (mkdir-p (string-append doc "/share/graphviz"))
89 (rename-file (string-append out "/share/graphviz/doc")
90 (string-append doc "/share/graphviz/doc")))))
91 (add-after 'move-docs 'move-guile-bindings
92 (lambda* (#:key outputs #:allow-other-keys)
93 (let* ((out (assoc-ref outputs "out"))
94 (lib (string-append out "/lib"))
95 (extdir (string-append lib "/guile/"
96 #$(version-major+minor
98 (this-package-input "guile")))
101 (rename-file (string-append
102 lib "/graphviz/guile/libgv_guile.so")
103 (string-append extdir
104 "/libgv_guile.so"))))))))
106 `(("libXrender" ,libxrender)
110 ("guile" ,guile-3.0) ;Guile bindings
112 ("fontconfig" ,fontconfig)
113 ("freetype" ,freetype)
117 ("libjpeg" ,libjpeg-turbo)
120 (list bison swig pkg-config))
121 (outputs '("out" "doc")) ; 5 MiB of html + pdfs
122 (home-page "https://www.graphviz.org/")
123 (synopsis "Graph visualization software")
125 "Graphviz is a graph visualization tool suite. Graph visualization is a
126 way of representing structural information as diagrams of abstract graphs and
127 networks. It has important applications in networking, bioinformatics,
128 software engineering, database and web design, machine learning, and in visual
129 interfaces for other technical domains.")
130 (license license:epl1.0)))
132 ;; Older Graphviz needed for pygraphviz. See
133 ;; https://github.com/pygraphviz/pygraphviz/issues/175
134 (define-public graphviz-2.38
135 ;; This commit corresponds to the changelog change for version 2.38.0.
136 ;; There are no tags.
137 (let ((commit "f54ac2c9313ae80ccf76ef4ac6aa9be820a23126")
139 (package (inherit graphviz)
141 (version (git-version "2.38.0" revision commit))
145 (url "https://gitlab.com/graphviz/graphviz.git")
147 (file-name (git-file-name name version))
150 "1vjg308gflmi1khgjmcj431cnkrlv12bg4cqah39mwhny92jy92x"))))
152 (substitute-keyword-arguments (package-arguments graphviz)
154 #~(modify-phases #$phases
155 (add-after 'unpack 'prepare-bootstrap
157 (substitute* "autogen.sh"
158 (("/bin/sh") (which "sh"))
159 (("\\$GRAPHVIZ_VERSION_DATE") "0"))
160 (setenv "CONFIG_SHELL" (which "sh"))
161 (setenv "SHELL" (which "sh"))
163 (map make-file-writable (find-files "." ".*"))
167 (invoke (which "sh") "autogen.sh" "NOCONFIG") #t))))))
169 (modify-inputs (package-native-inputs graphviz)
177 (define-public python-graphviz
179 (name "python-graphviz")
183 (uri (pypi-uri "graphviz" version ".zip"))
186 "009alrilzx0v7kl41khbq7k6k8b8pxyvbsi1b1ai933f6kpbxb30"))))
187 (build-system python-build-system)
189 '(#:phases (modify-phases %standard-phases
191 (lambda* (#:key tests #:allow-other-keys)
193 (invoke "pytest" "-vv")
194 (format #t "test suite not run~%"))
204 (home-page "https://github.com/xflr6/graphviz")
205 (synopsis "Simple Python interface for Graphviz")
207 "This package provides a simple Python interface for the Graphviz graph
208 visualization tool suite.")
209 (license license:expat)))
211 (define-public python-pygraphviz
213 (name "python-pygraphviz")
219 (url "https://github.com/pygraphviz/pygraphviz")
220 (commit (string-append "pygraphviz-" version))))
221 (file-name (string-append "pygraphviz-" version "-checkout"))
224 "0jqc3dzy9n0hn3b99zq8jp53901zpjzvvi5ns5mbaxg8kdrb1lfx"))))
225 (build-system python-build-system)
229 (list python-nose python-mock python-pytest
230 python-doctest-ignore-unicode))
231 (home-page "https://pygraphviz.github.io")
232 (synopsis "Python interface to Graphviz")
233 (description "PyGraphviz is a Python interface to the Graphviz graph
234 layout and visualization package. With PyGraphviz you can create, edit, read,
235 write, and draw graphs using Python to access the Graphviz graph data
236 structure and layout algorithms.")
237 (license license:bsd-3)))
239 (define-public python-uqbar
241 (name "python-uqbar")
247 (url "https://github.com/josiah-wolf-oberholtzer/uqbar")
248 (commit (string-append "v" version))))
249 (file-name (git-file-name name version))
252 "1ml3x2mf7nlnvrh9lari5yk0sz2mmg39jwsbjxnpzhnw4kcwpdrs"))))
253 (build-system python-build-system)
256 (modify-phases %standard-phases
257 (add-after 'unpack 'patch
259 (substitute* "setup.py"
260 ;; Latest versions of sphink-rtd-theme require npm to build.
261 (("sphinx-rtd-theme >= 0.5.0") "sphinx-rtd-theme >= 0.2.4")
262 (("black") "black >= 19.10b0"))
265 (lambda* (#:key tests? #:allow-other-keys)
267 (invoke "python" "-m" "pytest" "tests"))
277 (list python-black python-sphinx python-sphinx-rtd-theme
279 (home-page "https://github.com/josiah-wolf-oberholtzer/uqbar")
280 (synopsis "Tools for building documentation with Sphinx, Graphviz and LaTeX")
282 "This package contains tools for building documentation with Sphinx,
283 Graphviz and LaTeX.")
284 (license license:expat)))
292 (uri (string-append "mirror://sourceforge/gts/gts/" version
293 "/gts-" version ".tar.gz"))
296 "07mqx09jxh8cv9753y2d2jsv7wp8vjmrd7zcfpbrddz3wc9kx705"))))
297 (build-system gnu-build-system)
300 (modify-phases %standard-phases
301 (add-before 'check 'pre-check
303 (chmod "test/boolean/test.sh" #o777)
306 ;; Some data files used by the test suite are missing.
307 ;; See <http://sourceforge.net/p/gts/bugs/41/>.
312 ;; The gts.pc file has glib-2.0 as required.
314 (home-page "http://gts.sourceforge.net/")
316 ;; Note: Despite the name, this is not official GNU software.
317 (synopsis "Triangulated Surface Library")
319 "Library intended to provide a set of useful functions to deal with
320 3D surfaces meshed with interconnected triangles.")
321 (license license:lgpl2.0+)))
330 (uri (pypi-uri "xdot" version))
333 "0cr4rh7dz4dfzyxrk5pzhm0d15gkrgkfp3i5lw178xy81pc56p71"))))
334 (build-system python-build-system)
337 (modify-phases %standard-phases
338 ;; We wrap xdot, so that we don't propagate gtk+ and graphviz
339 (add-after 'install 'wrap
340 (lambda* (#:key inputs outputs #:allow-other-keys)
341 (wrap-program (string-append (assoc-ref outputs "out") "/bin/xdot")
342 `("GI_TYPELIB_PATH" ":" prefix
344 (assoc-ref inputs "gtk+") "/lib/girepository-1.0"
345 ":" (assoc-ref inputs "pango") "/lib/girepository-1.0"
346 ":" (assoc-ref inputs "gdk-pixbuf") "/lib/girepository-1.0"
347 ":" (assoc-ref inputs "atk") "/lib/girepository-1.0"
348 ":" (assoc-ref inputs "harfbuzz") "/lib/girepository-1.0")))
350 (,(dirname (search-input-file inputs "bin/dot"))))))))))
359 (home-page "https://pypi.org/project/xdot/")
360 (synopsis "Interactive viewer for graphviz dot files")
361 (description "Xdot is an interactive viewer for graphs written in
362 @code{graphviz}’s dot language. Internally, it uses the xdot output format as
363 an intermediate format, and @code{gtk} and @code{cairo} for rendering. Xdot
364 can be used either as a standalone application, or as a Python library.")
365 (license license:lgpl3+)))
367 (define-public python-pydot
369 (name "python-pydot")
374 (uri (pypi-uri "pydot" version))
377 "0z80zwldf7ffkwrpm28hixsiqp3053j7g281xd6phmnbkfiq3014"))))
378 (build-system python-build-system)
381 (modify-phases %standard-phases
383 ;; Taken from .travis.yaml
384 (lambda* (#:key tests? inputs outputs #:allow-other-keys)
386 (add-installed-pythonpath inputs outputs)
387 (with-directory-excursion "test"
388 (invoke "python" "pydot_unittest.py"))))))))
391 (list graphviz python-chardet))
393 ;; XXX: Two test failures with 3.0+:
394 ;; https://github.com/pydot/pydot/issues/277
395 (list python-pyparsing-2.4.7))
396 (home-page "https://github.com/pydot/pydot")
397 (synopsis "Python interface to Graphviz's DOT language")
399 "Pydot provides an interface to create, handle, modify and process
400 graphs in Graphviz's DOT language, written in pure Python.")
401 (license license:expat)))
403 (define-public dot2tex
409 (uri (pypi-uri "dot2tex" version))
412 "1kp77wiv7b5qib82i3y3sn9r49rym43aaqm5aw1bwnzfbbq2m6i9"))))
413 (build-system python-build-system)
417 #~(modify-phases %standard-phases
419 (lambda* (#:key tests? #:allow-other-keys)
421 (invoke "pytest" "-vv" "tests"
422 ;; The test_semicolon test fails for unknown reason
424 ;; https://github.com/kjellmf/dot2tex/issues/94).
425 "-k" "not test_semicolon")))))))
426 (native-inputs (list python-pytest))
427 (inputs (list graphviz))
429 (list python-pyparsing
430 ;; These TeX dependencies are propagated to make it easier to build
431 ;; the resulting generated TeX files, which \usepackage them.
434 texlive-latex-geometry
435 texlive-latex-graphics
437 texlive-latex-preview
438 texlive-latex-xkeyval
442 (home-page "https://github.com/kjellmf/dot2tex")
443 (synopsis "Graphviz to LaTeX converter")
445 "The purpose of @code{dot2tex} is to give graphs generated by Graphviz a
446 more LaTeX friendly look and feel. This is accomplished by converting
447 @code{xdot} output from Graphviz to a series of PSTricks or PGF/TikZ commands.
448 This approach allows:
451 @item Typesetting labels with LaTeX, allowing mathematical notation
452 @item Using native PSTricks and PGF/TikZ commands for drawing arrows
453 @item Using backend specific styles to customize the output
455 (license license:expat)))
457 (define-public gprof2dot
460 (version "2021.02.21")
465 (url "https://github.com/jrfonseca/gprof2dot")
467 (file-name (git-file-name name version))
470 "1jjhsjf5fdi1fkn7mvhnzkh6cynl8gcjrygd3cya5mmda3akhzic"))))
471 (build-system python-build-system)
474 (modify-phases %standard-phases
476 (lambda* (#:key inputs outputs tests? #:allow-other-keys)
478 (add-installed-pythonpath inputs outputs)
479 (invoke "python" "tests/test.py")))))))
482 (home-page "https://github.com/jrfonseca/gprof2dot")
483 (synopsis "Generate a dot graph from the output of several profilers")
484 (description "This package provides a Python script to convert the output
485 from many profilers into a dot graph.
491 @item prune nodes and edges below a certain threshold;
492 @item use an heuristic to propagate time inside mutually recursive functions;
493 @item use color efficiently to draw attention to hot-spots;
494 @item work on any platform where Python and Graphviz is available.
497 (license license:lgpl3+)))