Repository navigation
Expand file tree
/
Copy pathpyproject.toml
More file actions
291 lines (269 loc) · 12.3 KB
/
Copy pathpyproject.toml
File metadata and controls
291 lines (269 loc) · 12.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
[build-system]
build-backend = "setuptools.build_meta"
requires = ["setuptools >=77", "setuptools-git-versioning"]
[project]
name = "graphblas-algorithms"
dynamic = ["version"]
description = "Graph algorithms written in GraphBLAS and backend for NetworkX"
readme = "README.md"
requires-python = ">=3.11"
# PEP 639 expression; setuptools >=77 rejects it beside a "License ::" classifier.
license = "Apache-2.0"
license-files = ["LICENSE"]
authors = [
{ name = "Erik Welch", email = "erik.n.welch@gmail.com" },
{ name = "Jim Kitchen" },
{ name = "Graphblas-algorithms contributors" },
]
maintainers = [
{ name = "Erik Welch", email = "erik.n.welch@gmail.com" },
{ name = "Jim Kitchen", email = "jim22k@gmail.com" },
]
keywords = [
"graphblas",
"graph",
"sparse",
"matrix",
"lagraph",
"suitesparse",
"Networks",
"Graph Theory",
"Mathematics",
"network",
"discrete mathematics",
"math",
]
classifiers = [
"Development Status :: 4 - Beta",
"Operating System :: MacOS :: MacOS X",
"Operating System :: POSIX :: Linux",
"Operating System :: Microsoft :: Windows",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Programming Language :: Python :: 3.15",
"Programming Language :: Python :: 3 :: Only",
"Intended Audience :: Developers",
"Intended Audience :: Other Audience",
"Intended Audience :: Science/Research",
"Topic :: Scientific/Engineering",
"Topic :: Scientific/Engineering :: Bio-Informatics",
"Topic :: Scientific/Engineering :: Information Analysis",
"Topic :: Scientific/Engineering :: Mathematics",
"Topic :: Scientific/Engineering :: Physics",
"Topic :: Software Development :: Libraries :: Python Modules",
]
# python-graphblas converts a NetworkX graph through a scipy sparse array. 1.11.2 is the scipy
# floor NetworkX 3.6.1 declares, above python-graphblas's own.
dependencies = ["python-graphblas >=2026.11.0", "scipy >=1.11.2"]
[project.entry-points."networkx.backends"]
graphblas = "graphblas_algorithms.interface:Dispatcher"
[project.entry-points."networkx.backend_info"]
graphblas = "_nx_graphblas:get_info"
[project.urls]
homepage = "https://github.com/python-graphblas/graphblas-algorithms"
# documentation = "https://graphblas-algorithms.readthedocs.io"
repository = "https://github.com/python-graphblas/graphblas-algorithms"
changelog = "https://github.com/python-graphblas/graphblas-algorithms/releases"
[project.optional-dependencies]
test = [
"pytest",
"pytest-xdist",
"networkx >=3.6",
"rich", # scripts/maketree.py, which the generated-code freshness test runs
"scipy >=1.11.2",
"setuptools",
]
all = ["graphblas-algorithms[test]"]
[tool.setuptools]
# Let's be explicit (we test this too)
# TODO: it would be nice if setuptools (or our build backend) could handle this automatically and reliably.
# $ python -c 'from setuptools import find_packages ; [print(x) for x in sorted(find_packages())]'
# $ find graphblas_algorithms/ -name __init__.py -print | sort | sed -e 's/\/__init__.py//g' -e 's/\//./g'
# $ python -c 'import tomllib ; [print(x) for x in sorted(tomllib.load(open("pyproject.toml", "rb"))["tool"]["setuptools"]["packages"])]'
packages = [
"_nx_graphblas",
"graphblas_algorithms",
"graphblas_algorithms.algorithms",
"graphblas_algorithms.algorithms.centrality",
"graphblas_algorithms.algorithms.community",
"graphblas_algorithms.algorithms.components",
"graphblas_algorithms.algorithms.isomorphism",
"graphblas_algorithms.algorithms.link_analysis",
"graphblas_algorithms.algorithms.operators",
"graphblas_algorithms.algorithms.shortest_paths",
"graphblas_algorithms.algorithms.tests",
"graphblas_algorithms.algorithms.traversal",
"graphblas_algorithms.classes",
"graphblas_algorithms.generators",
"graphblas_algorithms.linalg",
"graphblas_algorithms.nxapi",
"graphblas_algorithms.nxapi.centrality",
"graphblas_algorithms.nxapi.community",
"graphblas_algorithms.nxapi.components",
"graphblas_algorithms.nxapi.generators",
"graphblas_algorithms.nxapi.isomorphism",
"graphblas_algorithms.nxapi.linalg",
"graphblas_algorithms.nxapi.link_analysis",
"graphblas_algorithms.nxapi.operators",
"graphblas_algorithms.nxapi.shortest_paths",
"graphblas_algorithms.nxapi.tests",
"graphblas_algorithms.nxapi.traversal",
"graphblas_algorithms.tests",
"graphblas_algorithms.utils",
]
[tool.setuptools-git-versioning]
enabled = true
dev_template = "{tag}+{ccount}.g{sha}"
dirty_template = "{tag}+{ccount}.g{sha}.dirty"
[tool.black]
line-length = 100
# No "py315" yet, as in python-graphblas: a black that does not know a listed version refuses
# to run on this project, and conda-forge's black for Python 3.15 is still 26.1 (black 26.5, the
# first to know py315, needs a pytokens with no 3.15 build there as of 2026-11).
target-version = ["py311", "py312", "py313", "py314"]
[tool.isort]
sections = ["FUTURE", "STDLIB", "THIRDPARTY", "FIRSTPARTY", "LOCALFOLDER"]
profile = "black"
skip_gitignore = true
float_to_top = true
default_section = "THIRDPARTY"
known_first_party = "graphblas_algorithms"
line_length = 100
skip = ["graphblas_algorithms/nxapi/__init__.py", "scripts/bench.py"]
[tool.pytest.ini_options]
minversion = "6.0"
testpaths = "graphblas_algorithms"
xfail_strict = false
addopts = [
"--strict-config", # Force error if config is misspelled
"--strict-markers", # Force error if a marker is misspelled or otherwise unregistered
"-ra", # Print summary of all fails/errors
]
[tool.codespell]
# "THIRDPARTY" is an isort section name, not a misspelling.
ignore-words-list = "thirdparty"
[tool.coverage.run]
branch = true
source = ["graphblas_algorithms", "_nx_graphblas"]
omit = []
[tool.coverage.report]
ignore_errors = false
precision = 1
fail_under = 0
skip_covered = true
skip_empty = true
exclude_lines = ["pragma: no cover", "raise AssertionError", "raise NotImplementedError"]
[tool.ruff]
# https://docs.astral.sh/ruff/
line-length = 100
target-version = "py311"
[tool.ruff.lint]
unfixable = [
"F841", # unused-variable (Note: can leave useless expression)
]
select = ["ALL"]
external = [
# noqa codes that ruff doesn't know about: https://docs.astral.sh/ruff/settings/#lint_external
]
ignore = [
# Would be nice to fix these
"D100", # Missing docstring in public module
"D101", # Missing docstring in public class
"D102", # Missing docstring in public method
"D103", # Missing docstring in public function
"D104", # Missing docstring in public package
"D105", # Missing docstring in magic method
# "D107", # Missing docstring in `__init__`
"D401", # First line of docstring should be in imperative mood:
# "D417", # Missing argument description in the docstring:
"PLE0605", # Invalid format for `__all__`, must be `tuple` or `list` (Note: broken in v0.0.237)
# Maybe consider
# "SIM300", # Yoda conditions are discouraged, use ... instead (Note: we're not this picky)
# "SIM401", # Use dict.get ... instead of if-else-block (Note: if-else better for coverage and sometimes clearer)
# "TRY004", # Prefer `TypeError` exception for invalid type (Note: good advice, but not worth the nuisance)
# "B904", # Use `raise from` to specify exception cause (Note: sometimes okay to raise original exception)
# Intentionally ignored
"COM812", # Trailing comma missing
"D203", # 1 blank line required before class docstring (Note: conflicts with D211, which is preferred)
"D400", # First line should end with a period (Note: prefer D415, which also allows "?" and "!")
"E721", # Use `is` for type comparisons (Note: we compare dtypes, where `==` is the intended check)
"F403", # `from .classes import *` used; unable to detect undefined names (Note: used to match networkx)
"N802", # Function name ... should be lowercase
"N803", # Argument name ... should be lowercase (Maybe okay, except in tests)
"N806", # Variable ... in function should be lowercase
"N807", # Function name should not start and end with `__`
"N818", # Exception name ... should be named with an Error suffix (Note: good advice)
"PLC0415", # `import` should be at top-level (Note: deferred imports avoid import cycles)
"PLR0911", # Too many return statements
"PLR0912", # Too many branches
"PLR0913", # Too many arguments to function call
"PLR0917", # Too many positional arguments
"PLR0915", # Too many statements
"PLR2004", # Magic number used in comparison, consider replacing magic with a constant variable
"PLW1641", # Object does not implement `__hash__` (Note: our mapping and set classes are mutable)
"PLW2901", # Outer for loop variable ... overwritten by inner assignment target (Note: good advice, but too strict)
"RET502", # Do not implicitly `return None` in function able to return non-`None` value
"RET503", # Missing explicit `return` at the end of function able to return non-`None` value
"RET504", # Unnecessary variable assignment before `return` statement
"RUF012", # Mutable class attributes should be annotated with `typing.ClassVar` (Note: no annotations yet)
"RUF021", # parenthesize-chained-operators (Note: its fix pushes lines past flake8's length limit)
"RUF046", # Value being cast is already the right type (Note: `int(round(x))` says what it means)
"RUF059", # Unpacked variable is never used (Note: we unpack shapes and index pairs and use one half)
"S110", # `try`-`except`-`pass` detected, consider logging the exception (Note: good advice, but we don't log)
"S112", # `try`-`except`-`continue` detected, consider logging the exception (Note: good advice, but we don't log)
"SIM102", # Use a single `if` statement instead of nested `if` statements (Note: often necessary)
"SIM103", # Return the condition directly (Note: the explicit branches read better here)
"SIM105", # Use contextlib.suppress(...) instead of try-except-pass (Note: try-except-pass is much faster)
"SIM108", # Use ternary operator ... instead of if-else-block (Note: if-else better for coverage and sometimes clearer)
"TRY003", # Avoid specifying long messages outside the exception class (Note: why?)
# Ignored categories
"C90", # mccabe (Too strict, but maybe we should make things less complex)
"CPY", # flake8-copyright (We don't put a copyright header in every file)
"I", # isort (Should we replace `isort` with this?)
"ANN", # flake8-annotations (We don't use annotations yet)
"BLE", # flake8-blind-except (Maybe consider)
"FBT", # flake8-boolean-trap (Why?)
"DJ", # flake8-django (We don't use django)
"EM", # flake8-errmsg (Perhaps nicer, but too much work)
"ICN", # flake8-import-conventions (Doesn't allow "_" prefix such as `_np`)
"PYI", # flake8-pyi (We don't have stub files yet)
"SLF", # flake8-self (We can use our own private variables, sheesh!)
"TID", # flake8-tidy-imports (Rely on isort and our own judgement)
"TC", # flake8-type-checking (Note: figure out type checking later)
"ARG", # flake8-unused-arguments (Sometimes helpful, but too strict)
"TD", # flake8-todos (Maybe okay to add some of these)
"FIX", # flake8-fixme (like flake8-todos)
"ERA", # eradicate (We like code in comments!)
"PD", # pandas-vet (Intended for scripts that use pandas, not libraries)
]
[tool.ruff.lint.per-file-ignores]
"__init__.py" = ["F401"] # Allow unused imports (w/o defining `__all__`)
"_nx_graphblas/__init__.py" = ["E501"] # Generated; one line per parameter description
"_nx_graphblas/core.py" = ["T201"] # Printing is how this reports what it regenerated
"graphblas_algorithms/**/tests/*py" = [
"S101",
"T201",
"D103",
"D100",
] # Allow assert, print, and no docstring
"graphblas_algorithms/interface.py" = ["PIE794"] # Allow us to use `mod = nxapi.<module>` repeatedly
"graphblas_algorithms/nxapi/exception.py" = ["F401"] # Allow unused imports (w/o defining `__all__`)
"scripts/*.py" = [
"INP001", # Not a package
"S101", # Allow assert
"S113", # requests without a timeout (Note: these are interactive download helpers)
"SIM115", # Allow opening a file without a context manager
"T201", # Allow print
"FURB", # refurb (Note: too opinionated for one-off scripts)
]
[tool.ruff.lint.flake8-builtins]
builtins-ignorelist = ["copyright"]
[tool.ruff.lint.flake8-pytest-style]
fixture-parentheses = false
mark-parentheses = false
[tool.ruff.lint.pydocstyle]
convention = "numpy"