Skip to main content

Allows Python code execution inside of graphviz diagrams.

Project description

graphviz-py

package version py versions pypi license

Allows Python code execution inside of graphviz diagrams

Example

graph python_graph {
{{
import math

value = 0.5
sin = math.sin(value)
cos = math.cos(value)
}}

A [label="{{= value }}"];
B [label="{{= sin }}"];
C [label="{{= cos }}"];

A -- B [headlabel="sin"];
A -- C [headlabel="cos"];

}

Output

output

Installation

pip install graphviz-py

Important: Make sure graphviz is installed! See graphviz installation instructions.

Usage

Using files

graphviz-py -Tsvg example/example.py.dot -o output.svg
graphviz-py -Tpng example/example.py.dot -o output.png

Using stdin / pipes

echo 'digraph { A -> B [label="{{= 38 * 73 }}"] }' | graphviz-py -Tsvg > output.svg

graphviz-py passes all unknown arguments to graphviz. So you can use all graphviz arguments.

Coming soon

  • Compartibility with asciidoctor-diagram

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

graphviz-py-1.0.2.tar.gz (8.7 kB view hashes)

Uploaded Source

Built Distribution

graphviz_py-1.0.2-py3-none-any.whl (9.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page