Skip to main content

A Graphviz static wrapper for Python

Project description

graphviz-static

This is a Python package for Graphviz. It has static binaries inside for easy use.

You are working in cross-platform environment, and want to use graphviz without having to install it over and over again? Well, this package allows you to enjoy that moment by simply installs every platform possible in it (yes, this is a lazy approach)

Current version of Graphviz is 14.1.1

Inspired by static-ffmpeg.

Installation

pip install graphviz-static

Install this package with pip.

Usage

from graphviz_static import load_paths, export_to_image

# Start Graphviz (loads the right programs for your computer)
load_paths()

# Make a DOT file
dot_content = """
digraph G {
    node [shape=box, style=filled, color=lightblue];
    A -> B -> C;
    B -> D;
}
"""

# Save the file
with open("example.dot", "w", encoding="utf-8") as f:
    f.write(dot_content)

# Make a PNG picture
export_to_image("example.dot", "png", "output")

API Reference

load_paths()

This loads the right Graphviz programs for your computer and adds them to PATH.

export_to_image(dot_file, file_type="png", file_name="output")

This renders your dotfile into raster image.

  • dot_file: The path to your DOT file
  • file_type: The image format (png, svg, pdf, etc.)
  • file_name: The image name (without the type at the end)

This will returns your image result path.

get_dot_path()

This gives you the path to the dot program for your computer.

Supported Platforms

  • Windows (32-bit and 64-bit)

Notes

  • You can use this along with official graphviz, you just need to put the load_paths() in the code in order to work.

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_static-0.2.0.dev0.tar.gz (17.5 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

graphviz_static-0.2.0.dev0-py3-none-any.whl (17.6 MB view details)

Uploaded Python 3

File details

Details for the file graphviz_static-0.2.0.dev0.tar.gz.

File metadata

  • Download URL: graphviz_static-0.2.0.dev0.tar.gz
  • Upload date:
  • Size: 17.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for graphviz_static-0.2.0.dev0.tar.gz
Algorithm Hash digest
SHA256 67451e359debad82d94afd14fae06d23812800521c20bec30f8754c4be34affe
MD5 759fa01cc9e482a77e2d788c73712dfe
BLAKE2b-256 081d1d5f4fe4933f670acebf2dcf24782e4ecb2eff0bce6e6b7c935090d03057

See more details on using hashes here.

File details

Details for the file graphviz_static-0.2.0.dev0-py3-none-any.whl.

File metadata

File hashes

Hashes for graphviz_static-0.2.0.dev0-py3-none-any.whl
Algorithm Hash digest
SHA256 6d821f26fd6b15701650e4fb2c983e0098bdb4879be2bd662127ddd44db5ef4c
MD5 d5816e9db2d95a8a1ebc3ecc57e96a96
BLAKE2b-256 f0e2585b7d96e85979269c67f3350a1ebd0b6f19f6630362963165a7718ec90c

See more details on using hashes here.

Supported by

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