Convert graphviz (dot) files into draw.io / lucid (mxGraph) format.
The graphviz library is required before installing this package.
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/"
sudo apt install python3-pip graphviz graphviz-dev
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
Run the conversion app on your graphviz file
graphviz2drawio example.dot
You can then import the output XML file into draw.io or lucidchart.
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
- PyGraphviz - Python interface to Graphviz
- svg.path - SVG path objects and parser
Pull requests and issue reports are welcome. For major changes, please open an issue first to discuss what you would like to change.
git clone [email protected]: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
- Migrate to uv/hatch for packaging and dep mgmt
- Turn on master branch protection
- Text alignment inside of shape
- Port layout/orientation
- Support for fill gradient
© Harold Martin - released under GPLv3