Skip to main content

A CLI to convert dot files to bgraph format for visualization.

Project description

dot2bgraph PyPI Travis (.com) Coveralls

dot2bgraph is a CLI utility to convert graphs in dot format to bgraph format, for visualization with tools like bgrapher.

dot2bgraph supports a subset of dot features, tailored specifically to those that convert neatly to bgraph format. Other dot attributes that do not correlate to attributes supported by bgraph (e.g., shapes, label positions, etc.) are ignored.

Installation

First, ensure that you have graphviz installed, since it is a dependency for pygraphviz which, in turn, is a dependency for dot2bgraph.

For example, in Ubuntu:

apt-get install graphviz graphviz-dev

Or in OSX:

brew install graphviz

For other platforms, see pygraphviz's INSTALL.txt

Then, install dot2bgraph:

pip install dot2bgraph

With MacOS you may need to prepend CFLAGS="-I$(brew --prefix graphviz)/include" LDFLAGS="-L$(brew --prefix graphviz)/lib"

Usage

By default an input "file.dot" is converted to bgraph JSON format, which is outputted to stdout:

dot2bgraph file.dot

If you instead wish to quickly look at the output as it would appear in a bgraph visualization tool, use -f png, i.e., "PNG format". For example:

dot2bgraph -f png file.dot

For creating a bgraph recursively from multiple dot files in a directory structure, use -R, e.g. for the following directory structure:

dotdir
├── file1.dot
└── subdotdir
    └── file2.dot

You can run:

dot2bgraph -R dotdir

To save the tool's output (in whichever format) to a file, use -o.

Development

Install

python3 -m venv .venv
source .venv/bin/activate
CFLAGS="-I$(brew --prefix graphviz)/include" LDFLAGS="-L$(brew --prefix graphviz)/lib" python3 -m pip install ".[dev]"

With MacOS you may need to prepend CFLAGS="-I$(brew --prefix graphviz)/include" LDFLAGS="-L$(brew --prefix graphviz)/lib"

Test

Pytest

python -m pytest -s --cov-report term-missing --cov=dot2bgraph

Mypy

python -m mypy -p dot2bgraph --config-file=mypy.ini

Profile

python -mcProfile -o dot2bgraph.prof dot2bgraph/__main__.py -f none <your_dot_file>

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

dot2bgraph-0.1.2.tar.gz (41.4 kB view details)

Uploaded Source

Built Distribution

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

dot2bgraph-0.1.2-py3-none-any.whl (31.0 kB view details)

Uploaded Python 3

File details

Details for the file dot2bgraph-0.1.2.tar.gz.

File metadata

  • Download URL: dot2bgraph-0.1.2.tar.gz
  • Upload date:
  • Size: 41.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/6.0.0 pkginfo/1.7.1 requests/2.28.2 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.19

File hashes

Hashes for dot2bgraph-0.1.2.tar.gz
Algorithm Hash digest
SHA256 cadcf129d46ed7aa02409ee0d8084681d12672b5d1e33e91b7aedd0da23de8e9
MD5 1e42d11684a967201761a06f17fd7cc0
BLAKE2b-256 022db638ab13ff4de6d6503f1d0c1aac86948b582bf93794dead56e7d919234a

See more details on using hashes here.

File details

Details for the file dot2bgraph-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: dot2bgraph-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 31.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/6.0.0 pkginfo/1.7.1 requests/2.28.2 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.19

File hashes

Hashes for dot2bgraph-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 51d93f7248b753ab8245df0e594ed7160d360e30e773dc8c7514105ab377611a
MD5 95659e7b1f1e886b1560a7736f94f918
BLAKE2b-256 7476cc736b63e4a9fce09da9096a3ef4301de31cc02ae3dda761c5f0ea609e57

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