pydot icon indicating copy to clipboard operation
pydot copied to clipboard

Integration with Jupyter notebook

Open yoavram opened this issue 10 years ago • 0 comments

This PR allows using pydot inside a Jupyter notebook as it automatically displays graphs as images - see example notebook.

Changes:

  • Added a _repr_png as expected by Jupyter notebook
  • Return self from some methods to induce repr in the notebook

Tested the above notebook on Jupyter 4.0.6 with Python 2.7.10 and 3.4.3 on Windows 7 with Graphviz 2.34. I didn't change ChangLog or setup.py. I ran the testsuite using cd tests; python pydot_unittest.py, got the same results as I got from the master branch, that is (only errors are shown):

======================================================================
ERROR: test_graph_with_shapefiles (__main__.TestGraphAPI)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "pydot_unittest.py", line 158, in test_graph_with_shapefiles
  File "d:\workspace\pydot-1\pydot\__init__.py", line 1968, in create
    status, stderr_output))
pydot.InvocationException: Program terminated with status: 3221225477. stderr follows: []

======================================================================
FAIL: test_graphviz_regression_tests (__main__.TestGraphAPI)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "pydot_unittest.py", line 223, in test_graphviz_regression_tests
    def test_graphviz_regression_tests(self):
  File "pydot_unittest.py", line 250, in _render_and_compare_dot_files
AssertionError: 'c2d16f775630039904d3da975941a5e6c16e870357a119488023cc96dce2a451' != '7df8d46b62681fa1f73bf313e46c81c634fd1100e0904b35a3d5106dab8fa9a3'
- c2d16f775630039904d3da975941a5e6c16e870357a119488023cc96dce2a451
+ 7df8d46b62681fa1f73bf313e46c81c634fd1100e0904b35a3d5106dab8fa9a3
----------------------------------------------------------------------

yoavram avatar Oct 02 '15 07:10 yoavram