Metadata-Version: 2.4
Name: graphviz-static
Version: 0.2.2
Summary: A Graphviz static wrapper for Python
Home-page: https://github.com/tbtn123/graphviz-static
Author: Hvd/tbtn123/toibithieunang123
License: MIT
Project-URL: Homepage, https://github.com/tbtn123/graphviz-static
Project-URL: Repository, https://github.com/tbtn123/graphviz-static
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Requires-Python: >=3.6
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: home-page
Dynamic: license-file
Dynamic: requires-python

# 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

```bash
pip install graphviz-static
```

Install this package with pip.

## Usage

```python
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.
