-
Notifications
You must be signed in to change notification settings - Fork 237
/
pyproject.toml
432 lines (401 loc) · 12.8 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
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
[tool.ruff.format]
quote-style = "double"
indent-style = "tab"
skip-magic-trailing-comma = false
line-ending = "lf"
docstring-code-format = false
exclude = ["pyglossary/plugin_lib/ripemd128.py"]
[tool.ruff]
line-length = 88
target-version = "py310"
# Exclude a variety of commonly ignored directories.
exclude = [
"whitelist.py", # for vulture
"pyglossary/plugins/babylon_bgl/bgl_gzip.py",
"pyglossary/plugins/testformat.py",
"pyglossary/ui/gtk*_utils/__init__.py",
"pyglossary/ui/ui_qt.py",
"pyglossary/ui/progressbar/",
"pyglossary/reverse.py",
"wcwidth*",
".direnv",
".eggs",
".git",
".mypy_cache",
".nox",
".pants.d",
".ruff_cache",
".tox",
".venv",
"__pypackages__",
"_build",
"buck-out",
"build",
"dist",
"venv",
]
[tool.ruff.lint]
select = [
# "ANN", # flake8-annotationsq
"F", # Pyflakes
"E", # pycodestyle Error
"W", # pycodestyle Warning
"C90", # mccabe: C901: {name} is too complex ({complexity})
"I", # isort: unsorted-imports, missing-required-import
"D", # pydocstyle
"B", # flake8-bugbear
"UP", # pyupgrade
"YTT", # flake8-2020
"ASYNC1", # flake8-trio
"BLE", # flake8-blind-except
"B", # flake8-bugbear
"A", # flake8-builtins
"COM", # flake8-commas
# "CPY", # flake8-copyright --preview
"C4", # flake8-comprehensions
"DTZ", # flake8-datetimez
"T10", # flake8-debugger
"DJ", # flake8-django
"EXE", # flake8-executable
"FA", # flake8-future-annotations
"ISC", # flake8-implicit-str-concat
"ICN", # flake8-import-conventions
"G", # flake8-logging-format
"INP", # flake8-no-pep420
"PIE", # flake8-pie
"T20", # flake8-print
"PYI", # flake8-pyi
"PT", # flake8-pytest-style
"Q", # flake8-quotes
"RSE", # flake8-raise
"RET", # flake8-return
"SLF", # flake8-self
"SLOT", # flake8-slots
"SIM", # flake8-simplify
"TID", # flake8-tidy-imports
"TCH", # flake8-type-checking
"INT", # flake8-gettext
"ARG", # flake8-unused-arguments
# "PTH", # flake8-use-pathlib
"PD", # pandas-vet
"PGH", # pygrep-hooks
"PL", # Pylint
# "TRY", # tryceratops, they all sound BS
# "FLY", # flynt
"NPY", # NumPy-specific rules
"AIR", # Airflow
"PERF", # Perflint
"FURB", # refurb --preview
"LOG", # flake8-logging
"RUF", # Ruff-specific rules
]
ignore = [
"ANN401", # Dynamically typed expressions (typing.Any) are disallowed in ...
"ANN003", # Missing type annotation for `**kwargs`, 22 remaining
"PYI042", # Type alias `...` should be CamelCase FIXME
"RUF039", # First argument to `re.compile()` is not raw string
"FURB189",
# FURB189 Subclassing `dict` can be error prone, use `collections.UserDict` instead
# FURB189 Subclassing `str` can be error prone, use `collections.UserStr` instead
"COM812",
"ISC001",
"SLF", # Private member accessed
"PYI034", # py3.11: `__iadd__` methods in classes like `SqEntryList` usually return `self` at runtime
"DTZ001", # The use of `datetime.datetime()` without `tzinfo` argument is not allowed
"DTZ005", # The use of `datetime.datetime.now()` without `tz` argument is not allowed
"PGH003", # Use specific rule codes when ignoring type issues
"PLR0914", # Too many local variables, 17 cases, --preview
"PLR0917", # Too many positional arguments, 23 cases, --preview
"PLR0915", # Too many statements, 28 cases
"FURB166", # Use of `int` with explicit `base=16` after removing prefix
"FURB103", # `open` and `write` should be replaced by `Path(...
"PLR2004", # Magic value used in comparison, consider replacing `...` with a constant variable
"PLC0415", # `import` should be at the top-level of a file
"PLW0603", # Using the global statement to update `mockLog` is discouraged
"PT027", # Use `pytest.raises` instead of unittest-style `assertRaises`, why?
"PD011", # Use `.to_numpy()` instead of `.values`, WTF?
"ICN001", # `tkinter` should be imported as `tk`, WTF?
"RUF005", # Consider `[*_list, x]` instead of concatenation
"PT009", # Use a regular `assert` instead of unittest-style `assertEqual`, why?
"PLR0911", # Too many return statements (x > 6)
"RUF012", # Mutable class attributes should be annotated with `typing.ClassVar`
"BLE001", # Do not catch blind exception: `Exception`
"G004", # Logging statement uses f-string, WTF?
"TRY400", # Use `logging.exception` instead of `logging.error`
"TRY003", # Avoid specifying long messages outside the exception class, ???
"RUF100", # Unused `noqa` directive (non-enabled: ...)
"FURB101", # `open` and `read` should be replaced by `Path(rootConfJsonFile).read_text()`
"B019", # Use of `functools.lru_cache` or `functools.cache` on methods can lead to memory leaks
"D100", # Missing docstring in public module
"D101", # Missing docstring in public class
"D102", # Missing docstring in public method
"D103", # Missing docstring in public function
"D104", # Missing docstring in public package
"D105", # Missing docstring in magic method
"D107", # Missing docstring in `__init__`
"D205", # 1 blank line required between summary line and description
"D206", # Docstring should be indented with spaces, not tabs
"D211", # (Do not enable) no-blank-line-before-class
"D212", # multi-line-summary-first-line, conflicts with D213:multi-line-summary-second-line
"D401", # First line of docstring should be in imperative mood
"D417", # Missing argument descriptions in the docstring
"E402", # Module level import not at top of file
"E721", # Do not compare types, use `isinstance()`
"SIM105", # Use contextlib.suppress({exception}) instead of try-except-pass
"SIM117", # Use a single with statement with multiple contexts...
"UP009", # UTF-8 encoding declaration is unnecessary
"UP037", # Remove quotes from type annotation
"W191", # Indentation contains tabs
"SIM115", # Use context handler for opening files
]
# Allow autofix for all enabled rules (when `--fix`) is provided.
unfixable = []
# Allow unused variables when underscore-prefixed.
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
mccabe.max-complexity = 13 # Unlike Flake8, default to a complexity level of 10.
[tool.ruff.lint.per-file-ignores]
"pyglossary/glossary.py" = ["ANN"]
"*_types.py" = [
"TC003", # Move standard library import `...` into a type-checking block
]
"pyglossary/plugins/**/*.py" = [
"PLR0904", # Too many public methods
"C90", # mccabe: C901: {name} is too complex ({complexity})
]
"slob.py" = [
"C901", # `...` is too complex (14 > 13)
"ANN",
]
"html_dir.py" = [
"C901", # `...` is too complex
]
"zimfile.py" = [
"C901", # `...` is too complex
]
"pyglossary/plugins/babylon_bgl/*.py" = [
"C901", # `...` is too complex
]
"pyglossary/html_utils.py" = ["RUF003"]
"persian_utils.py" = ["RUF001"]
"ru.py" = ["RUF001", "RUF003"]
"pyglossary/plugins/dikt_json.py" = ["RUF003"]
"pyglossary/plugin_lib/*.py" = [
"ANN",
"PT018", # Assertion should be broken down into multiple parts
"D",
"RUF015", # Prefer `next(zip(*_list, strict=False))` over single element slice
"PLR2004", # Magic value used in comparison, consider replacing `...` with a constant variable
]
"scripts/wiki-formats.py" = ["E501"]
"pyglossary/io_utils.py" = ["ANN"]
"pyglossary/plugins/babylon_bgl/bgl_reader_debug.py" = ["ANN", "FURB"]
"pyglossary/ui/**/*.py" = [
"ANN",
"T201",
"PERF203",
"PLR0904", # Too many public methods
"PLR0912", # Too many branches
"PLR6301", # Method `...` could be a function, class method, or static method
"C90", # mccabe: C901: {name} is too complex ({complexity})
]
"tests/*.py" = [
"ANN",
"T201",
"PLR6301", # Method `...` could be a function, class method, or static method
"E501", # Line too long
]
"*_test.py" = [
"ANN",
"T201",
"RUF001", # String contains ambiguous ... (ARABIC LETTER ...). Did you mean `l` ...
"PLR0904", # Too many public methods
]
"test.py" = ["ANN", "T201"]
"scripts/*.py" = ["ANN", "T201", "INP001"]
"scripts/*/*.py" = ["ANN", "T201", "INP001"]
"doc/lib-examples/*.py" = ["ANN", "INP"]
[tool.mypy]
exclude = [
# '.*/plugin_lib/.*',
]
[tool.refurb]
ignore = [
117, # Replace `open(filename, "rb")` with `filename.open("rb")`
184, # Assignment statement should be chained
101, # Replace `with open(x, ...) as f: y = f.read()` with `y = Path(x).read_bytes()`
103, # Replace `with open(x, ...) as f: f.write(y)` with `Path(x).write_bytes(y)`
104, # Replace `os.getcwd()` with `Path.cwd()`
107, # Replace `try: ... except OSError: pass` with `with suppress(OSError): ...`
141, # Replace `os.path.exists(x)` with `Path(x).exists()`
144, # Replace `os.remove(x)` with `Path(x).unlink()`
146, # Replace `os.path.isfile(x)` with `Path(x).is_file()`
150, # Replace `os.makedirs(x)` with `Path(x).mkdir(parents=True)`
155, # Replace `os.path.getsize(x)` with `Path(x).stat().st_size`
]
# refurb has no exclude param!
#load = ["some_module"]
#quiet = true
[tool.pylint.messages_control]
max-line-length = 88
disable = [
"no-member",
"no-name-in-module",
"missing-module-docstring",
"bad-indentation",
"invalid-name",
"logging-fstring-interpolation",
"too-many-arguments",
"broad-exception-caught",
"missing-function-docstring",
"unused-argument",
"import-outside-toplevel",
"missing-class-docstring",
"too-many-instance-attributes",
"fixme",
"redefined-builtin",
"pointless-statement",
"abstract-method",
"unidiomatic-typecheck",
"attribute-defined-outside-init",
"unspecified-encoding",
"super-init-not-called",
"redefined-slots-in-subclass",
"redefined-outer-name",
"wrong-import-position",
"too-few-public-methods",
"too-many-lines",
"too-many-public-methods",
"too-many-statements",
"too-many-locals",
"too-many-branches",
"too-many-return-statements",
"unused-import",
"import-error",
"protected-access",
"consider-using-with",
"disallowed-name",
"useless-return",
"method-cache-max-size-none",
"global-statement",
"R0801", # Similar lines in 2 files
"ungrouped-imports", # C0412: Imports from package pyglossary are not grouped
"inconsistent-return-statements", # R1710: Either all return statements in a function should return an expression, or none of them should
"too-many-ancestors", # R0901: Too many ancestors
]
[tool.pylint.master]
ignore-paths = [
"^pyglossary/reverse.py$",
"^pyglossary/ui/progressbar/.*",
"^pyglossary/ui/ui_qt.py$",
"^pyglossary/ui/wcwidth/",
]
[tool.vulture]
exclude = [
"build/",
"tests/",
"*_test.py",
"test.py",
"pyglossary/ui/",
"*_types.py",
"pyglossary/ui_type.py",
"pyglossary/reverse.py",
"doc/lib-examples/",
"pyglossary/plugin_lib/",
]
# ignore_decorators = ["@require_*"]
ignore_names = [
"_*",
"Generator",
"GLOSSARY_API_VERSION",
# "Iterable", "AnyStr",
# "RawEntryType",
# "EntryListType",
]
make_whitelist = true
min_confidence = 60
# paths = []
sort_by_size = false
verbose = false
[tool.import-analyzer]
exclude = ["pyglossary/ui/wcwidth/", "build/"]
[tool.pyright]
pythonVersion = "3.10"
pythonPlatform = "Linux"
reportMissingImports = "error"
reportMissingTypeStubs = false
exclude = [
"pyglossary/slob.py",
"setup.py",
"whitelist.py", # for vulture
# "pyglossary/ui/gtk4_utils/*",
# "pyglossary/ui/gtk3_utils/*",
"pyglossary/plugins/babylon_bgl/bgl_gzip.py",
"pyglossary/plugins/testformat.py",
# "pyglossary/plugin_lib/*",
"pyglossary/ui/gtk*_utils/__init__.py",
"pyglossary/ui/ui_qt.py",
"pyglossary/ui/progressbar/",
"pyglossary/reverse.py",
"wcwidth*",
".direnv",
".eggs",
".git",
".mypy_cache",
".nox",
".pants.d",
".ruff_cache",
".tox",
".venv",
"__pypackages__",
"_build",
"buck-out",
"build",
"dist",
"venv",
]
[tool.fixit]
disable = ["fixit.rules.no_namedtuple"]
[[tool.fixit.overrides]]
path = "pyglossary/reverse.py"
disable = ["fixit.rules"]
[[tool.fixit.overrides]]
path = "pyglossary/ui/wcwidth/"
disable = ["fixit.rules"]
[[tool.fixit.overrides]]
path = "pyglossary/ui/progressbar/"
disable = ["fixit.rules"]
[build-system]
requires = [
"setuptools", # min version?
# "setuptools_scm[toml] >= 4, <6",
# "setuptools_scm_git_archive",
# "wheel >= 0.29.0",
]
build-backend = "setuptools.build_meta"
[project]
name = "pyglossary"
version = "5.0.2"
description = "A tool for converting dictionary files aka glossaries."
readme = "README.md"
authors = [{ name = "Saeed Rasooli", email = "[email protected]" }]
license = { text = "GPLv3+" }
keywords = ["dictionary", "glossary"]
classifiers = [
"Development Status :: 5 - Production/Stable",
"License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)",
"Operating System :: Unix",
"Operating System :: MacOS :: MacOS X",
"Operating System :: Microsoft :: Windows",
"Typing :: Typed",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
]
requires-python = ">= 3.10"
dependencies = []
[project.optional-dependencies]
all = ["PyICU", "lxml", "beautifulsoup4"]
[project.urls]
"Source code" = "https://github.com/ilius/pyglossary"
Changelog = "https://github.com/ilius/pyglossary/tree/master/doc/releases"
"Issue tracker" = "https://github.com/ilius/pyglossary/issues"