forked from shap/shap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pyproject.toml
262 lines (236 loc) · 7.23 KB
/
pyproject.toml
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
[build-system]
# Note for maintainers: this numpy constraint is specific to wheels for PyPI. See:
# https://numpy.org/doc/stable/dev/depending_on_numpy.html#numpy-2-abi-handling
requires = ["setuptools>=61.0", "setuptools-scm>=8.0", "numpy>=2.0", "packaging>20.9"]
build-backend = "setuptools.build_meta"
[project]
name = "shap"
description = "A unified approach to explain the output of any machine learning model."
readme = "README.md"
license = {text = "MIT License"}
authors = [
{name = "Scott Lundberg", email = "[email protected]"},
]
requires-python = ">=3.9"
dependencies = [
'numpy',
'scipy',
'scikit-learn',
'pandas',
'tqdm>=4.27.0',
'packaging>20.9',
'slicer==0.0.8',
'numba',
'cloudpickle'
]
classifiers = [
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX",
"Operating System :: Unix",
"Operating System :: MacOS",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Intended Audience :: Information Technology",
"Intended Audience :: Science/Research",
"Topic :: Scientific/Engineering",
"Topic :: Scientific/Engineering :: Artificial Intelligence",
"Development Status :: 5 - Production/Stable",
"License :: OSI Approved :: MIT License",
]
dynamic = ["version"]
[project.optional-dependencies]
plots = ["matplotlib", "ipython"]
others = ["lime"]
docs = [
"matplotlib",
"ipython",
"numpydoc",
"sphinx_rtd_theme==2.0.0",
"sphinx==7.2.6",
"nbsphinx==0.9.3",
"sphinx_github_changelog==1.2.1",
"myst-parser==2.0.0",
"requests",
]
test-core = ["pytest", "pytest-mpl", "pytest-cov", "mypy"]
test = [
"pytest",
"pytest-mpl",
"pytest-cov",
"xgboost",
"lightgbm",
"catboost",
"gpboost",
"ngboost",
"pyspark",
"pyod",
"transformers",
"tf-keras",
"protobuf==3.20.3", # See GH #3046
"torch==2.2.0; sys_platform == 'darwin'", # see GH #3524
"torch; sys_platform != 'darwin'",
"torchvision",
"tensorflow",
"sentencepiece",
"opencv-python",
]
test_notebooks = [
"jupyter",
"nbconvert",
"nbformat",
"nlp",
"transformers",
"datasets",
"keras",
]
[project.urls]
Repository = 'http://github.com/shap/shap'
Documentation = 'https://shap.readthedocs.io/en/latest/index.html'
"Release Notes" = 'https://shap.readthedocs.io/en/latest/release_notes.html'
[tool.mypy]
check_untyped_defs = true
disallow_untyped_calls = false
disallow_untyped_defs = false
disallow_incomplete_defs = false
exclude = ["shap/benchmark/*", "tests/benchmark/*"]
plugins = ["numpy.typing.mypy_plugin"]
[[tool.mypy.overrides]]
# Disable some checks from certain shap modules
# TODO: get these passing!
module = [
"shap._explanation",
"shap.actions.*",
"shap.explainers.*",
"shap.maskers.*",
"shap.models.*",
"shap.plots.*",
"shap.utils.*",
]
check_untyped_defs = false
[[tool.mypy.overrides]]
# Ignore missing types for 3rd party libraries
module = [
"catboost.*",
"cloudpickle",
"cv2",
"IPython.*",
"lightgbm.*",
"lime.*",
"numba",
"pandas",
"pyod.*",
"pyspark.*",
"scipy.*",
"sklearn.*",
"slicer",
"tensorflow.*",
"torch.*",
"tqdm.*",
"xgboost.*",
]
ignore_missing_imports = true
[tool.setuptools]
packages = [
'shap',
'shap.cext',
'shap.explainers',
'shap.explainers.other',
'shap.explainers._deep',
'shap.plots',
'shap.plots.colors',
'shap.plots.resources',
'shap.benchmark',
'shap.maskers',
'shap.utils',
'shap.actions',
'shap.models'
]
[tool.setuptools_scm]
version_file = "shap/_version.py"
# Use "no-local-version" so dev releases are compatibile with PyPI
local_scheme = "no-local-version"
[tool.pytest.ini_options]
addopts = "--mpl"
testpaths = ["tests"]
filterwarnings = [
# Ignore warnings that are entirely from 3rd party libs outside our control
"ignore:.*distutils Version classes are deprecated.*:DeprecationWarning:.*pandas.*",
"ignore:.*typing.io is deprecated.*:DeprecationWarning:.*pyspark.*",
]
[tool.ruff]
# Careful: when running on pre-commit, ruff's "include" and "exclude" config
# options are ignored! So, instead of "exclude", use the "per-file-ignores"
# config to always disable linting for specific files.
include = ["*.py", "*.pyi", "**/pyproject.toml", "*.ipynb"]
extend-exclude = ["**/tree_shap_paper/**", "docs/user_studies/*"]
line-length = 120
[tool.ruff.lint]
select = [
"F", # pyflakes
"I", # isort
"UP", # pyupgrade
"E", # pycodestyle
"W", # warning
"D", # pydocstyle
"NPY", # Numpy
"SIM101", # flake8-simplify
# D417 # undocumented parameter. FIXME: get this passing
]
ignore = [
# Recommended rules to disable when using ruff formatter:
"E117", # Over-indented
"E501", # Line too long
# pydocstyle issues not yet fixed
"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
"D205", # 1 blank line required between summary line and description
"D400", # First line should end with a period
"D401", # First line of docstring should be in imperative mood: "A basic partial dependence plot function."
"D404", # First word of the docstring should not be "This"
"NPY002", # Allow numpy RandomState objects in tests
]
[tool.ruff.lint.pydocstyle]
convention = "numpy"
[tool.ruff.lint.per-file-ignores]
# Don't apply linting/formatting to vendored code
"shap/explainers/other/_maple.py" = ["ALL"]
"shap/plots/colors/_colorconv.py" = ["ALL"]
# Ignore notebooks in user_studies, which are not maintained
"docs/user_studies/*.ipynb" = ["ALL"]
# Ignore SHAP Paper, as it is an unmaintained record of a published paper
"notebooks/tabular_examples/tree_based_models/tree_shap_paper/*" = ["ALL"]
# Disable some unwanted rules on Jupyter notebooks
"*.ipynb" = ["D", "E703", "E402"] # Allow trailing semicolons, allow imports not at top
# Ignore pycodestyle in tests
"tests/*py" = ["D"]
[tool.coverage.run]
source_pkgs = ["shap"]
[tool.coverage.paths]
combine = ["shap", "*/site-packages/shap"]
[tool.cibuildwheel]
# Restrict the set of builds to mirror the wheels available in scipy. See #3028
# skip *-musllinux_aarch64 since numpy doesn't provid those wheels
# skip cp38-musllinux_x86_64 since numpy never provided cp38 musllinux wheels
# they introduced musllinux in 1.25 when they already dropped cp38
skip = ["pp*", "*-musllinux_aarch64", "cp38-musllinux_x86_64"]
build-verbosity = 2
# Change import-mode to ensure we test against installed package, not local project
test-command = "pytest -v {project}/tests --import-mode=append"
test-extras = ["test-core", "plots"]
# skip tests on cp38-macosx_x86_64 because of https://github.com/catboost/catboost/issues/2371
# skip tests on emulated architectures, as they are very slow
# skip tests on *-macosx_arm64 , as cibuildwheel does not support tests on arm64 (yet)
# skip tests on *-musllinux*" since llvmlite and numba do not provide musllinux wheels
test-skip = "cp38-macosx_x86_64 *-*linux_{aarch64,ppc64le,s390x} *-macosx_arm64 *-musllinux*"
[tool.cibuildwheel.linux]
archs = ["x86_64", "aarch64"]
[tool.cibuildwheel.windows]
archs = ["AMD64"]
[tool.cibuildwheel.macos]
archs = ["x86_64", "arm64"]