-
Notifications
You must be signed in to change notification settings - Fork 0
/
pyproject.toml
275 lines (248 loc) · 9.12 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
263
264
265
266
267
268
269
270
271
272
273
274
275
[project]
name = "xai4mri"
version = "0.0.1"
description = "xai4mri is designed for advanced MRI analysis using deep learning combined with explainable A.I. (XAI)."
readme = "README.md"
requires-python = ">=3.9, <3.12" # TODO: to update to 3.12, but first iNNvestigate would need to be updated
license = { file = "LICENSE" }
keywords = [
"transfer-learning",
"xai",
"explainable-ai",
"explanation",
"interpretation",
"prediction",
"MRI",
"sMRI",
"3D-conv",
"deep-learning",
"structure",
"brain",
"t1w",
"flair",
"swi",
"dwi",
]
authors = [{ name = "Simon M. Hofmann", email = "[email protected]" }]
maintainers = [{ name = "Simon M. Hofmann", email = "[email protected]" }]
classifiers = [
"Development Status :: 2 - Pre-Alpha",
"Intended Audience :: Science/Research",
"Natural Language :: English",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
]
dependencies = [
"antspyx>=0.4.2, <0.5.0", # TODO: to update to 0.5.* solve issue with ants.from_nibabel()
"innvestigate>=2.1.1, <3.0.0",
"nilearn>=0.10, <1.0",
"tensorflow>=2.6, <2.15", # TODO: 2.15 not tested yet, iNNvestigate would need to be updated
"tqdm>=4.66.5, <5.0",
]
[project.optional-dependencies]
develop = [
"bumpver==2023.1129",
"ruff>=0.6.8, <1.0.0", # including format
"tox>=4.20.0, <5.0.0",
"pre-commit>=3.8.0, <4.0.0",
"pytest>=8.3.3, <9.0.0",
"pytest-cov>=5.0.0, <6.0.0",
]
docs = [
"blacken-docs>=1.16, <2.0",
"docutils>=0.21.1, <1.0.0",
"markdown-callouts>=0.3.0, <1.0.0",
"markdown-exec[ansi]>=1.7.0, <2.0.0",
"mkdocs>=1.5, <2.0",
"mkdocs-autorefs>=0.5.0, <1.0.0",
"mkdocs-bibtex>=2.11.0, <3.0.0",
"mkdocs-coverage>=1.0.0, <2.0.0",
"mkdocs-gen-files>=0.5.0, <1.0",
# "mkdocs-git-committers-plugin-2>=1.1",
"mkdocs-jupyter>=0.24.6, <1.0.0",
"mkdocs-literate-nav>=0.6.1, <1.0",
"mkdocs-material>=9.4.8, <10.0.0",
"mkdocs-material-extensions>=1.3, <2.0",
"mkdocs-minify-plugin>=0.7.1, <1.0.0",
"mkdocs-redirects>=1.2.1, <2.0.0",
"mkdocstrings[python]", # add language-specific extensions
"pypandoc>=1.13, <2.0", # if issue: install via conda install -c conda-forge pypandoc
]
[project.urls]
homepage = "https://shescher.github.io/xai4mri/"
documentation = "https://shescher.github.io/xai4mri/"
repository = "https://github.com/SHEscher/xai4mri"
changelog = "https://github.com/SHEscher/xai4mri/blob/main/CHANGELOG.md"
[build-system]
requires = ["setuptools>=65", "wheel"]
build-backend = "setuptools.build_meta"
[tool.setuptools]
platforms = ["unix", "linux", "osx", "cygwin", "win32"]
zip-safe = false
# # To automatically find the package(s) (Beta feature (Oct, 2022)):
[tool.setuptools.packages.find]
where = ["src"]
include = ["xai4mri", "xai4mri.*"]
exclude = ["tests"]
# ALL ABOVE IS ADAPTATION OF THE FORMER setup.cfg
# ALL BELOW WAS ALREADY PART OF pyproject.toml [Oct, 2022]
[tool.pytest.ini_options]
testpaths = ["tests"]
[tool.mypy]
mypy_path = "src"
check_untyped_defs = true
disallow_any_generics = true
ignore_missing_imports = true
no_implicit_optional = true
show_error_codes = true
strict_equality = true
warn_redundant_casts = true
warn_return_any = true
warn_unreachable = true
warn_unused_configs = true
no_implicit_reexport = true
[tool.coverage.run]
data_file = "tests/.coverage"
[tool.coverage.report]
exclude_lines = ["if __name__ == .__main__.:", "if TYPE_CHECKING:", "@abstract"]
[tool.coverage.html]
directory = "tests/coverage_html_report"
[tool.ruff]
# Select rules / linters to apply
lint.select = [ # add /comment-out rules (the list below does not contain all rulles)
# "ALL", # all rules
"D", # pydocstyle
"E", # pycodestyle [default]
"F", # Pyflakes [default]
"I", # isort imports
"RUF", # ruff specific
"UP", # pyupgrade [default]
"W", # pycodestyle: warning
"C90", # mccabe
"N", # pep8-naming
"ANN", # flake8-annotations (toggle on if you intend to work with type annotations)
"S", # flake8-bandit
"BLE", # flake8-blind-except
"B", # flake8-bugbear
"A", # flake8-builtins
"COM", # flake8-commas
"C4", # flake8-comprehensions
# "EM", # flake8-errmsg
"FA", # flake8-future-annotations (see ANN above)
"ISC", # flake8-implicit-str-concat
# "ICN", # flake8-import-conventions
"G", # flake8-logging-format
"INP", # flake8-no-pep420
"PT", # flake8-pytest-style
"Q", # flake8-quotes
"RET", # flake8-return
"SIM", # flake8-simplify
"TCH", # flake8-type-checking
"ARG", # flake8-unused-arguments
"PTH", # flake8-use-pathlib
"TD", # flake8-todos
"FIX", # flake8-fixme
"ERA", # eradicate
"PD", # pandas-vet
"PL", # Pylint
"NPY", # NumPy-specific rules
] # run `ruff linter` to see all rules
fix = false # true: Ruff will try to fix errors automatically
# List of rules to consider non-autofix-able.
lint.unfixable = [ # either with fix = true or when `ruff . --fix` is executed
"ERA001", # found commented-out code
"F401", # unused imports
# "RUF100", # `noqa` directives that are no longer applicable
]
# Ignore specific rules or the whole set of a rule
lint.ignore = [
"ANN003", # flake8-annotations: Missing type annotation for **kwargs
"ANN101", # flake8-annotations: Missing type annotation for self in method
"ANN102", # flake8-annotations: Missing type annotation for cls in classmethod
"ANN401", # flake8-annotations: Any
"COM812", # Trailing comma missing
"D203", # 1 blank line required before class docstring: incompatible with D211 (=no blank line required)
"D212", # multi-line-summary-first-line incompatible with D213 (=should start at second line)
"DTZ005", # timezone-naive datetime
"E402", # Module level import not at the top of file (covert by ISORT)
# "E501", # Ignore line-length since we use 119
# "ERA001", # Found commented-out code
"ISC001", # single-line-implicit-string-concatenation [is in conflict with `ruff format`]
"S301", # suspicious-pickle-usage
"TD002", # Missing author in To-Do
"TD003", # Missing issue link on the line following a To-Do
]
# lint.ignore-init-module-imports = true # void automatically removing unused imports in __init__.py [deprecated]
respect-gitignore = true # files and folder ignored in gitignore are ignore by ruff as well [default: true]
src = ["src/xai4mri", "tests"]
# Exclude a variety of commonly ignored directories.
include = ["*.py", "*.pyi", "**/pyproject.toml", "*.ipynb"]
extend-exclude = ["data"]
line-length = 119 # Same as flake8 and black
target-version = "py39" # assume Python >= 3.9
output-format = "concise" # "full" or "concise"
preview = false # true: Ruff will use unstable rules and fixes
[tool.ruff.lint.extend-per-file-ignores]
# Ignore specific rules in specific files
"__init__.py" = ["F401", "D104"]
"*.ipynb" = ["D100"] # ignore docsstring in notebooks
"tests/*.py" = [
"S101",
"D103",
"PLC2701",
] # ignore assert statements, and private objects in tests
"prune_image.py" = ["RUF002"]
[tool.ruff.format]
docstring-code-format = true # default: false
preview = true # true: Ruff will use unstable rules and fixes
[tool.ruff.lint.flake8-annotations]
allow-star-arg-any = true
ignore-fully-untyped = true
suppress-none-returning = true
[tool.ruff.lint.flake8-comprehensions]
allow-dict-calls-with-keyword-arguments = true
[tool.ruff.lint.isort]
known-local-folder = ["src/xai4mri"]
# known-first-party = ...
[tool.ruff.lint.mccabe]
# Flag errors (`C901`) whenever the complexity level exceeds x.
max-complexity = 20 # default x: 10
[tool.ruff.lint.pep8-naming]
ignore-names = [] # fill with specific class, function, variable names
[tool.ruff.lint.pydocstyle]
# convention = "google" # "numpy", "pep257"
[tool.ruff.lint.pylint]
# Flag errors (`PLR*`) w.r.t. complexity levels
max-args = 15 # default: 5
max-branches = 20 # default: 12
max-returns = 6 # default: 6
max-statements = 70 # default: 50
max-locals = 19
# allow-magic-value-types = ["int"]
[tool.black]
line-length = 119
target-version = ["py38", "py39", "py310", "py311"]
include = '(\.pyi?|\.ipynb)$'
exclude = ''' # A regex preceded with ^/ will apply only to files and directories in the root of the project.
(
^/models
| ^/data
| /*/\..* # ignore (hidden) files in hidden directories
)
'''
# For instance, run in shell: bumpver update --patch --no-fetch --dry
[tool.bumpver]
current_version = "0.0.1"
version_pattern = "MAJOR.MINOR.PATCH"
pre_commit_hook = "scripts/badge.sh"
commit_message = "bump version {old_version} -> {new_version}"
commit = true
tag = true
push = false
[tool.bumpver.file_patterns]
"pyproject.toml" = ['^version = "{version}"', 'current_version = "{version}"']
"src/xai4mri/__init__.py" = ['^__version__ = "{version}"']
"README.md" = ['version-v.{version}']