-
Notifications
You must be signed in to change notification settings - Fork 105
Expand file tree
/
Copy pathpyproject.toml
More file actions
325 lines (297 loc) · 9 KB
/
pyproject.toml
File metadata and controls
325 lines (297 loc) · 9 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
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
[build-system]
requires = ["hatchling", "hatch-vcs", "numpy"]
build-backend = "hatchling.build"
[project]
name = "pyphi"
dynamic = ["version"]
description = "A package for integrated information theory"
readme = "README.md"
license = { text = "GNU General Public License v3 or later (GPLv3+)" }
authors = [{ name = "William GP Mayner", email = "wmayner@gmail.com" }]
keywords = [
"neuroscience",
"causality",
"causal-modeling",
"causation",
"integrated-information-theory",
"iit",
"integrated-information",
"modeling",
]
requires-python = ">=3.12"
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Natural Language :: English",
"License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Topic :: Scientific/Engineering",
]
dependencies = [
"Graphillion>=1.5",
"joblib>=0.8.0",
"more_itertools>=8.13.0",
"numpy",
"ordered-set>=4.0.2",
"pandas>=2.0.0",
"psutil>=2.1.1",
"pyyaml>=3.13",
"scipy>=0.13.3",
"tblib>=1.3.2",
"toolz>=0.9.0",
"tqdm>=4.20.0",
]
[project.optional-dependencies]
# Note: Single-machine parallelization uses stdlib ProcessPoolExecutor - no extra deps needed.
# The 'cluster' extra will be available in v2.0 for Dask-based cluster support.
# cluster = ["dask[distributed]>=2024.1.0", "dask-jobqueue>=0.8.0"]
visualize = ["matplotlib", "networkx>=2.6.2", "plotly>=5.8.2", "seaborn"]
graphs = ["igraph>=0.9.10", "networkx>=2.6.2"]
caching = ["redis>=2.10.5"]
emd = ["pyemd>=0.3.0"]
[dependency-groups]
dev = [
"asv",
"build",
"coverage",
"hypothesis",
"pre-commit",
"pytest-cov",
"pyright>=1.1.407",
"pytest<8.0.0",
"pytest-lazy-fixture",
"ruff",
"sphinx",
"sphinx-rtd-theme",
"towncrier>=24.8.0",
"twine",
"watchdog",
]
[project.urls]
documentation = "https://pyphi.readthedocs.io"
bugs = "https://github.com/wmayner/pyphi/issues"
homepage = "http://integratedinformationtheory.org/"
discussion = "https://groups.google.com/forum/#!forum/pyphi-users"
[tool.hatch.version]
source = "vcs"
[tool.hatch.build.targets.sdist]
include = [
"README.md",
"INSTALLATION.rst",
"CACHING.rst",
"LICENSE.md",
"CHANGELOG.md",
"pyphi_config.yml",
"redis.conf",
"pyphi/data/**",
]
[tool.hatch.build.targets.wheel]
packages = ["pyphi"]
include = ["pyphi/data/**"]
[tool.ruff]
line-length = 89
target-version = "py312"
exclude = [
"__pycache__",
"__pyphi_cache__",
".cache",
".git",
".coverage",
"build",
"dist",
"docs",
"htmlcov",
"benchmarks",
]
[tool.ruff.lint]
select = [
"E", # pycodestyle errors
"W", # pycodestyle warnings
"F", # pyflakes
"I", # isort
"B", # flake8-bugbear
"C4", # flake8-comprehensions
"C90", # mccabe complexity
"UP", # pyupgrade
"T20", # flake8-print
"TID", # flake8-tidy-imports
"SIM", # flake8-simplify
"RET", # flake8-return
"ARG", # flake8-unused-arguments
"PTH", # flake8-use-pathlib
"ERA", # eradicate (commented-out code)
"PL", # pylint
"PERF", # perflint (performance anti-patterns)
"RUF", # Ruff-specific rules
]
ignore = [
# Relax some rules for scientific computing
"PLR0913", # Too many arguments - common in scientific functions
"PLR0912", # Too many branches - common in complex algorithms
"PLR0915", # Too many statements - common in scientific code
"PLR2004", # Magic value comparisons - common with thresholds
"PLW1641", # Missing __hash__ - not needed for all Orderable classes
"RET504", # Unnecessary variable assignment before return
"SIM108", # Use ternary operator - sometimes less readable
"PTH123", # open() instead of Path.open() - open() is fine
"ERA001", # Commented-out code - allow for scientific exploration
"PLC0415", # Import outside top-level - needed for optional dependencies
]
[tool.ruff.lint.mccabe]
max-complexity = 88
[tool.ruff.lint.isort]
known-first-party = ["pyphi"]
force-single-line = true
[tool.ruff.lint.pylint]
# Increased limits for scientific computing
max-args = 10
max-branches = 20
max-statements = 100
[tool.ruff.lint.per-file-ignores]
# Allow certain rules in test files
"test/**/*.py" = [
"ARG001", # Unused function arguments (fixtures)
"PLR0913", # Too many arguments (test parametrization)
"PLR2004", # Magic values (test data)
"S101", # Use of assert (standard in pytest)
"T201", # Print statements (debugging)
"T203", # Pretty print statements (debugging)
]
# Allow print statements in main init (welcome message) and profiling scripts
"pyphi/__init__.py" = ["T201"]
"profiling/**/*.py" = ["T201"]
# Allow print and magic values in examples
"docs/examples/**/*.py" = ["T201", "PLR2004"]
# Allow explicit re-exports in __init__ files (PEP 484 style)
"pyphi/**/__init__.py" = ["PLC0414"]
# Allow sentinel object() in cache_utils (standard pattern from functools)
"pyphi/cache/cache_utils.py" = ["B008"]
# Allow unused arguments in config callbacks and deferred imports
"pyphi/conf.py" = ["ARG001"]
"pyphi/deferred/*.py" = ["ARG002"]
# Allow unused kwargs in network generator (interface requirement)
"pyphi/network_generator/unit_functions.py" = ["ARG001"]
"pyphi/network_generator/ising.py" = ["ARG001"]
"pyphi/network_generator/weights.py" = ["ARG001"]
# Allow unused arguments in specific files (interface/callback requirements)
"pyphi/dynamics.py" = ["ARG001"]
"pyphi/jsonify.py" = ["ARG002"]
"pyphi/macro.py" = ["ARG002"]
"pyphi/metrics/distribution.py" = ["ARG001"]
"pyphi/models/mechanism.py" = ["ARG001"]
"pyphi/models/subsystem.py" = ["ARG002"]
"pyphi/parallel/__init__.py" = ["ARG001", "PLW0603"]
"pyphi/parallel/chunking.py" = ["PLR0911"] # Many return statements in estimate_work_size
"pyphi/relations.py" = ["ARG001", "ARG002"]
"pyphi/subsystem.py" = ["ARG002"]
"pyphi/visualize/phi_structure/__init__.py" = ["ARG001"]
[tool.pytest.ini_options]
testpaths = ["pyphi", "test"]
addopts = [
"--maxfail=0",
"--log-level=INFO",
"--strict-markers",
"--durations=5",
"--color=yes",
"--tb=auto",
"--doctest-glob=*.rst",
"--doctest-modules",
"--ignore=./profiling",
"--ignore=./benchmarks",
"-vv",
]
norecursedirs = ["docs/_*"]
markers = [
"emd: marks tests that require the pyemd package (deselect with '-m \"not emd\"')",
"outdated: marks tests as outdated (deselect with '-m \"not outdated\"')",
"slow: marks tests as slow (deselect with '-m \"not slow\"')",
"veryslow: marks tests as very slow (deselect with '-m \"not veryslow\"')",
]
filterwarnings = [
"error",
"ignore::ImportWarning",
"ignore:The distutils package is deprecated:DeprecationWarning",
"ignore:distutils Version classes are deprecated:DeprecationWarning",
"ignore::FutureWarning",
"ignore::UserWarning",
"ignore::DeprecationWarning",
]
[tool.coverage.run]
branch = true
source = ["pyphi"]
[tool.coverage.report]
exclude_lines = [
"coverage: disable",
"pragma: no cover",
"def __repr__",
"def __str__",
"def __ne__",
"if self\\.DEBUG",
"if DEBUG",
"def print_",
"def dprint",
"raise AssertionError",
"raise NotImplementedError",
"if 0:",
"if __name__ == .__main__.:",
]
ignore_errors = true
[tool.coverage.html]
directory = "htmlcov"
[tool.pyright]
include = ["pyphi"]
exclude = ["**/__pycache__", "test", "docs", "benchmarks", "profiling"]
pythonVersion = "3.12"
typeCheckingMode = "standard" # Start at standard, not basic
reportMissingImports = false
reportMissingTypeStubs = false
reportUnknownMemberType = false # Disable for gradual migration
reportUnknownArgumentType = false
reportUnknownVariableType = false
reportGeneralTypeIssues = true
reportOptionalMemberAccess = true
reportOptionalSubscript = true
[tool.uv.sources]
# Build graphillion from source to avoid macOS libgomp dependency issues
# The PyPI wheel has hardcoded paths to Homebrew GCC's libgomp library
graphillion = { git = "https://github.com/takemaru/graphillion" }
[tool.towncrier]
directory = "changelog.d"
filename = "CHANGELOG.md"
title_format = "{version}"
underlines = ["-", "", ""]
# Fragment types matching PyPhi's existing CHANGELOG categories
[[tool.towncrier.type]]
directory = "feature"
name = "API additions"
showcontent = true
[[tool.towncrier.type]]
directory = "change"
name = "API changes"
showcontent = true
[[tool.towncrier.type]]
directory = "config"
name = "Config"
showcontent = true
[[tool.towncrier.type]]
directory = "optimization"
name = "Optimizations"
showcontent = true
[[tool.towncrier.type]]
directory = "fix"
name = "Fixes"
showcontent = true
[[tool.towncrier.type]]
directory = "doc"
name = "Documentation"
showcontent = true
[[tool.towncrier.type]]
directory = "refactor"
name = "Refactor"
showcontent = true
[[tool.towncrier.type]]
directory = "misc"
name = "Misc"
showcontent = false