summaryrefslogtreecommitdiff
path: root/CONTRIBUTING.rst
diff options
context:
space:
mode:
authorJarrod Millman <jarrod.millman@gmail.com>2020-12-07 18:03:58 -0800
committerGitHub <noreply@github.com>2020-12-07 21:03:58 -0500
commit831705dba1a2536ecf3b874da3510bead62ff489 (patch)
treef55143be2ef0b48b2901a721e08e1107a3f9db5e /CONTRIBUTING.rst
parentb8ca636525e12f13a491c3d738c965fe1ce7851c (diff)
downloadnetworkx-831705dba1a2536ecf3b874da3510bead62ff489.tar.gz
Standard imports (#4401)
* Standardize pytest imports * Standardize numpy/scipy imports * Document import style * Fix * More * Fix matplotlib imports * Revert changes to tests * Motivate import policy Co-authored-by: Ross Barnowski <rossbar@berkeley.edu> * Fix missed imports * Standard np.testing use Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
Diffstat (limited to 'CONTRIBUTING.rst')
-rw-r--r--CONTRIBUTING.rst16
1 files changed, 16 insertions, 0 deletions
diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst
index 31dbf844..70ed6d47 100644
--- a/CONTRIBUTING.rst
+++ b/CONTRIBUTING.rst
@@ -246,6 +246,22 @@ Guidelines
import pandas as pd
import networkx as nx
+ After importing `sp`` for ``scipy``::
+
+ import scipy as sp
+
+ use the following imports::
+
+ import scipy.linalg # call as sp.linalg
+ import scipy.sparse # call as sp.sparse
+ import scipy.sparse.linalg # call as sp.sparse.linalg
+ import scipy.stats # call as sp.stats
+ import scipy.optimize # call as sp.optimize
+
+ For example, many libraries have a ``linalg`` subpackage: ``nx.linalg``,
+ ``np.linalg``, ``sp.linalg``, ``sp.sparse.linalg``. The above import
+ pattern makes the origin of any particular instance of ``linalg`` explicit.
+
* Use the decorator ``not_implemented_for`` in ``networkx/utils/decorators.py``
to designate that a function doesn't accept 'directed', 'undirected',
'multigraph' or 'graph'. The first argument of the decorated function should