diff options
| author | Jarrod Millman <jarrod.millman@gmail.com> | 2020-12-10 15:56:04 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-12-10 15:56:04 -0800 |
| commit | afc59cbcb5f5c60ea2a2d856c7fb2fd4e0473164 (patch) | |
| tree | f2606e2c0cdc1388029501842f720d0bf64b6047 | |
| parent | 557e25f9af27f64754c380fd3d3086282c2197a4 (diff) | |
| download | networkx-afc59cbcb5f5c60ea2a2d856c7fb2fd4e0473164.tar.gz | |
Deprecate jit (#4428)
* Remove example
* Deprecate jit_graph / jit_data
| -rw-r--r-- | doc/developer/deprecations.rst | 7 | ||||
| -rw-r--r-- | doc/release/release_dev.rst | 3 | ||||
| -rw-r--r-- | examples/external/plot_jit.py | 37 | ||||
| -rw-r--r-- | networkx/conftest.py | 2 | ||||
| -rw-r--r-- | networkx/readwrite/json_graph/jit.py | 14 |
5 files changed, 22 insertions, 41 deletions
diff --git a/doc/developer/deprecations.rst b/doc/developer/deprecations.rst index b1b60881..7f5c19f5 100644 --- a/doc/developer/deprecations.rst +++ b/doc/developer/deprecations.rst @@ -61,10 +61,11 @@ Version 3.0 * In ``readwrite/json_graph/cytoscape.py``, change function signature for ``cytoscape_graph`` and ``cytoscape_data`` to replace the ``attrs`` keyword. argument with explicit ``name`` and ``ident`` keyword args. -* Remove ``networkx/readwrite/nx_yaml.py`` and related tests. -* Remove ``networkx/readwrite/gpickle.py`` and related tests. -* Remove ``networkx/readwrite/nx_shp.py`` and related tests (add info in alternatives). +* Remove ``readwrite/nx_yaml.py`` and related tests. +* Remove ``readwrite/gpickle.py`` and related tests. +* Remove ``readwrite/nx_shp.py`` and related tests (add info in alternatives). * Remove ``copy`` method in the coreview Filtered-related classes and related tests. * In ``algorithms/link_analysis/pagerank_alg.py`` replace ``pagerank`` with ``pagerank_scipy``. * In ``algorithms/link_analysis/pagerank_alg.py`` rename ``pagerank_numpy`` as ``_pagerank_numpy``. * In ``convert_matrix.py`` remove ``order`` kwarg from ``to_pandas_edgelist`` and docstring +* Remove ``readwrite/json_graph/jit.py`` and related tests. diff --git a/doc/release/release_dev.rst b/doc/release/release_dev.rst index 81f9b5a3..9d651bb8 100644 --- a/doc/release/release_dev.rst +++ b/doc/release/release_dev.rst @@ -72,7 +72,8 @@ Deprecations Deprecate ``copy`` method in the coreview Filtered-related classes. - [`#4384 <https://github.com/networkx/networkx/pull/4384>`_] Deprecate unused ``order`` parameter in to_pandas_edgelist. - +- [`#4428 <https://github.com/networkx/networkx/pull/4428>`_] + Deprecate ``jit_data`` and ``jit_graph``. Contributors to this release ---------------------------- diff --git a/examples/external/plot_jit.py b/examples/external/plot_jit.py deleted file mode 100644 index e78c46dd..00000000 --- a/examples/external/plot_jit.py +++ /dev/null @@ -1,37 +0,0 @@ -""" -================================ -JavaScript InfoVis Toolkit (JIT) -================================ - -An example showing how to use the JavaScript InfoVis Toolkit (JIT) -JSON export - -See the JIT documentation and examples at https://philogb.github.io/jit/ -""" - -import json - -import matplotlib.pyplot as plt -import networkx as nx - -# add some nodes to a graph -G = nx.Graph() - -G.add_node("one", type="normal") -G.add_node("two", type="special") -G.add_node("solo") - -# add edges -G.add_edge("one", "two") -G.add_edge("two", 3, type="extra special") - -# convert to JIT JSON -jit_json = nx.jit_data(G, indent=4) -print(jit_json) - -X = nx.jit_graph(json.loads(jit_json)) -print(f"Nodes: {list(X.nodes(data=True))}") -print(f"Edges: {list(X.edges(data=True))}") - -nx.draw(G, pos=nx.planar_layout(G), with_labels=True) -plt.show() diff --git a/networkx/conftest.py b/networkx/conftest.py index 64d8ea4c..781b3cde 100644 --- a/networkx/conftest.py +++ b/networkx/conftest.py @@ -99,6 +99,8 @@ def set_warnings(): warnings.filterwarnings( "ignore", category=DeprecationWarning, message="FilterMultiInner.copy" ) + warnings.filterwarnings("ignore", category=DeprecationWarning, message="jit_data") + warnings.filterwarnings("ignore", category=DeprecationWarning, message="jit_graph") @pytest.fixture(autouse=True) diff --git a/networkx/readwrite/json_graph/jit.py b/networkx/readwrite/json_graph/jit.py index 77e9c1ee..430a5162 100644 --- a/networkx/readwrite/json_graph/jit.py +++ b/networkx/readwrite/json_graph/jit.py @@ -27,6 +27,7 @@ var json = [ """ import json +import warnings import networkx as nx from networkx.utils.decorators import not_implemented_for @@ -46,7 +47,14 @@ def jit_graph(data, create_using=None): Returns ------- G : NetworkX Graph built from create_using if provided. + + .. deprecated:: 2.6 """ + warnings.warn( + ("jit_graph is deprecated and will be removed in NetworkX 3.0."), + DeprecationWarning, + ) + if create_using is None: G = nx.Graph() else: @@ -85,7 +93,13 @@ def jit_data(G, indent=None, default=None): Returns ------- data: JIT JSON string + + .. deprecated:: 2.6 """ + warnings.warn( + ("jit_data is deprecated and will be removed in NetworkX 3.0."), + DeprecationWarning, + ) json_graph = [] for node in G.nodes(): json_node = {"id": node, "name": node} |
