-
Notifications
You must be signed in to change notification settings - Fork 1
/
pyproject.toml
322 lines (288 loc) · 9.33 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
318
319
320
321
322
[tool]
[tool.coverage.report]
exclude_lines = [
"if TYPE_CHECKING:",
"pragma: no cover"
]
fail_under = 100
include_namespace_packages = true
omit = [
"contributor_setup.py",
"remove_python_version_condition_from_req_file.py"
]
show_missing = true
skip_empty = true
[tool.coverage.run]
branch = true
cover_pylib = false
source = ["actions", "scripts"]
[tool.docformatter]
close-quotes-on-newline = true
in-place = true
recursive = true
wrap-descriptions = 100
wrap-summaries = 0
[tool.poetry]
license = "Apache-2.0"
package-mode = false
version = "1.5.2"
[tool.poetry.dependencies]
python = "~3.12" # This needs to stay in sync with all CI workflows
[tool.poetry.group.actions-create_unique_testpypi_version.dependencies]
poetry-core = "1.9.1"
pypi-simple = "1.6.1"
tomli = "2.1.0"
tomli-w = "1.1.0"
[tool.poetry.group.actions-find_unreleased_changelog_items.dependencies]
[tool.poetry.group.actions-update_development_dependencies.dependencies]
poetry-plugin-export = "1.8.0"
pre-commit = "4.0.1"
pypi-simple = "1.6.1"
toml-sort = "0.24.2"
yamlfix = "1.17.0"
[tool.poetry.group.dev.dependencies]
pip = "^24.0"
poetry-audit-plugin = "^0.4.0"
poetry-plugin-export = "1.8.0"
poetry-pre-commit-plugin = "^0.1.2"
pre-commit = "4.0.1"
pylint = "3.3.1"
pyright = {extras = ["nodejs"], version = "1.1.389"}
tox = "^4.18.0"
tox-gh-actions = "^3.2.0"
[tool.poetry.group.docs.dependencies]
codespell = "^2.0.0"
mkdocs = "^1.6.0"
mkdocs-ezglossary-plugin = "^1.6.10"
mkdocs-macros-plugin = "^1.0.5"
mkdocs-mermaid2-plugin = "^1.1.1"
mkdocs-same-dir = "^0.1.3"
mkdocs-spellcheck = "^1.1.0"
pygments = "^2.17.2"
pymdown-extensions = "^10.8.1"
symspellpy = "^6.7.7"
tomli = "2.1.0"
[tool.poetry.group.tests.dependencies]
coverage = "^7.5.0"
linkchecker = "^10.0.0"
pytest = "^8.2.0"
pytest-cov = "^6.0.0"
pytest-depends = "^1.0.1"
pytest-env = "^1.1.3"
pytest-github-report = "^0.0.1"
pytest-html = "^4.1.1"
pytest-order = "^1.2.1"
pytest-subprocess = "^1.5.2"
[tool.pylint.main]
fail-under = 10.0
ignore-patterns = [
"^\\.#",
"^\\..*_cache",
"^\\.docs.*",
"^\\.env.*",
"^\\.idea",
"^\\.results.*",
"^\\.tox",
"^\\.venv.*",
"^\\.vscode",
"^temp_.*\\..*"
]
init-hook = 'import sys; sys.path.append(".")'
jobs = 0
load-plugins = """
pylint.extensions.check_elif,
pylint.extensions.code_style,
pylint.extensions.comparison_placement,
pylint.extensions.consider_refactoring_into_while_condition,
pylint.extensions.dict_init_mutate,
pylint.extensions.docparams,
pylint.extensions.docstyle,
pylint.extensions.dunder,
pylint.extensions.eq_without_hash,
pylint.extensions.for_any_all,
pylint.extensions.no_self_use,
pylint.extensions.overlapping_exceptions,
pylint.extensions.private_import,
pylint.extensions.set_membership,
pylint.extensions.typing,
pylint.extensions.while_used
"""
recursive = true
[tool.pylint."messages control"]
disable = [
"broad-exception-caught", # caught by ruff
"fixme", # caught by ruff
"global-statement", # caught by ruff
"invalid-name", # caught by ruff
"line-too-long", # caught by ruff
"locally-disabled", # allowed
"missing-class-docstring", # caught by ruff
"missing-module-docstring", # caught by ruff
"no-member", # caught by pyright
"protected-access", # caught by ruff
"raise-missing-from", # caught by ruff
"redefined-builtin", # caught by ruff
"suppressed-message", # allowed
"too-many-arguments", # caught by ruff
"too-many-branches", # caught by ruff
"too-many-statements", # caught by ruff
"too-many-statements", # caught by ruff
"unused-argument", # caught by ruff
"unused-import", # caught by ruff
"use-implicit-booleaness-not-comparison-to-string", # caught by ruff
"wrong-import-order" # caught by ruff
]
enable = ["all"]
[tool.pylint.reports]
# Python expression which should return a score less than or equal to 10. You
# have access to the variables 'fatal', 'error', 'warning', 'refactor',
# 'convention', and 'info' which contain the number of messages in each category,
# as well as 'statement' which is the total number of statements analyzed. This
# score is used by the global evaluation report (RP0004).
evaluation = "max(0, 0 if fatal else 10.0 - ((float(5 * error + warning + refactor + convention + info) / statement) * 10))"
output-format = "text" # colorized could be another option
score = true
[tool.pyright]
ignore = [
"temp_*.py"
]
pythonPlatform = "All"
reportCallInDefaultInitializer = "error"
reportImplicitOverride = "error"
reportImplicitStringConcatenation = "none" # this is allowed
reportImportCycles = "error"
reportMissingModuleSource = "error"
reportMissingSuperCall = "error"
reportPropertyTypeMismatch = "error"
reportShadowedImports = "error"
reportUninitializedInstanceVariable = "error"
reportUnnecessaryTypeIgnoreComment = "error"
reportUnusedCallResult = "none" # this can safely be ignored
strict = ["**"]
typeCheckingMode = "strict"
useLibraryCodeForTypes = true
[tool.pytest.ini_options]
addopts = "--cov-config=pyproject.toml"
filterwarnings = [
]
junit_family = "xunit2"
junit_logging = "all"
markers = [
'docs',
'order',
'slow'
]
pythonpath = "."
xfail_strict = true
[tool.pytest_env]
pytest_report_title = {skip_if_set = true, value = "Test Results"}
[tool.ruff]
line-length = 100
output-format = "concise"
src = ["."]
[tool.ruff.lint]
allowed-confusables = ["¸", "×"]
fixable = ["ALL"]
flake8-pytest-style = {mark-parentheses = false}
flake8-quotes = {docstring-quotes = "double"}
ignore = [
"COM812", # Trailing comma missing (handled by the formatter)
"FIX002", # Line contains TO DO, consider resolving the issue
"INP001", # File is part of an implicit namespace package. Add an `__init__.py`.
"ISC001", # single-line-implicit-string-concatenation (handled by formatter)
"T201", # `print` found
"TD002", # Missing author in TO DO
"TD003" # TD003 Missing issue link on the line following this TO DO
]
pydocstyle = {convention = "google"}
pylint = {max-args = 7}
# https://beta.ruff.rs/docs/rules/
select = [
"ALL"
]
task-tags = ["FIXME", "FUTURE", "RELIC", "TODO"]
[tool.ruff.lint.isort]
force-sort-within-sections = false
known-first-party = []
lines-between-types = 1
order-by-type = false
[tool.ruff.lint.per-file-ignores]
"tests/**" = [
"PLR2004", # Magic value used in comparison
"S101" # Use of assert detected
]
[tool.semantic_release]
build_command = """
python -m scripts.bump_version_in_files
"""
version_toml = [
"pyproject.toml:tool.poetry.version"
]
[tool.semantic_release.changelog]
exclude_commit_patterns = []
template_dir = "python_semantic_release_templates"
[tool.semantic_release.changelog.environment]
extensions = []
[tool.semantic_release.commit_parser_options]
# These settings allow python-semantic-release to be used without triggering on any commits
allowed_tags = []
minor_tags = []
patch_tags = []
[tool.tomlsort]
all = true
in_place = true
spaces_before_inline_comment = 2
overrides."tool.poetry.*".inline_arrays = false
[tool.tox]
legacy_tox_ini = """
[tox]
requires = tox>4
no_package = True
envlist = py312,tests,docs,doctests
skip_missing_interpreters = False
[gh-actions]
python =
3.12: py312
[testenv]
install_command = python -I -m pip install --upgrade --upgrade-strategy=eager {opts} {packages}
deps =
poetry
setenv =
# Skip pre-commit checks that are not needed
SKIP = file-contents-sorter
commands_pre =
python -m poetry install --sync
commands =
!tests: pre-commit run --all-files
pytest -vv -k "not test_docs" --showlocals --cov --junitxml={tox_root}/.results_{envname}/results.xml --cov-report=term --cov-report=xml:{tox_root}/.coverage_{envname}.xml --cov-report=html:{tox_root}/.results_{envname}/html --self-contained-html --html={tox_root}/.results_{envname}/results.html
[testenv:tests]
basepython = python
passenv =
pytest_report_title
setenv =
pytest_github_report = true
pytest_use_blanks = true
GITHUB_STEP_SUMMARY = {tox_root}/.results_{envname}/github_report.md
[testenv:docs]
commands_pre =
python -m poetry install --only docs
commands =
python -c "import shutil; shutil.rmtree('.results_{envname}', ignore_errors=True)"
mkdocs --verbose build --site-dir .results_{envname}
[testenv:doctests]
commands =
pytest -v -k "test_docs" --showlocals --junitxml={tox_root}/.results_{envname}/results.xml --self-contained-html --html={tox_root}/.results_{envname}/results.html
[testenv:export-reqs]
commands =
poetry export --without-hashes --without-urls --all-extras --only=actions-create_unique_testpypi_version --output=actions/create_unique_testpypi_version/requirements.txt
python scripts/remove_python_version_condition_from_req_file.py actions/create_unique_testpypi_version/requirements.txt
poetry export --without-hashes --without-urls --all-extras --only=actions-find_unreleased_changelog_items --output=actions/find_unreleased_changelog_items/requirements.txt
python scripts/remove_python_version_condition_from_req_file.py actions/find_unreleased_changelog_items/requirements.txt
poetry export --without-hashes --without-urls --all-extras --only=actions-update_development_dependencies --output=actions/update_development_dependencies/requirements.txt
python scripts/remove_python_version_condition_from_req_file.py actions/update_development_dependencies/requirements.txt
- pre-commit run -a requirements-txt-fixer
- pre-commit run -a trailing-whitespace
- pre-commit run -a end-of-file-fixer
"""
[tool.yamlfix]
comments_min_spaces_from_content = 1