Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get list of supported image formats from dot instead of hardcoding #830

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Commits on Mar 10, 2023

  1. Get list of supported image formats from dot instead of hardcoding

    This PR replaces a list of image formats supported by graphviz that is hardcoded in
    rustworkx/visualization/graphviz.py with a list that is taken dynamically from the
    executable `dot`. With the version of `dot` that I tested, this list had 50 entries,
    while the hardcoded list had 35.
    
    The immediate reason for this PR is due to a failure in the test suite despite having
    a working `dot` on the PATH. Apparently `dot` can be compiled with varying support
    for image formats. In addition on some linux distributions, including some Ubuntu and
    some Fedora, the package `graphviz` does not support jpeg. But, installing the
    additional package `graphviz-devel` does add jpeg support. Before this PR, this would
    cause an untrapped error and a failure in the test suite, because only the presence
    of `dot` is checked, not which images it supports. With this PR, if your `dot` does
    not support `jpeg` then the test for writing a `jpeg` will be skipped.
    
    This PR also implements an error message that if both pillow and graphviz are missing
    says both are missing. Before, an error would be thrown with one message, then after
    installing the dependency, an error would be thrown with the second.
    jlapeyre committed Mar 10, 2023
    Configuration menu
    Copy the full SHA
    6418d6a View commit details
    Browse the repository at this point in the history
  2. Fix lint complaints

    jlapeyre committed Mar 10, 2023
    Configuration menu
    Copy the full SHA
    b6893f1 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    1224839 View commit details
    Browse the repository at this point in the history