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.

Output

output

Variables

graphviz-py -Tsvg -a myvalue=5 example/variable_example.py.dot -o output.svg

Here we pass a variable called "myvalue" with the value 5

Output

output

Security

Please keep in mind that graphviz-py executes all Python code in the diagram. So make sure that your diagrams dies not include harmful code.

Coming soon

Arguments

# graphviz-py --help
usage: graphviz-py [-h] [-v] [-d] [-a ARGUMENT] [files [files ...]]

graphviz-py diagram builder

positional arguments:
  files                 the paths to the graphviz-py files

optional arguments:
  -h, --help            show this help message and exit
  -v, --version         show program's version number and exit
  -d, --debug           show debug information
  -a ARGUMENT, --argument ARGUMENT

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.8.tar.gz (9.4 kB view details)

Uploaded Source

Built Distribution

graphviz_py-1.0.8-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

File details

Details for the file graphviz-py-1.0.8.tar.gz.

File metadata

  • Download URL: graphviz-py-1.0.8.tar.gz
  • Upload date:
  • Size: 9.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.10.2 Linux/5.11.0-1028-azure

File hashes

Hashes for graphviz-py-1.0.8.tar.gz
Algorithm Hash digest
SHA256 81e5faab07f2a45c17cc0dc4abf7c57dcc1da671fd437bdaafe9da58e94654f6
MD5 e78969f39d687634d1d7dbbeaa796f74
BLAKE2b-256 db2f31e200e2d95b36e8bc3a3794f75f004ef7c5233847877594425ae400decd

See more details on using hashes here.

File details

Details for the file graphviz_py-1.0.8-py3-none-any.whl.

File metadata

  • Download URL: graphviz_py-1.0.8-py3-none-any.whl
  • Upload date:
  • Size: 10.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.10.2 Linux/5.11.0-1028-azure

File hashes

Hashes for graphviz_py-1.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 794f62169112f9821d3a6b2a04c5b6e1c81b66a022a4bd23370e819fafb2712d
MD5 93e4e1ba500270e45300b390a8184fd1
BLAKE2b-256 d0ac4e38c8b18e050a55c09e9c471ac70e32e4d5fe8cb3c6189eee09e9b56cb9

See more details on using hashes here.

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