forked from mmschlk/shapiq
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpyproject.toml
More file actions
273 lines (260 loc) · 8.69 KB
/
pyproject.toml
File metadata and controls
273 lines (260 loc) · 8.69 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
[build-system]
requires = ["setuptools>=69", "wheel", "setuptools_scm>=8"]
build-backend = "setuptools.build_meta"
[project]
name = "shapiq"
dynamic = ["readme", "version"]
description = "Shapley Interactions for Machine Learning"
requires-python = ">=3.10"
dependencies = [
# core
"numpy",
"scipy",
"pandas",
"joblib",
"scikit-learn",
"tqdm",
"requests",
"sparse-transform", # for sparse approximators (spex, proxyspex)
"galois", # for sparse approximators (spex, proxyspex)
# plotting
"matplotlib",
"networkx",
"colour",
"pillow",
]
authors = [
{name = "Maximilian Muschalik", email = "Maximilian.Muschalik@lmu.de"},
{name = "Santo M. A. R. Thies", email = "S.Thies@campus.lmu.de"},
{name = "Hubert Baniecki"},
{name = "Fabian Fumagalli"},
]
maintainers = [
{name = "Maximilian Muschalik", email = "Maximilian.Muschalik@lmu.de"},
{name = "Santo M. A. R. Thies", email = "S.Thies@campus.lmu.de"},
]
license = "MIT"
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"Topic :: Scientific/Engineering",
"Topic :: Scientific/Engineering :: Artificial Intelligence",
'Operating System :: Microsoft :: Windows',
'Operating System :: Unix',
'Operating System :: MacOS',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Programming Language :: Python :: 3.13',
]
keywords = [
"python",
"machine learning",
"interpretable machine learning",
"shap",
"xai",
"explainable ai",
"interaction",
"shapley interactions",
"shapley values",
"feature interaction",
]
[tool.coverage.report]
exclude_also = [
'if TYPE_CHECKING:',
]
[tool.setuptools_scm]
write_to = "src/shapiq/_version.py"
[tool.setuptools.packages.find]
where = ["./src"]
include = ["shapiq*"]
[tool.setuptools.dynamic]
readme = {file = ["README.md", "CHANGELOG.md"], content-type = "text/markdown"}
[project.urls]
documentation = "https://shapiq.readthedocs.io"
source = "https://github.com/mmschlk/shapiq"
tracker = "https://github.com/mmschlk/shapiq/issues"
changelog = "https://github.com/mmschlk/shapiq/blob/main/CHANGELOG.md"
[tool.pytest.ini_options]
testpaths = [
"tests/shapiq",
"tests/shapiq_games"
]
pythonpath = ["src"]
minversion = "8.0"
[tool.ruff]
line-length = 100
target-version = "py310"
src = ["tests", "src", "docs"]
[tool.ruff.lint]
# we allow star arguments to be of type Any e.g. def func(*args: Any, **kwargs: Any) -> None: is ok
flake8-annotations.allow-star-arg-any = true
select = ["ALL"]
ignore = [
"E501", # Line too long
"N803", # Variable X in function should be lowercase
"N806", # Variable X in function should be lowercase
"COM812", # this is redundant with the formatter which anyways does this (must be excluded) in the future # TODO: add remove pickle calls and remove this exclusion
"FIX002", # we use TODOs atm to track potential code improvements # TODO: add this in the future
"PLR0913", # Too many arguments are passed to function
"PLR0915", # Too many statements in function
"PLR0912", # Too many branches in function
"PLR2004", # Magic values in comparison ... this gets flaged with all checks for two-way interactions
"C901", # Too complex functions
"PLR0911", # too many return statements in function
"N802", # Function name should be lowercase
]
exclude = [
".bzr",
".direnv",
".eggs",
".git",
".git-rewrite",
".hg",
".ipynb_checkpoints",
".mypy_cache",
".nox",
".pants.d",
".pyenv",
".pytest_cache",
".pytype",
".ruff_cache",
".svn",
".tox",
".venv",
".vscode",
"__pypackages__",
"_build",
"buck-out",
"build",
"dist",
"node_modules",
"site-packages",
"venv",
"docs/build",
]
# Exclude a variety of commonly ignored directories.
# Note to developers: If you add a new ignore at least put a comment next to it why it is ignored
[tool.ruff.lint.per-file-ignores]
"src/shapiq/typing.py" = [
"A005", # we want to be similar to other libraries that also shadow typing
"D102", # we don't need docstrings for protocol stubs
"ANN401", # any return type is okay in typing.py for protocol subts
]
"tests/*.py" = [
# "ALL",
"S101", # we need asserts in tests
"D", # test docstrings don't matter too much
"E501", # line too long
"ANN", # type annotations
"ARG", # some functions are not used
"INP", # inports can be different
"N", # type hints are excludes in tests
"PTH", # we can use os for now
"S", # in tests we can use some security issues for now
"PT", # we can use print statements in tests
"NPY",
"SLF", # private members are okay in tests
"TRY",
]
"*.ipynb" = [
"E402", # Module level import not at top of file (its .ipynb)
"T20", # notebooks can have print statements
"I002", # notebooks do not have to import required modules
"D", # docstrings are not required in notebooks
"SLF001", # private members are okay in notebooks
"ANN001", # type annotations are not required in notebooks
]
"docs/source/*.py" = [
"A001", # some conf.py variables shadow builtins which is okay here
"ANN001", # some magic functions I don't want to annotate
"INP", # docs can be an implicit package (does not need to be imported)
"I002", # benchmark code does not have to import required modules
]
"benchmark/*.py" = [
"INP", # imports can be different here
"I002", # benchmark code does not have to import required modules
"PTH" # in benchmark code we use a lot of os, which is okay
]
"docs/copy_notebooks.py" = [
"I002", # benchmark code does not have to import required modules
]
"__init__.py" = [
"I002", # __init__.py does not have to import required modules
"RUF022", # we can have unsorted imports in __init__.py
"FA",
]
"scripts/*.py" = [
"INP", # imports can be different here
"I002", # script code does not have to import required modules
"PTH", # in script code we use a lot of os, which is okay
"T201", # scripts can have print statements
"BLE001", # scripts can have bare excepts
"TRY"
]
[tool.ruff.lint.pydocstyle]
convention = "google"
[tool.ruff.lint.isort]
known-first-party = ["shapiq"]
extra-standard-library = ["typing_extensions"]
combine-as-imports = true
force-wrap-aliases = true
no-lines-before = ["future"]
required-imports = ["from __future__ import annotations"]
[tool.pyright]
include = ["src/shapiq"]
exclude = ["tests", "docs", "benchmark", "scripts", "src/shapiq_games"]
venv = ".venv"
pythonVersion = "3.10"
defineConstant = { DEBUG = true }
reportMissingImports = "error"
reportMissingTypeStubs = false
pythonPlatform = "Linux"
[dependency-groups]
all_ml = [
"tabpfn>=2.1.3",
"torchvision",
"torch",
"xgboost",
"lightgbm; platform_system != 'Darwin'", # lightgbm has install problems on macOS in github actions
"transformers",
"scikit-image",
"tensorflow; python_version < '3.13' and platform_system != 'Windows'", # only up to py 3.12
"tf-keras; python_version < '3.13' and platform_system != 'Windows'", # only up to py 3.12
]
test = [
"pytest>=8.3.5", # for running tests
"pytest-cov>=6.0.0", # for coverage
"pytest-xdist>=3.8.0", # for parallel test execution
"packaging", # for version parsing in tests
]
lint = [
"ruff>=0.14.1", # for linting
"pre-commit>=4.3.0", # for running the linters pre-commit hooks
"pyright>=1.1.402", # for type checking
]
docs = [
"sphinx>=8.0.0", # documentation generator
"furo", # beautiful sphinx theme
"myst-parser", # Markdown support for Sphinx
"sphinx-copybutton", # copy button for code blocks
"sphinx-autodoc-typehints", # include typehints in docs
"sphinx_toolbox", # various sphinx extensions
"sphinxcontrib-bibtex", # references based on bibtex
"nbconvert", # notebook support for sphinx
"nbsphinx", # notebook support for sphinx
"commonmark", # Markdown parser and renderer
# TODO(mmschlk): remove the pin in ipython when we drop python 3.10 support and pin to
# ipython>=9.0.0, since ipython==8.7.0 introduces a bug with parsing notebooks also discussed
# here: https://github.com/spatialaudio/nbsphinx/issues/24
"ipython<8.38.0", # for code execution in notebooks
]
dev = [
"notebook>=7.3.3",
"ipywidgets",
{include-group = "test"},
{include-group = "lint"},
{include-group = "all_ml"},
]