forked from khanlab/snakebids
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pyproject.toml
317 lines (287 loc) · 8.61 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
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
[tool.poetry]
name = "snakebids"
version = "0.0.0"
description = "BIDS integration into snakemake workflows"
readme = "README.md"
repository = "https://github.com/khanlab/snakebids"
documentation = "https://snakebids.readthedocs.io/"
authors = [
"Ali Khan <[email protected]>",
"Peter Van Dyken <[email protected]>",
"Tristan Kuehn <[email protected]>",
"Jason Kai <[email protected]>",
]
license = "MIT"
packages = [{ include = "snakebids" }]
exclude = ["snakebids/tests/**"]
[tool.poetry-dynamic-versioning]
enable = true
vcs = "git"
dirty = true
style = "pep440"
bump = true
[tool.poetry-dynamic-versioning.substitution]
files = ['snakebids/__init__.py']
patterns = [
"(^\\s+\"snakebids_version\":\\s*\")[^'\"]*(\")",
"(^__version__\\s*(?::.*?)?=\\s*['\"])[^'\"]*(['\"])",
]
[tool.poetry.dependencies]
# upper cap imposed by pytest-split
python = ">=3.9,<4.0"
# core dep with high breakage potential given plans for redesign, so
# keep upper limit
pybids = ">=0.18.1,<0.19"
snakemake = [
{ version = ">=5.28.0,<8", python = "<3.11" },
{ version = ">=7.18.2", python = ">=3.11" },
]
typing-extensions = ">=3.10.0"
# minimum 22.2 to get "alias" parameter on attrs.field
attrs = ">=22.2.0"
boutiques = "^0.5.25"
more-itertools = ">=8"
# package developed in complete tandem with snakebids, so no need for a range
pvandyken-deprecated = "0.0.4"
# Need this until py39
importlib-resources = ">=5.12.0"
# Below are non-direct dependencies (i.e. dependencies of other dependencies)
# specified to ensure a version with a pre-built wheel is installed depending
# on the python version being used.
numpy = [
{ version = "<=1.24.4", python = "<3.9" },
{ version = ">=1.23.2", python = ">=3.11" },
]
# Use minimum of 1.10.0 because of security vulnerability
scipy = [
{ version = ">=1.10.0,<=1.10.1", python = "<3.9" },
{ version = ">=1.10.0", python = ">=3.9" },
]
pandas = [
{ version = "<=2.0.3", python = "<3.9" },
{ version = ">=2.1.1", python = ">=3.12" },
]
# minimum 9.2.0 because of breaking dependency changes and changes to validation errors
copier = ">=9.2.0"
jinja2-time = ">=0.2.0"
# minimum 2.31.0 because of security vulnerability
requests = ">=2.31.0"
ruamel-yaml = ">=0.17.2"
lazy-loader = ">=0.3"
# Docutils is a requirement of snakemake, for snakebids otherwise it is merely a doc
# dependency. 0.21.post1 needs to be excluded because of
# https://github.com/python-poetry/poetry/issues/9293
docutils = "!=0.21.post1"
pluggy = ">=1.3"
[tool.poetry.group.dev.dependencies]
pytest = "^8"
pytest-mock = "^3.7.0"
poethepoet = "^0.27"
pre-commit = "^3.0.0"
# a mkinit dep has the 'platform_system == "Windows"' as a marker on an incompatible dependency
# (pydantic<2.0 cf copier), so set the inverse as a marker here so mkinit can
# still be resolved
mkinit = { version="^1.1.0", markers = "platform_system != 'Windows'" }
hypothesis = "^6.34.1"
pytest-benchmark = "^4.0.0"
pyfakefs = "^5.1.0"
pyparsing = "^3.0.9"
pathvalidate = "^3.0.0"
pyright = "^1.1.370"
ruff = "^0.5"
pytest-xdist = "^3.3.1"
pytest-split = [
{ version = "^0.8.1", python = "3.8" },
{ version = "^0.9", python = ">=3.9" },
]
tomli = "^2.0.1"
requests-mock = "^1.11.0"
pytest-cov = "^5.0"
docstring-parser = "^0.16"
[tool.poetry.group.docs.dependencies]
sphinx = "^7"
sphinx-argparse = "^0.4.0"
sphinxcontrib-asciinema = "^0.4"
myst-parser = "^3"
furo = "^2024.4.27"
sphinx-copybutton = "^0.5.2"
sphinx-reredirects = "^0.1.3"
sphinx-design = [
{ version = "^0.5.0", python = "3.8" },
{ version = "^0.6", python = ">=3.9" },
]
sphinx-autobuild = [
{ version = "^2021.03.14", python = "3.8" },
{ version = "^2024.02.04", python = ">=3.9" },
]
[tool.poetry.scripts]
snakebids = "snakebids.admin:main"
[build-system]
requires = ["poetry-core>=1.0.0", "poetry-dynamic-versioning"]
build-backend = "poetry_dynamic_versioning.backend"
[tool.poe.tasks]
setup = "pre-commit install"
sort.cmd = "ruff check --fix --select I001 $path"
sort.args = [
{ name = "path", default = "snakebids scripts", positional = true },
]
fmt.cmd = "ruff format $path"
fmt.args = [
{ name = "path", default = "snakebids scripts", positional = true },
]
ruff = "ruff check snakebids scripts"
pyright = "pyright snakebids scripts"
quality = ["fmt", "ruff", "pyright"]
fix = ["fmt", "ruff --fix"]
test = """
pytest --doctest-modules --ignore=docs \
--ignore=snakebids/project_template --benchmark-disable
"""
benchmark = "pytest --benchmark-only --benchmark-autosave"
docs = "sphinx-autobuild docs build/docs --watch snakebids -W"
[[tool.poe.tasks.update-bids.sequence]]
script = "scripts.update_bids:main"
[[tool.poe.tasks.update-bids.sequence]]
ref = "mkinit"
[[tool.poe.tasks.mkinit.sequence]]
cmd = "mkinit --recursive --nomods --lazy_loader_typed --relative -i snakebids"
[[tool.poe.tasks.mkinit.sequence]]
ref = "fix"
[tool.poe.tasks._get_version]
imports = ["platform"]
expr = "platform.python_version()"
[tool.poe.tasks.build-container]
args = [{ name = "container_id", positional = true, required = true }]
uses = { VERSION = "_get_version" }
cmd = """
docker build "containers/${container_id}" \
--tag "snakebids/${container_id}:${VERSION}" \
--build-arg="PYTHON_VERSION=${VERSION}"
"""
[tool.pytest.ini_options]
markers = [
"docker: marks tests as requiring docker (deselect with '-m \"not docker\"')",
"disable_fakefs: disable the fake filesystem in a hypothesis test"
]
[tool.coverage.run]
omit = ["snakebids/project_template/**", "snakebids/tests/**"]
[tool.coverage.report]
exclude_also = [
"@overload",
'class [a-zA-Z0-9_]+\([^)]*Protocol.*\)',
'if TYPE_CHECKING',
"def __dir__",
'@(abc\.)abstractmethod'
]
[tool.isort]
profile = "black"
multi_line_output = 3
[tool.pyright]
include = ["snakebids"]
exclude = ["snakebids/project_template", "typings"]
typeCheckingMode = "strict"
reportPrivateUsage = false
reportImportCycles = false
enableExperimentalFeatures = true
[tool.mypy]
python_version = "3.8"
exclude = ["snakebids/project_template", "typings"]
[tool.ruff]
target-version = "py38"
[tool.ruff.lint]
select = [
"E", # pycodestyle error
"W", # pycodestyle warning
"F", # pyflakes
"N", # pep8-naming
"UP", # pyupgrade
"YTT", # flake8-2020
"S", # flake8-bandit
"BLE", # flake8-blind-except
"B", # flake8-bugbear
"A", # flake8-builtins
"COM", # flake8-commas
"C4", # flake8-comprehensions
"T10", # flake8-debugger
"EM", # flake8-errmsg
"FA", # flake8-future-annotations
"ISC", # flake8-implicit-str-concat
"ICN", # flake8-import-conventions
"G", # flake8-logging-format
"INP", # flake8-no-pep420
"PIE", # flake8-pie
"PT", # flake8-pytest-style
"RSE", # flake8-raise
"RET", # flake8-return
"SLF", # flake8-self
"SIM", # flake8-simplify
# We use os.path a lot in "legitimate" ways, so this ruleset has too many
# false positives
# "PTH", # flake8-use-pathlib
"TRY", # tryceratops
"FLY", # flynt
"D", # pydocstyle
"PL", # pylint
"RUF", # ruff
"T100", # debugger
"I", # isort
# Other perf rules give more false positives than benefits
"PERF101", # do not cast iterable to list
]
ignore = [
"PLR0913",
"D105", # missing docstring in magic method
"D100", # Require docstring in public modules
"D104", # Require docstring in public packages
"S603", # Subprocess without shell equals true
"S607", # start-process-with-partial-path
# recommended ignores for ruff format
"W191",
"E111",
"E114",
"E117",
"D206",
"D300",
"Q000",
"Q001",
"Q002",
"Q003",
"COM812",
"COM819",
"ISC001",
"ISC002",
]
[tool.ruff.lint.per-file-ignores]
"snakebids/project_template/**" = ["N999"]
"snakebids/tests/**" = [
"D",
"S101", # assert
"S307", # Use of eval
"SLF",
]
"snakebids/**/__init__.py" = ["F811"] # redefinition of unused __all__
[tool.ruff.lint.pydocstyle]
convention = "numpy"
ignore-decorators = ["snakebids.utils.utils.property_alias"]
[tool.ruff.lint.flake8-builtins]
builtins-ignorelist = ["filter"]
[tool.ruff.lint.flake8-import-conventions.extend-aliases]
itertools = "it"
functools = "ft"
operator = "op"
subprocess = "sp"
importlib_resources = "impr"
"importlib.resources" = "impr"
"importlib.metadata" = "impm"
more_itertools = "itx"
"hypothesis.strategies" = "st"
"snakebids.tests.strategies" = "sb_st"
"snakebids.utils.sb_itertools" = "sb_it"
[tool.ruff.lint.flake8-pytest-style]
fixture-parentheses = false
[tool.codespell]
# Ref: https://github.com/codespell-project/codespell#using-a-config-file
skip = '.git*,*.lock,*.css,./typings'
check-hidden = true
# ignore-regex = ''
# ignore-words-list = ''