diff options
author | Jarrod Millman <jarrod.millman@gmail.com> | 2022-06-11 12:44:11 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-11 12:44:11 -0700 |
commit | ec267cff8d092534fb0b2616e8f075142d2cd75b (patch) | |
tree | c8f1bba4e647fb311be6d61f115750260285afff /networkx/drawing | |
parent | 6abae052a75c1020c5dc70162fcd73c71f717f27 (diff) | |
download | networkx-ec267cff8d092534fb0b2616e8f075142d2cd75b.tar.gz |
Add PendingDeprecation for pydot (#5721)
* Add PendingDeprecation for pydot
* Link to tracking issue
Diffstat (limited to 'networkx/drawing')
-rw-r--r-- | networkx/drawing/nx_pydot.py | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/networkx/drawing/nx_pydot.py b/networkx/drawing/nx_pydot.py index bb933485..45115989 100644 --- a/networkx/drawing/nx_pydot.py +++ b/networkx/drawing/nx_pydot.py @@ -19,6 +19,7 @@ See Also - Graphviz: https://www.graphviz.org - DOT Language: http://www.graphviz.org/doc/info/lang.html """ +import warnings from locale import getpreferredencoding import networkx as nx @@ -40,6 +41,13 @@ def write_dot(G, path): Path can be a string or a file handle. """ + msg = ( + "nx.nx_pydot.write_dot depends on the pydot package, which has" + "known issues and is not actively maintained. Consider using" + "nx.nx_agraph.write_dot instead.\n\n" + "See https://github.com/networkx/networkx/issues/5723" + ) + warnings.warn(msg, PendingDeprecationWarning, stacklevel=2) P = to_pydot(G) path.write(P.to_string()) return @@ -70,6 +78,14 @@ def read_dot(path): """ import pydot + msg = ( + "nx.nx_pydot.read_dot depends on the pydot package, which has" + "known issues and is not actively maintained. Consider using" + "nx.nx_agraph.read_dot instead.\n\n" + "See https://github.com/networkx/networkx/issues/5723" + ) + warnings.warn(msg, PendingDeprecationWarning, stacklevel=2) + data = path.read() # List of one or more "pydot.Dot" instances deserialized from this file. @@ -102,6 +118,13 @@ def from_pydot(P): >>> G = nx.Graph(nx.nx_pydot.from_pydot(A)) """ + msg = ( + "nx.nx_pydot.from_pydot depends on the pydot package, which has" + "known issues and is not actively maintained.\n\n" + "See https://github.com/networkx/networkx/issues/5723" + ) + warnings.warn(msg, PendingDeprecationWarning, stacklevel=2) + if P.get_strict(None): # pydot bug: get_strict() shouldn't take argument multiedges = False else: @@ -195,6 +218,13 @@ def to_pydot(N): """ import pydot + msg = ( + "nx.nx_pydot.to_pydot depends on the pydot package, which has" + "known issues and is not actively maintained.\n\n" + "See https://github.com/networkx/networkx/issues/5723" + ) + warnings.warn(msg, PendingDeprecationWarning, stacklevel=2) + # set Graphviz graph type if N.is_directed(): graph_type = "digraph" @@ -316,6 +346,14 @@ def graphviz_layout(G, prog="neato", root=None): ----- This is a wrapper for pydot_layout. """ + msg = ( + "nx.nx_pydot.graphviz_layout depends on the pydot package, which has" + "known issues and is not actively maintained. Consider using" + "nx.nx_agraph.graphviz_layout instead.\n\n" + "See https://github.com/networkx/networkx/issues/5723" + ) + warnings.warn(msg, PendingDeprecationWarning, stacklevel=2) + return pydot_layout(G=G, prog=prog, root=root) @@ -359,6 +397,12 @@ def pydot_layout(G, prog="neato", root=None): """ import pydot + msg = ( + "nx.nx_pydot.pydot_layout depends on the pydot package, which has" + "known issues and is not actively maintained.\n\n" + "See https://github.com/networkx/networkx/issues/5723" + ) + warnings.warn(msg, PendingDeprecationWarning, stacklevel=2) P = to_pydot(G) if root is not None: P.set("root", str(root)) |