Skip to content

Commit

Permalink
Merge branch 'networkx:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
mdealencar committed Jan 5, 2024
2 parents ad8ff06 + 5d2f19b commit cb401b0
Show file tree
Hide file tree
Showing 8 changed files with 5 additions and 53 deletions.
1 change: 0 additions & 1 deletion doc/developer/deprecations.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ Make sure to review ``networkx/conftest.py`` after removing deprecated code.

Version 3.3
~~~~~~~~~~~
* Remove pydot functionality ``drawing/nx_pydot.py``, if pydot is still not being maintained. See #5723
* Remove the ``forest_str`` function from ``readwrite/text.py``. Replace
existing usages with ``write_network_text``.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,7 @@ def test_connected_raise(self):
with pytest.raises(NetworkXNotImplemented):
next(nx.kosaraju_strongly_connected_components(G))
with pytest.raises(NetworkXNotImplemented):
with pytest.deprecated_call():
next(nx.strongly_connected_components_recursive(G))
next(nx.strongly_connected_components_recursive(G))
pytest.raises(NetworkXNotImplemented, nx.is_strongly_connected, G)
pytest.raises(NetworkXNotImplemented, nx.condensation, G)

Expand Down
3 changes: 0 additions & 3 deletions networkx/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,6 @@ def pytest_collection_modifyitems(config, items):
# TODO: The warnings below need to be dealt with, but for now we silence them.
@pytest.fixture(autouse=True)
def set_warnings():
warnings.filterwarnings(
"ignore", category=DeprecationWarning, message="nx.nx_pydot"
)
warnings.filterwarnings(
"ignore",
category=FutureWarning,
Expand Down
43 changes: 0 additions & 43 deletions networkx/drawing/nx_pydot.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
- 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
Expand All @@ -41,13 +40,6 @@ 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, DeprecationWarning, stacklevel=2)
P = to_pydot(G)
path.write(P.to_string())
return
Expand Down Expand Up @@ -79,14 +71,6 @@ 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, DeprecationWarning, stacklevel=2)

data = path.read()

# List of one or more "pydot.Dot" instances deserialized from this file.
Expand Down Expand Up @@ -120,12 +104,6 @@ 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, DeprecationWarning, stacklevel=2)

if P.get_strict(None): # pydot bug: get_strict() shouldn't take argument
multiedges = False
Expand Down Expand Up @@ -220,13 +198,6 @@ 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, DeprecationWarning, stacklevel=2)

# set Graphviz graph type
if N.is_directed():
graph_type = "digraph"
Expand Down Expand Up @@ -348,14 +319,6 @@ 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, DeprecationWarning, stacklevel=2)

return pydot_layout(G=G, prog=prog, root=root)


Expand Down Expand Up @@ -399,12 +362,6 @@ 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, DeprecationWarning, stacklevel=2)
P = to_pydot(G)
if root is not None:
P.set("root", str(root))
Expand Down
3 changes: 2 additions & 1 deletion networkx/drawing/tests/test_agraph.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Unit tests for PyGraphviz interface."""
import os
import tempfile
import warnings

import pytest

Expand Down Expand Up @@ -249,6 +250,6 @@ def test_no_warnings_raised(self):
G.add_node(0, pos=(0, 0))
G.add_node(1, pos=(1, 1))
A = nx.nx_agraph.to_agraph(G)
with pytest.warns(None) as record:
with warnings.catch_warnings(record=True) as record:
A.layout()
assert len(record) == 0
1 change: 0 additions & 1 deletion networkx/drawing/tests/test_pydot.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
pydot = pytest.importorskip("pydot")


@pytest.mark.xfail
class TestPydot:
def pydot_checks(self, G, prog):
"""
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ doc = [
extra = [
'lxml>=4.6',
'pygraphviz>=1.11',
'pydot>=1.4.2',
'pydot>=2.0',
'sympy>=1.10',
]
test = [
Expand Down
2 changes: 1 addition & 1 deletion requirements/extra.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
# Do not edit this file; modify pyproject.toml instead.
lxml>=4.6
pygraphviz>=1.11
pydot>=1.4.2
pydot>=2.0
sympy>=1.10

0 comments on commit cb401b0

Please sign in to comment.