Package: python3-pygraphviz
Version: 1.3~rc2-3+b2
Severity: important
Tags: patch

Control: tag -1 + fixed-upstream

Hi,

the python3-pygraphviz module is unable to handle graphs with graph
attributes:

>>> import pygraphviz as pgv
>>> A = pgv.AGraph()
>>> A.add_node(1,foo='bar')
>>> A.graph_attr.update(landscape='true',ranksep='0.1')
>>> A.clear()

The last line will result in an infinite loop.

Fortunately:

 - the bug is fixed upstream (with commit e90c881)
 - the fix is trivial (see below)
 - a new upstream version with the fix has been released (since version
   1.3)

Thus I see two ways forward:

 1. add the below patch to fix this version
 2. package the new upstream release 1.3

The patch is:

--- a/pygraphviz/agraph.py
+++ b/pygraphviz/agraph.py
@@ -948,9 +948,8 @@
 
     def clear(self):
         """Remove all nodes, edges, and attributes from the graph."""
-        self.edge_attr.clear()
-        self.node_attr.clear()
-        self.graph_attr.clear()
+        self.remove_edges_from(self.edges())
+        self.remove_nodes_from(self.nodes())
         # now "close" existing graph and create a new graph
         name = gv.agnameof(self.handle)
         strict = self.strict


Implementing this fix is important for Debian because networkx, which
used to be able to use the pydot as well as the pygraphviz module for
dot parsing and printing recently lost support for the pydot module (see
#819480). But the package botch relies on the ability of networkx to
handle dot graphs. Thus, until the pydot problem is fixed with networkx,
using pygraphviz as the backend, is the only option for botch.

Furthermore, the pydot backend often proves to be problematic and thus a
switch away from the pydot backend toward the graphviz module backend
would be favourable in general. See for example
https://github.com/networkx/networkx/issues/2050

I would like to switch my package botch over to the graphviz module but
this bug has to be fixed for that.

If you don't have time, then I can also prepare an NMU for this. Would
you like me to?

Thanks!

cheers, josch



-- System Information:
Debian Release: stretch/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.4.0-rc8-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages python3-pygraphviz depends on:
ii  graphviz    2.38.0-12
ii  libc6       2.21-6
ii  libcdt5     2.38.0-12+b2
ii  libcgraph6  2.38.0-12+b2
ii  python3     3.5.1-3

python3-pygraphviz recommends no packages.

Versions of packages python3-pygraphviz suggests:
pn  python-pygraphviz-doc  <none>

-- no debconf information

Reply via email to