hbmartin / graphviz2drawio

Convert graphviz (dot) files into draw.io / lucid (mxGraph) format
http://graphviz2drawio.rtfd.io
GNU General Public License v3.0
163 stars 33 forks source link
dot-graph drawio graphviz graphviz-adapter graphviz-dot lucid lucidchart maxgraph mxgraph

graphviz2drawio

pypi Lint and Test Ruff Code style: black CodeFactor twitter

Convert graphviz (dot) files into draw.io / lucid (mxGraph) format.

Prerequisites

The graphviz library is required before installing this package.

macOS

Python 3 and graphviz can be installed with Homebrew:

brew update
brew install python3 graphviz
# In order to build pygraphviz:
export CFLAGS="-I$(brew --prefix graphviz)/include/"                                                   
export LDFLAGS="-L$(brew --prefix graphviz)/lib/"

Ubuntu / Debian

sudo apt install python3-pip graphviz graphviz-dev

Installation

It is recommended to use pipx to install and run the CLI tool. If you wish to use the library, you can install with pip instead.

brew install pipx
pipx install graphviz2drawio

Usage

Run the conversion app on your graphviz file

graphviz2drawio example.dot

You can then import the output XML file into draw.io or lucidchart.

Library Usage

from graphviz2drawio import graphviz2drawio

xml = graphviz2drawio.convert(graph_to_convert)
print(xml)

where graph_to_convert can be any of a file path, file handle, string of dot language, or PyGraphviz.AGraph object

Built With

Contributing

Pull requests and issue reports are welcome. For major changes, please open an issue first to discuss what you would like to change.

Development Setup

git clone git@github.com:hbmartin/graphviz2drawio.git
cd graphviz2drawio
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
# Replace with the actual path to your dot files
python -m graphviz2drawio test/directed/hello.gv.txt

Roadmap to 0.5

License

© Harold Martin - released under GPLv3