1{
2 lib,
3 buildPythonPackage,
4 fetchPypi,
5 fetchpatch,
6 pythonOlder,
7
8 # build-system
9 setuptools,
10
11 # optional-dependencies
12 lxml,
13 matplotlib,
14 numpy,
15 pandas,
16 pydot,
17 pygraphviz,
18 scipy,
19 sympy,
20
21 # tests
22 pytest-xdist,
23 pytestCheckHook,
24
25 # reverse dependency
26 sage,
27}:
28
29buildPythonPackage rec {
30 pname = "networkx";
31 # upgrade may break sage, please test the sage build or ping @timokau on upgrade
32 version = "3.5";
33 pyproject = true;
34
35 disabled = pythonOlder "3.8";
36
37 src = fetchPypi {
38 inherit pname version;
39 hash = "sha256-1Mb5z4H1LWkjCGZ5a4KvvM3sPbeuT70bZep1D+7VADc=";
40 };
41
42 # backport patch to fix tests with Python 3.13.4
43 # FIXME: remove in next update
44 patches = [
45 (fetchpatch {
46 url = "https://github.com/networkx/networkx/commit/d85b04a8b9619580d8901f35400414f612c83113.patch";
47 includes = [ "networkx/generators/lattice.py" ];
48 hash = "sha256-6y/aJBDgNkUzmQ6o52CGVVzqoQgkCEXA4iAXhv1cS0c=";
49 })
50 ];
51
52 nativeBuildInputs = [ setuptools ];
53
54 optional-dependencies = {
55 default = [
56 numpy
57 scipy
58 matplotlib
59 pandas
60 ];
61 extra = [
62 lxml
63 pygraphviz
64 pydot
65 sympy
66 ];
67 };
68
69 passthru.tests = {
70 inherit sage;
71 };
72
73 nativeCheckInputs = [
74 pytest-xdist
75 pytestCheckHook
76 ];
77
78 disabledTests = [
79 # No warnings of type (<class 'DeprecationWarning'>, <class 'PendingDeprecationWarning'>, <class 'FutureWarning'>) were emitted.
80 "test_connected_raise"
81 ];
82
83 meta = {
84 changelog = "https://github.com/networkx/networkx/blob/networkx-${version}/doc/release/release_${version}.rst";
85 homepage = "https://networkx.github.io/";
86 downloadPage = "https://github.com/networkx/networkx";
87 description = "Library for the creation, manipulation, and study of the structure, dynamics, and functions of complex networks";
88 license = lib.licenses.bsd3;
89 };
90}