Deprecations#
Policy#
If the behavior of the library has to be changed, a deprecation cycle must be followed to warn users.
A deprecation cycle is not necessary when:
adding a new function, or
adding a new keyword argument to the end of a function signature, or
fixing buggy behavior
A deprecation cycle is necessary for any breaking API change, meaning a change where the function, invoked with the same arguments, would return a different result after the change. This includes:
changing the order of arguments or keyword arguments, or
adding arguments or keyword arguments to a function, or
changing the name of a function, class, method, etc., or
moving a function, class, etc. to a different module, or
changing the default value of a function’s arguments.
Usually, our policy is to put in place a deprecation cycle over two minor releases (e.g., if a deprecation warning appears in 2.3, then the functionality should be removed in 2.5). For major releases we usually require that all deprecations have at least a 1-release deprecation cycle (e.g., if 3.0 occurs after 2.5, then all removed functionality in 3.0 should be deprecated in 2.5).
Note that these 1- and 2-release deprecation cycles for major and minor releases is not a strict rule and in some cases, the developers can agree on a different procedure upon justification (like when we can’t detect the change, or it involves moving or deleting an entire function for example).
Todo#
Make sure to review networkx/conftest.py after removing deprecated code.
Version 3.0#
In
readwrite/gml.pyremoveliteral_stringizerand related tests.In
readwrite/gml.pyremoveliteral_destringizerand related tests.In
utils/misc.pyremoveis_string_likeand related tests.In
utils/misc.pyremovemake_strand related tests.In
utils/misc.pyremoveis_iterator.In
utils/misc.pyremoveiterable.In
utils/misc.pyremoveis_list_of_ints.In
utils/misc.pyremoveconsume.In
utils/misc.pyremovedefault_opener.In
utils/misc.pyremoveempty_generator.Remove
utils/contextmanagers.pyand related tests.In
drawing/nx_agraph.pyremovedisplay_pygraphvizand related tests.In
algorithms/chordal.pyreplacechordal_graph_cliqueswith_chordal_graph_cliques.In
algorithms/centrality/betweenness_centrality_subset.pyremovebetweenness_centrality_source.In
algorithms/centrality/betweenness.pyremoveedge_betweeness.In
algorithms/community_modularity_max.pyremove old name_naive_greedy_modularity_communities.In
linalg/algebraicconnectivity.pyremove_CholeskySolverand related code.In
convert_matrix.pyremoveto_numpy_matrixandfrom_numpy_matrix.In
readwrite/json_graph/cytoscape.py, change function signature forcytoscape_graphandcytoscape_datato replace theattrskeyword. argument with explicitnameandidentkeyword args.In
readwrite/json_graph/tree.py, removeattrskwarg fromtree_graphandtree_data.Undo changes related to the removal of
pyyaml. Remove the__getattr__definitions fromnetworkx/__init__.py,networkx/readwrite/__init__.pyandnetworkx/readwrite/nx_yaml.pyand removenetworkx/readwrite/tests/test_getattr_nxyaml_removal.pyRemove
readwrite/gpickle.pyand related tests.Remove
readwrite/nx_shp.pyand related tests (add info in alternatives).Remove
copymethod in the coreview Filtered-related classes and related tests.In
algorithms/link_analysis/pagerank_alg.pyreplacepagerankwithpagerank_scipy.In
algorithms/link_analysis/pagerank_alg.pyrenamepagerank_numpyas_pagerank_numpy.In
convert_matrix.pyremoveorderkwarg fromto_pandas_edgelistand docstringRemove
readwrite/json_graph/jit.pyand related tests.In
utils/misc.pyremovegenerate_unique_nodeand related tests.In
algorithms/link_analysis/hits_alg.pyremovehub_matrixandauthority_matrixIn
algorithms/link_analysis/hits_alg.py, removehits_numpyandhist_scipy.In
classesremove theorderedmodule and the fourOrderedclasses defined therein.In
utils/decorators.pyremovepreserve_random_state.In
algorithms/community/quality.pyremovecoverageandperformance.Remove
testing.In
linalg/graphmatrix.pyremoveadj_matrix.In
algorithms/similarity.pyreplacesimrank_similaritywithsimrank_similarity_numpy.In
algorithms/assortativity/mixing.pyremovenumeric_mixing_matrix.In
algorithms/assortativity/connectivity.pyremovek_nearest_neighbors.In
utils/decorators.pyremoverandom_state.In
algorithms/operators/binary.pyremovenamekwarg fromunionand docstring.In
generators/geometric.pyremoveeuclideanand tests.In
algorithms/node_classification/removehmn.py,lgc.py, andutils.pyafter moving the functions defined therein into the newly creatednode_classification.pymodule, which will replace the current package.In
algorithms/link_analysis/pagerank_alg.py, remove thenp.asmatrixwrappers on the return values ofgoogle_matrixand remove the associated FutureWarning.In
convert_matrix.pyremovefrom_scipy_sparse_matrixandto_scipy_sparse_matrix.In
linalg/attrmatrix.pyremove the FutureWarning, update the return type by removingnp.asmatrix, and update the docstring to reflect that the function returns anumpy.ndarrayinstance.In
generators/small.pyremovemake_small_graphandmake_small_undirected_graph.In
convert_matrix.pyremoveto_numpy_recarray.In
classes/function.pyremoveinfo.In
algorithms/community/modularity_max.py, remove the deprecatedn_communitiesparameter from thegreedy_modularity_communitiesfunction.In
algorithms/distance_measures.pyremoveextrema_bounding.In
utils/misc.pyremovedict_to_numpy_array1anddict_to_numpy_array2.In
utils/misc.pyremoveto_tuple.In
algorithms/matching.py, remove parametermaxcardinalityfrommin_weight_matching.In
drawing/nx_pydot.py, change PendingDeprecationWarning to DeprecationWarning.
Version 3.2#
In
generators/directed.pyremove thecreate_usingkeyword argument for thescale_free_graphfunction.Remove pydot functionality
drawing/nx_pydot.py, if pydot is still not being maintained. See #5723In
readwrite/json_graph/node_link.pyremove theattrs` keyword code and docstring in ``node_link_dataandnode_link_graph. Also the associated tests.