xflr6 / graphviz

Simple Python interface for Graphviz
https://graphviz.readthedocs.io
MIT License
1.63k stars 211 forks source link

graphviz.backend.FORMATS throws AttributeError #149

Closed xamm closed 2 years ago

xamm commented 2 years ago

Environment Details

Error Description

When calling graphviz.backend.FORMATS an AttributeError is thrown. Expected would be a list of available Formats as was the case in previous versions.

e.g.

{
  'cmap', 'ismap', 'gd2', 'eps', 'fig', 'xdot1.4', 'cgimage', 'x11', 'pict', 'gif', 
  'psd', 'vml', 'ps', 'cmapx', 'wbmp', 'ps2', 'svg', 'canon', 'xdot_json', 'pic', 
  'plain', 'gtk', 'bmp', 'svgz', 'ico', 'jpe', 'json0', 'sgi', 'imap', 'xdot1.2', 'tiff', 
  'jp2', 'xdot', 'pct', 'tga', 'gd', 'xlib', 'tk', 'tif', 'dot_json', 'png', 'jpg', 'exr', 
  'imap_np', 'pdf', 'vrml', 'webp', 'dot', 'json', 'plain-ext', 'pov', 'jpeg', 
  'cmapx_np', 'gv', 'vmlz'
}

Steps to reproduce

Python 3.8.12 (default, Oct 13 2021, 06:42:42)
[Clang 13.0.0 (clang-1300.0.29.3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import graphviz
>>> graphviz.backend.FORMATS
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'graphviz.backend' has no attribute 'FORMATS'
xflr6 commented 2 years ago

Thanks. I am afraid this is as documented: Submodules of graphviz are not part of the public API (cf. https://graphviz.readthedocs.io/en/stable/api.html). Please stick to the documented interface and use graphviz.FORMATS, see https://graphviz.readthedocs.io/en/stable/api.html#graphviz.FORMATS).

Just saw that the API now mentions graphviz.backend.DOT_BINARY, let me fix that.

xflr6 commented 2 years ago

Fixed unintended API reference to backend in 04f5abd287b1d19767c82a0de5626d14f8ab889b, closing.