-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathpyproject.toml
More file actions
249 lines (236 loc) · 12.3 KB
/
pyproject.toml
File metadata and controls
249 lines (236 loc) · 12.3 KB
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
[build-system]
requires = ["setuptools>=61.0", "wheel"]
build-backend = "setuptools.build_meta"
[project]
name = "mel"
dynamic = ["version"]
description = "Mole Evolution Laboratory"
authors = [
{name = "Angelos Evripiotis"}
]
readme = "README.md"
license = {text = "MIT"}
requires-python = ">=3.13"
dependencies = [
"colorama",
"opencv-python",
"pandas",
"pygame",
"pytorch-lightning",
"timm>=1.0.20",
"torch",
"torchvision",
"tqdm",
"wandb",
]
[project.optional-dependencies]
dev = [
"ty",
"pytest",
"ruff",
"vulture",
]
[project.scripts]
mel = "mel.cmd.mel:main"
mel-debug = "mel.cmddebug.meldebug:main"
[project.urls]
Homepage = "https://github.com/aevri/mel"
Repository = "https://github.com/aevri/mel"
[tool.setuptools]
packages = [
"mel",
"mel.cmd",
"mel.cmddebug",
"mel.lib",
"mel.micro",
"mel.rotomap",
]
zip-safe = false
[tool.setuptools.dynamic]
version = {attr = "mel.__version__"}
[tool.ruff]
target-version = "py313"
[tool.ruff.lint]
# Rule codes enabled for static analysis:
# - A: flake8-builtins (prevent shadowing built-ins)
# - B: flake8-bugbear (likely bugs and design problems)
# - C4: flake8-comprehensions (better list/set/dict comprehensions)
# - FURB: refurb (modernize Python code)
# - N: pep8-naming (naming conventions)
# - PLE: pylint errors (subset of pylint)
# - PLW: pylint warnings (global statements, unnecessary comparisons, etc.)
# - I: isort (import sorting and organization)
# - W: pycodestyle warnings (whitespace and formatting issues)
# - F: pyflakes (unused imports, variables, undefined names)
# - PIE: flake8-pie (miscellaneous lints and performance improvements)
# - Q: flake8-quotes (enforce consistent quote style)
# - T10: flake8-debugger (detect debugger imports like pdb)
# - ISC: flake8-implicit-str-concat (implicit string concatenation issues)
# - RET: flake8-return (return statement improvements)
# - SIM: flake8-simplify (code simplification opportunities)
# - UP: pyupgrade (upgrade Python syntax for newer versions)
# - RUF: ruff-specific (ruff-specific linting rules)
# - PT: flake8-pytest-style (pytest style improvements)
# - PERF: perflint (performance anti-patterns)
# - RSE: flake8-raise (remove unnecessary parentheses on raised exceptions)
# - EXE: flake8-executable (shebang line checks)
# - ERA: eradicate (detect and remove commented-out code)
# - ARG: flake8-unused-arguments (unused function/method arguments)
# - DTZ: flake8-datetimez (enforce timezone-aware datetime usage)
# - FA: flake8-future-annotations (future annotations best practices)
# - FLY: flynt (prefer f-strings over static string joins)
# - G: flake8-logging-format (logging statement formatting)
# - INT: flake8-gettext (gettext/internationalization best practices)
# - LOG: flake8-logging (logging module usage)
# - PD: pandas-vet (pandas best practices)
# - PGH: pygrep-hooks (blanket type:ignore/noqa, eval usage)
# - SLOT: flake8-slots (__slots__ for immutable classes)
# - TC: flake8-type-checking (move imports to TYPE_CHECKING blocks)
# - TID: flake8-tidy-imports (banned imports and relative parent imports)
# - YTT: flake8-2020 (sys.version misuse)
# - ASYNC: flake8-async (async best practices)
# - INP: flake8-no-pep420 (no implicit namespace packages, require __init__.py)
# - ICN: flake8-import-conventions (enforce standard import aliases like numpy as np)
# - SLF: flake8-self (prevent access to private members of other classes)
# - FBT: flake8-boolean-trap (avoid boolean positional args and defaults)
# - NPY: numpy (enforce modern numpy random API and deprecated usage)
# - PTH: flake8-use-pathlib (prefer pathlib over os.path)
# - PYI: flake8-pyi (type stub and typing best practices)
# - EM101: flake8-errmsg (no string literals in exception constructors, keeps raise lines short in tracebacks)
# - EM102: flake8-errmsg (no f-strings in exception constructors, keeps raise lines short in tracebacks)
# - EM103: flake8-errmsg (no .format() in exception constructors, keeps raise lines short in tracebacks)
# - TRY002: tryceratops (create your own exception, avoid raising vanilla Exception)
# - TRY003: tryceratops (avoid specifying long messages outside exception class)
# - TRY004: tryceratops (prefer TypeError for invalid type checks)
# - TRY201: tryceratops (verbose raise, use bare `raise` in except blocks)
# - TRY300: tryceratops (move return/break/continue out of try, use else block)
# - TRY301: tryceratops (abstract raise to an inner function, avoid raise within try)
# - TRY400: tryceratops (use logging.exception instead of logging.error in except blocks)
# - TRY401: tryceratops (avoid verbose log messages, don't pass exception as redundant arg)
# - PLR01: pylint refactor (comparison-with-itself, comparison-of-constant)
# - PLR1: pylint refactor (argument redefinition, comparison merging)
# - PLR5: pylint refactor (collapsible else/elif blocks)
# - PLR02: pylint refactor (enforce classmethod/staticmethod decorators, no property params)
# - PLR04: pylint refactor (use from-import for module aliasing)
# - PLR0911: pylint refactor (limit return statements per function)
# - ANN201: flake8-annotations (missing return type annotation for public function)
# - ANN204: flake8-annotations (missing return type annotation for special method)
# - ANN205: flake8-annotations (missing return type annotation for staticmethod)
# - ANN206: flake8-annotations (missing return type annotation for classmethod)
# - ANN002: flake8-annotations (missing type annotation for *args)
# - ANN003: flake8-annotations (missing type annotation for **kwargs)
# - ANN401: flake8-annotations (disallow Any type in annotations)
# - TRY203: tryceratops (useless try-except, re-raises without modification)
# - S2: flake8-bandit (flask debug, tarfile unsafe members)
# - S4: flake8-bandit (suspicious imports: telnet, ftp, pickle, XML, etc.)
# - S5: flake8-bandit (SSL/crypto: cert validation, unsafe yaml, SSH)
# - S3: flake8-bandit (hashlib insecure, pseudo-random generators, pickle, XML, URL open)
# - S7: flake8-bandit (template security: jinja2, mako, unsafe markup)
# - S108: flake8-bandit (insecure usage of temporary file or directory)
# - S102: flake8-bandit (exec builtin usage)
# - S105: flake8-bandit (hardcoded password strings)
# - S106: flake8-bandit (hardcoded password function arguments)
# - S107: flake8-bandit (hardcoded password default values)
# - S110: flake8-bandit (try-except-pass, silencing exceptions)
# - S112: flake8-bandit (try-except-continue, silencing exceptions)
# - S103: flake8-bandit (os.chmod setting permissive file permissions)
# - S104: flake8-bandit (binding to all interfaces, 0.0.0.0)
# - S113: flake8-bandit (request without timeout)
# - S601: flake8-bandit (paramiko shell command execution)
# - S602: flake8-bandit (subprocess.Popen with shell=True)
# - S604: flake8-bandit (function call with shell=True)
# - S605: flake8-bandit (starting process with a shell, e.g. os.system)
# - S606: flake8-bandit (starting process without shell)
# - S607: flake8-bandit (starting process with partial executable path)
# - S608: flake8-bandit (hardcoded SQL expression)
# - S609: flake8-bandit (wildcard injection in subprocess call)
# - S610: flake8-bandit (Django extra used with user input)
# - S611: flake8-bandit (Django RawSQL used)
# - S612: flake8-bandit (logging.config.listen used)
# - PLC: pylint convention (type naming, import aliases, len-test, compare-to-empty-string,
# non-ASCII names, import-private-name, unnecessary dunder/lambda calls, iteration-over-set)
# - BLE: flake8-blind-except (prevent catching blind Exception)
# - D2: pydocstyle (docstring whitespace and formatting rules)
# - D3: pydocstyle (docstring quoting, use triple double-quotes)
# - D4: pydocstyle (docstring content: blank lines, argument descriptions)
# - D100: pydocstyle (require docstrings in public modules)
# - D104: pydocstyle (require docstrings in public packages / __init__.py)
# - D105: pydocstyle (require docstrings in magic methods)
# - D106: pydocstyle (require docstrings in public nested classes)
# - TD001: flake8-todos (invalid TODO tag, must use TODO)
# - TD004: flake8-todos (missing colon after TODO)
# - TD005: flake8-todos (missing description after TODO)
# - TD006: flake8-todos (invalid TODO capitalization, must be uppercase)
# - TD007: flake8-todos (missing space after colon in TODO)
# - E: pycodestyle errors (indentation, whitespace, syntax, line length)
# - FIX001: flake8-fixme (line contains FIXME)
# - FIX003: flake8-fixme (line contains XXX)
# - FIX004: flake8-fixme (line contains HACK)
# Evaluated and rejected:
# - TRY3: all existing violations are intentional (exception type conversion, fallback returns)
# - COM812: conflicts with ruff formatter (formatter uses trailing commas as formatting signals)
# - S101: assert is used extensively in tests and validation code
# - S603: all subprocess calls use trusted/hardcoded inputs (test helpers, internal tools)
# Deferred pending public interface review (large violation counts):
# - D101: undocumented public class (105 violations)
# - D102: undocumented public method (350 violations)
# - D103: undocumented public function (323 violations)
# - D107: undocumented public init (58 violations)
# Enabling these requires reviewing which classes/functions are genuinely public API
# vs internal implementation details that could be made private or given docstrings.
extend-select = ["A", "B", "BLE", "C4", "D100", "D104", "D105", "D106", "D2", "D3", "D4", "E", "EM101", "EM102", "EM103", "ERA", "FURB", "N", "NPY", "PLC", "PLE", "PLW", "PLR01", "PLR02", "PLR0911", "PLR1", "PLR04", "PLR5", "I", "W", "F", "PIE", "Q", "T10", "ISC", "RET", "SIM", "UP", "RUF", "PT", "PERF", "RSE", "EXE", "ARG", "DTZ", "FA", "FIX001", "FIX003", "FIX004", "FLY", "G", "INT", "LOG", "PD", "PGH", "PYI", "SLOT", "TC", "TID", "TRY002", "TRY003", "TRY004", "TRY201", "TRY203", "TRY300", "TRY301", "TRY400", "TRY401", "ANN002", "ANN003", "ANN201", "ANN202", "ANN204", "ANN205", "ANN206", "ANN401", "YTT", "S2", "S3", "S4", "S5", "S7", "S102", "S103", "S104", "S105", "S106", "S107", "S108", "S110", "S112", "S113", "S601", "S602", "S604", "S605", "S606", "S607", "S608", "S609", "S610", "S611", "S612", "TD001", "TD004", "TD005", "TD006", "TD007", "ASYNC", "INP", "ICN", "SLF", "FBT", "PTH"]
# D203 and D213 conflict with D211 and D212 respectively; ignore the unwanted ones
# PLC0415: codebase intentionally uses late imports for startup performance
ignore = ["D203", "D213", "PLC0415"]
[tool.ruff.lint.per-file-ignores]
# These files contain intentionally commented-out code kept for reference
"mel/lib/fs.py" = ["ERA001"]
"mel/rotomap/automarknn.py" = ["ERA001"]
[tool.vulture]
ignore_names = ["training_step", "validation_step", "configure_optimizers"]
exclude = ["*__t.py", "mel/rotomap/detectmoles.py", "mel/rotomap/identifynn.py"]
[tool.ty.environment]
python-version = "3.13"
[tool.ty.rules]
# Promoted from default "error" (already enforced, now explicit)
possibly-unresolved-reference = "error"
possibly-missing-attribute = "error"
possibly-missing-import = "error"
unresolved-reference = "error"
unsupported-dynamic-base = "error"
deprecated = "error"
division-by-zero = "error"
# Promoted from default "warn" to "error"
ambiguous-protocol-member = "error"
ignore-comment-unknown-rule = "error"
ineffective-final = "error"
invalid-enum-member-annotation = "error"
invalid-ignore-comment = "error"
invalid-legacy-positional-parameter = "error"
possibly-missing-implicit-call = "error"
possibly-missing-submodule = "error"
redundant-cast = "error"
redundant-final-classvar = "error"
undefined-reveal = "error"
unresolved-global = "error"
unsupported-base = "error"
unused-awaitable = "error"
unused-ignore-comment = "error"
unused-type-ignore-comment = "error"
useless-overload-body = "error"
# -----------------------------------------------------------------------------
# Copyright (C) 2026 Angelos Evripiotis.
# Generated with assistance from Claude Code.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ------------------------------ END-OF-FILE ----------------------------------