-
Notifications
You must be signed in to change notification settings - Fork 0
/
pyproject.toml
275 lines (249 loc) · 7.96 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
[build-system]
requires = [
"setuptools==75.5.0",
"setuptools-scm[toml] >= 8.1.0",
"wheel==0.45.0",
]
build-backend = "setuptools.build_meta"
[project]
name = "startrepo"
description = "Bootstrap a project easily"
# Use the following command to find all places to update Python versions
# rg --hidden --files | rg -v ".min.js" | xargs rg -I "3[\.]*10" | rg "(py|ver)"
requires-python = ">=3.10"
# keywords = ["anything"]
classifiers = [
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
]
dependencies = [
"setuptools==75.5.0",
"setuptools-scm[toml] >= 8.1.0",
"types-setuptools==75.5.0.20241121", # Bump types-* only with mypy
"typing-extensions ~= 4.12.2", # Directly import Self from typing on Python 3.11+
'tomli ~= 2.1.0; python_version <= "3.10"',
"uv >= 0.5.4", # CI looks out for the comparison: >=
"wheel==0.45.0",
]
dynamic = ["version", "readme"]
[project.optional-dependencies]
test = [
"bashate ~= 2.1.1",
'coverage ~= 7.6.8; python_version >= "3.11"',
'coverage[toml] ~= 7.6.8; python_version <= "3.10"',
"mypy ~= 1.13.0",
"overrides ~= 7.7.0",
"pylint ~= 3.3.1",
'pyright==1.1.389; platform_system == "Linux"',
"pytest ~= 8.3.3",
"pytest-cov ~= 6.0.0",
"pytest-dependency ~= 0.6.0",
"pytest-instafail ~= 0.5.0",
"pytest-mypy ~= 0.10.3",
"pytest-order ~= 1.3.0",
"pytest-pylint ~= 0.21.0",
"pytest-randomly ~= 3.16.0",
"pytest-ruff ~= 0.4.1",
"pytest-vulture ~= 2.2.2",
"pytest-xdist ~= 3.6.1",
"refurb ~= 2.0.0",
"ruff ~= 0.8.0",
"sphinx ~= 8.1.3",
"vulture ~= 2.13",
]
[tool.setuptools.dynamic]
version = { attr = "startrepo.__version__" }
readme = { file = ["README.md", "CHANGELOG.md"] }
[tool.setuptools_scm]
write_to = "startrepo/_version.txt"
##### Other tools #####
[tool.coverage.report]
# Taken from: https://coverage.readthedocs.io/en/coverage-5.5/config.html#syntax
exclude_lines = [
"def __repr__", # Ignore missing debug-only code
"except ImportError(.*):", # Likely Python version-specific code
"if 0:", # Ignore non-runnable code not being run
"if TYPE_CHECKING:",
"if __name__ == .__main__.:", # Ignore non-runnable code not being run
"pragma: no cover",
"raise AssertionError", # Ignore tests not hitting defensive assertion code
"raise NotImplementedError", # Ignore tests not hitting defensive assertion code
]
fail_under = 80 # Minimum code coverage percent
show_missing = true
[tool.coverage.run]
concurrency = ["multiprocessing"]
omit = [
"*/.egg/*",
"*/.eggs/*",
"*/.tox/*",
"*/__main__.py",
"*/build/*",
"*/dist/*",
]
parallel = true
sigterm = true
source = ["startrepo/", "tests/"]
[tool.mypy]
disallow_any_unimported = true
exclude = ["build/"]
namespace_packages = true
python_version = "3.10"
show_error_codes = true
strict = true
warn_unreachable = true
# Add Python modules to be ignored by mypy here
# [[tool.mypy.overrides]]
# module = []
# ignore_missing_imports = true
[tool.pylint.basic]
# Good variable names which should always be accepted, separated by a comma
good-names = ["_", "ex", "f", "g", "i", "j", "k", "Run"]
[tool.pylint.design]
max-attributes = 12
[tool.pylint.format]
max-line-length = 88
[tool.pylint.imports]
allow-any-import-level = ["resource", "winreg"]
[tool.pylint.main]
# Use multiple processes to speed up Pylint.
# Note that sometimes the duplicate-code checker runs properly only when set to 1
jobs = 3
# Whole list retrieved on 2023-10-20 from: https://pylint.pycqa.org/en/latest/user_guide/checkers/extensions.html
load-plugins = [
"pylint.extensions.bad_builtin",
"pylint.extensions.broad_try_clause",
"pylint.extensions.check_elif",
"pylint.extensions.code_style",
"pylint.extensions.comparison_placement",
"pylint.extensions.confusing_elif",
"pylint.extensions.consider_refactoring_into_while_condition",
"pylint.extensions.consider_ternary_expression",
"pylint.extensions.dict_init_mutate",
"pylint.extensions.docparams",
"pylint.extensions.docstyle",
"pylint.extensions.dunder",
"pylint.extensions.empty_comment",
"pylint.extensions.eq_without_hash",
"pylint.extensions.for_any_all",
# "pylint.extensions.magic_value", # Too-opinionated
"pylint.extensions.mccabe",
"pylint.extensions.no_self_use",
"pylint.extensions.overlapping_exceptions",
"pylint.extensions.private_import",
"pylint.extensions.redefined_loop_name",
"pylint.extensions.redefined_variable_type",
"pylint.extensions.set_membership",
"pylint.extensions.typing",
"pylint.extensions.while_used",
]
# Pickle collected data for later comparisons
persistent = "no"
[tool.pylint.similarities]
ignore-comments = "no"
# Ignore imports when computing similarities
ignore-imports = "yes"
min-similarity-lines = 5
[tool.pylint.messages_control]
disable = ["locally-disabled", "suppressed-message"]
enable = [
"bad-inline-option",
"c-extension-no-member",
"consider-using-augmented-assign",
"deprecated-pragma",
"eq-without-hash",
"file-ignored",
"prefer-typing-namedtuple",
"raw-checker-failed",
"use-implicit-booleaness-not-comparison-to-string",
"use-implicit-booleaness-not-comparison-to-zero",
"use-symbolic-message-instead",
"useless-suppression",
]
[tool.pylint.parameter_documentation]
accept-no-param-doc = "no"
accept-no-raise-doc = "no"
accept-no-return-doc = "no"
accept-no-yields-doc = "no"
[tool.pylint.reports]
# Activate the evaluation score
score = "no"
[tool.pylint.typing]
# Min Python version to use for typing related checks, e.g. ``3.7``
# This should be equal to the min supported Python version of the project
py-version = "3.10"
[tool.pyright]
exclude = ["**/node_modules", "**/__pycache__", "**/.*", "build/"]
[tool.pytest.ini_options]
addopts = [
"-n=auto",
"--dist=loadscope",
"--durations=7",
"--error-on-failed-ordering",
"--instafail",
"--no-cov-on-fail",
"--order-dependencies",
"--pylint-error-types=CRWEFI",
"--strict-markers",
]
log_level = "DEBUG"
markers = ["online", "slow"]
xfail_strict = true
[tool.refurb]
ignore = ["110"]
[tool.ruff]
# Exclude a variety of commonly ignored directories.
exclude = [
".bzr",
".direnv",
".eggs",
".git",
".git-rewrite",
".hg",
".mypy_cache",
".nox",
".pants.d",
".pytype",
".ruff_cache",
".svn",
".tox",
".venv",
"__pypackages__",
"_build",
"buck-out",
"build",
"dist",
"node_modules",
"venv",
]
include = ["*.py", "*.pyi", "**/pyproject.toml", "*.ipynb"]
src = ["python"]
target-version = "py310"
unsafe-fixes = true
[tool.ruff.lint]
ignore = [
"COM812", # Seems to add trailing comma even when arguments already fit on one line
"D104", # __init__.py files can be completely blank and not require a docstring
"D203", # D211 is used by default, which is incompatible with this
"D213", # D212 is used by default, which is incompatible with this
"EM101", # String literals is used in exception constructors, stack is readable
"EM102", # f-string literals is used in exception constructors, similar to EM101
"PLR2004", # Difficult to refactor to not use magic values in a big legacy project
"S603", # Allow using subprocess methods w/o shell=True, bandit severity is low
"TRY003", # Allow specifying long messages outside the exception class
]
select = ["ALL"]
[tool.ruff.lint.isort]
force-single-line = true
force-sort-within-sections = true
known-local-folder = ["startrepo"]
[tool.vulture]
# check-entry-points = 0 # maturin repos only
exclude = ["build/", "docs/source/conf_correct.py"]
make_whitelist = true