-
Notifications
You must be signed in to change notification settings - Fork 0
/
pyproject.toml
306 lines (243 loc) · 10.9 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
[build-system]
requires = ["setuptools>=61.0"]
build-backend = "setuptools.build_meta"
[project]
name = "igbpyutils"
description = "Various Python Utilities"
version = "0.8.0"
authors = [ { name="Hauke D", email="haukex@zero-g.net" } ]
readme = "README.rst"
requires-python = ">=3.9"
dynamic = ["dependencies"]
classifiers = [
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"Operating System :: POSIX",
"Operating System :: Microsoft :: Windows",
"Operating System :: MacOS :: MacOS X",
"Development Status :: 5 - Production/Stable",
"Topic :: Software Development :: Libraries",
]
[tool.setuptools]
packages = ["igbpyutils", "igbpyutils.dev", "igbpyutils.dev.script_vs_lib"]
[tool.setuptools.dynamic]
dependencies = {file = ["requirements.txt"]}
[project.scripts]
py-check-script-vs-lib = "igbpyutils.dev.script_vs_lib:main"
[project.urls]
"Homepage" = "https://github.com/haukex/igbpyutils"
"Bug Tracker" = "https://github.com/haukex/igbpyutils/issues"
"Documentation" = "https://igbpyutils.readthedocs.io/en/stable/"
"Changelog" = "https://igbpyutils.readthedocs.io/en/latest/changelog.html"
# alternative: https://github.com/haukex/igbpyutils/blob/main/docs/changelog.rst
# ##### ##### ##### ##### ##### Hauke's Python Type Checker / Linter Settings ##### ##### ##### ##### #####
# Individual lines can be ignored with:
# pylance: ``# pyright: ignore [settingName]``
# pylint: ``# pylint: disable=setting-name``
# flake8: ``# noqa: CODE``
# mypy: ``# type: ignore[setting-name]``
# coverage: ``# pragma: no cover``, ``# pragma: no branch``, and https://pypi.org/project/coverage-simple-excludes/
# ##### ##### ##### ##### ##### https://github.com/microsoft/pyright/blob/main/docs/configuration.md ##### ##### ##### ##### #####
[tool.pyright]
typeCheckingMode = "strict"
reportMissingTypeStubs = "none"
reportUnknownMemberType = "none"
reportUnknownArgumentType = "none"
reportUnknownVariableType = "none"
reportUnknownParameterType = "none"
reportUnknownLambdaType = "none"
reportMissingParameterType = "none"
reportMissingTypeArgument = "none"
reportGeneralTypeIssues = "none" # too bad there isn't more fine-grained control than this
reportUnnecessaryTypeIgnoreComment = "none" # this flags too many comments; we use mypy's `warn_unused_ignores` instead
reportShadowedImports = "warning"
reportImportCycles = "error"
reportPropertyTypeMismatch = "warning"
# ##### ##### ##### ##### ##### https://coverage.readthedocs.io/en/latest/config.html ##### ##### ##### ##### #####
[tool.coverage.run]
plugins = ["coverage_simple_excludes"]
command_line = "-m unittest -v"
branch = true
omit = [
"**/.venv*/**",
# "somefile*",
]
[tool.coverage.report]
show_missing = true
skip_covered = false
# don't do the following; it'll prevent the report from being generated (see Makefile)
#fail_under = 100
[tool.coverage.xml]
output = "coverage.xml"
# ##### ##### ##### ##### ##### https://flake8.pycqa.org/en/stable/user/configuration.html ##### ##### ##### ##### #####
[tool.flake8]
extend-ignore = [
# NOTE the following is commented out because otherwise `coverage`'s reports aren't always correct.
#"E701", # Multiple statements on one line (colon)
"E262", # Inline comment should start with '# '
"E265", # Block comment should start with '# '
"E201", # Whitespace after '('
"E202", # Whitespace before ')'
"E203", # Whitespace before ':'
"E231", # Missing whitespace after ',', ';', or ':'
"E227", # Missing whitespace around bitwise or shift operator
"E251", # Unexpected spaces around keyword / parameter equals
"E252", # Missing whitespace around parameter equals
"E221", # Multiple spaces before operator
"E225", # Missing whitespace around operator
"E128", # Continuation line under-indented for visual indent
"E301", # Expected 1 blank line, found 0
"E302", # Expected 2 blank lines, found 0
"E305", # Expected 2 blank lines after end of function or class
"E306", # Expected 1 blank line before a nested definition
]
# NOTE: Keep in sync with pylint settings.
max-line-length = 150
# ##### ##### ##### ##### ##### https://mypy.readthedocs.io/en/stable/config_file.html ##### ##### ##### ##### #####
[tool.mypy]
enable_error_code = [ "ignore-without-code" ]
ignore_missing_imports = true
check_untyped_defs = true
#disallow_incomplete_defs = true # This would require a lot of `-> None` and such
warn_redundant_casts = true
warn_unused_ignores = true
warn_return_any = true
warn_unreachable = true
# in regards to the following see also https://github.com/python/mypy/issues/8046
local_partial_types = true
implicit_reexport = false
strict_equality = true
warn_unused_configs = true
# ##### ##### ##### ##### ##### https://pylint.readthedocs.io/en/latest/user_guide/configuration/all-options.html ##### ##### ##### #####
# pylint --rcfile=pyproject.toml --generate-toml-config
[tool.pylint.main]
# Clear in-memory caches upon conclusion of linting. Useful if running pylint in
# a server-like mode.
clear-cache-post-run = true
# Return non-zero exit code if any of these messages/categories are detected,
# even if score is above --fail-under value. Syntax same as enable. Messages
# specified are enabled, while categories only check already-enabled messages.
fail-on = "I" # informational, wouldn't normally fail
# Specify a score threshold under which the program will exit with error.
fail-under = 10.0
# List of module names for which member attributes should not be checked (useful
# for modules/projects where namespaces are manipulated during runtime and thus
# existing member attributes cannot be deduced by static analysis). It supports
# qualified module names, as well as Unix pattern matching.
ignored-modules = ["ldap"]
# Use multiple processes to speed up Pylint. Specifying 0 will auto-detect the
# number of processors available to use, and will cap the count on Windows to
# avoid hangs.
jobs = 0
# When enabled, pylint would attempt to guess common misconfiguration and emit
# user-friendly hints instead of false-positive error messages.
suggestion-mode = true
[tool.pylint.basic]
# Naming style matching correct class attribute names.
class-attribute-naming-style = "snake_case"
# Good variable names which should always be accepted, separated by a comma.
good-names = ["i", "ex", "fh", "_"]
# Include a hint for the correct naming format with invalid-name.
include-naming-hint = true
# Naming style matching correct inline iteration names.
inlinevar-naming-style = "snake_case"
[tool.pylint.design]
# Maximum number of arguments for function / method.
max-args = 20
# too-many-positional-arguments default is 5
max-positional-arguments = 4
# Maximum number of attributes for a class (see R0902).
max-attributes = 10
# Maximum number of boolean expressions in an if statement (see R0916).
max-bool-expr = 5
# Maximum number of branch for function / method body.
max-branches = 30
# Maximum number of locals for function / method body.
max-locals = 15
# Maximum number of parents for a class (see R0901).
max-parents = 7
# Maximum number of public methods for a class (see R0904).
max-public-methods = 20
# Maximum number of return / yield for function / method body.
max-returns = 6
# Maximum number of statements in function / method body.
max-statements = 70
[tool.pylint.exceptions]
# Exceptions that will emit a warning when caught.
overgeneral-exceptions = ["builtins.BaseException"]
[tool.pylint.format]
# Expected format of line ending, e.g. empty (any line ending), LF or CRLF.
expected-line-ending-format = "LF"
# Regexp for a line that is allowed to be longer than the limit.
ignore-long-lines = "^\\s*(# )?<?https?://\\S+>?$"
# Maximum number of characters on a single line.
# NOTE: Keep in sync with flake8 settings.
max-line-length = 150
# Maximum number of lines in a module.
max-module-lines = 500
# Allow the body of a class to be on the same line as the declaration if body
# contains single statement.
single-line-class-stmt = true
# Allow the body of an if to be on the same line as the test if there is no else.
# NOTE the following is now `false` because otherwise `coverage`'s reports aren't always correct.
single-line-if-stmt = false
[tool.pylint.imports]
# Allow explicit reexports by alias from a package __init__.
allow-reexport-from-package = true
# Allow wildcard imports from modules that define __all__.
allow-wildcard-with-all = true
[tool.pylint."messages control"]
# Disable the message, report, category or checker with the given id(s). You can
# either give multiple identifiers separated by comma (,) or put this option
# multiple times (only on the command line, not in the configuration file where
# it should appear only once). You can also use "--disable=all" to disable
# everything first and then re-enable specific checks. For example, if you want
# to run only the similarities checker, you can use "--disable=all
# --enable=similarities". If you want to run only the classes checker, but have
# no Warning level messages displayed, use "--disable=all --enable=classes
# --disable=W".
disable = [
"locally-disabled",
"file-ignored",
"suppressed-message",
"missing-module-docstring",
"missing-function-docstring",
"missing-class-docstring",
"too-few-public-methods",
# NOTE the following is commented out because otherwise `coverage`'s reports aren't always correct.
#"multiple-statements",
"fixme"]
# Enable the message, report, category or checker with the given id(s). You can
# either give multiple identifier separated by comma (,) or put this option
# multiple time (only on the command line, not in the configuration file where it
# should appear only once). See also the "--disable" option for examples.
enable = [
"raw-checker-failed",
"bad-inline-option",
"useless-suppression",
"deprecated-pragma",
"use-symbolic-message-instead",
"use-implicit-booleaness-not-comparison-to-string",
"use-implicit-booleaness-not-comparison-to-zero",
]
[tool.pylint.refactoring]
# Maximum number of nested blocks for function / method body
max-nested-blocks = 5
# Complete name of functions that never returns. When checking for inconsistent-
# return-statements if a never returning function is called then it will be
# considered as an explicit return statement and no message will be printed.
never-returning-functions = ["sys.exit", "argparse.parse_error", "argparse.exit"]
[tool.pylint.similarities]
# Minimum lines number of a similarity.
min-similarity-lines = 4
[tool.pylint.variables]
# A regular expression matching the name of dummy variables (i.e. expected to not
# be used).
dummy-variables-rgx = "_+$|(_[a-zA-Z0-9_]*[a-zA-Z0-9]+?$)"
# Argument names that match this expression will be ignored.
ignored-argument-names = "_.*"