-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpyproject.toml
305 lines (271 loc) · 8.51 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
[project]
name = "signalrgb"
version = "1.0.0"
description = "A Python client for SignalRGB"
readme = "README.md"
requires-python = ">=3.11"
license = { text = "Apache-2.0" }
authors = [{ name = "Stefanie Jane", email = "[email protected]" }]
dependencies = [
"requests>=2.32.3",
"httpx>=0.27.0",
"rich>=13.9.4",
"typer>=0.15.2",
"ruff>=0.9.10",
"pre-commit>=4.1.0",
"mashumaro>=3.15",
"urllib3>=1.26.5,<2",
"wcwidth>=0.2.13",
]
[dependency-groups]
dev = [
"pytest>=8.3.5",
"mkdocs>=1.6.1",
"mkdocs-material>=9.6.7",
"mkdocstrings[python]>=0.29.0",
"mypy>=1.15.0",
"pytest-cov>=6.0.0",
"types-requests>=2.31.0.6",
"types-setuptools>=75.8.2.20250305",
"semver>=3.0.4",
"pytest-asyncio>=0.25.3",
]
[project.urls]
Homepage = "https://github.com/hyperb1iss/signalrgb-python"
Issues = "https://github.com/hyperb1iss/signalrgb-python/issues"
Documentation = "https://hyperb1iss.github.io/signalrgb-python/"
[project.scripts]
signalrgb = "signalrgb.cli:app"
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[tool.hatch.build.targets.wheel]
packages = ["signalrgb"]
[tool.pytest.ini_options]
asyncio_mode = "auto"
addopts = "--cov=signalrgb --cov-report=term-missing"
testpaths = ["tests"]
asyncio_default_fixture_loop_scope = "function"
[tool.coverage.run]
source = ["signalrgb"]
[tool.coverage.report]
exclude_lines = [
"pragma: no cover",
"def __repr__",
"if __name__ == .__main__.:",
"raise NotImplementedError",
"pass",
"except ImportError:",
]
# Type checking configuration
[tool.mypy]
python_version = "3.11"
# Basic type checking
warn_return_any = true
warn_unused_configs = true
disallow_untyped_defs = true
disallow_incomplete_defs = true
# Enhanced type checking
disallow_any_generics = true
disallow_subclassing_any = true
disallow_untyped_calls = true
disallow_untyped_decorators = true
check_untyped_defs = true
# Warnings as errors for critical issues
error_summary = true
warn_redundant_casts = true
warn_unused_ignores = true
warn_no_return = true
warn_unreachable = true
# Strict equality checking
strict_equality = true
# Import discovery
namespace_packages = true
explicit_package_bases = true
# Error reporting
show_error_context = true
show_column_numbers = true
pretty = true
# Ignore missing imports
ignore_missing_imports = true
# Test files can be less strict
[[tool.mypy.overrides]]
module = ["tests.*"]
disallow_untyped_defs = false
disallow_incomplete_defs = false
check_untyped_defs = false
# Code formatting and linting configuration
[tool.ruff]
# General settings
line-length = 120
target-version = "py311"
src = ["signalrgb", "tests"]
extend-exclude = [".venv", "docs"]
[tool.ruff.lint]
# Rules to enable
select = [
# Core rules
"E", # pycodestyle errors
"W", # pycodestyle warnings
"F", # pyflakes
"I", # isort
"C", # flake8-comprehensions
"B", # flake8-bugbear
"N", # pep8-naming
"UP", # pyupgrade
"RUF", # ruff-specific rules
"PT", # pytest style
"SIM", # simplify
# Additional valuable rules
"ASYNC", # async/await best practices
"BLE", # blind except handling
"DTZ", # datetime handling
"G", # logging format string issues
"ICN", # import conventions
"PGH", # pygrep hooks
"PIE", # misc. linting
"PL", # pylint rules ported to ruff
"RET", # return value consistency
"RSE", # raise statement formatting
"S", # bandit (security)
"SLF", # private member access
"TRY", # try-except best practices
"COM", # trailing comma enforcement (except COM812 which conflicts with formatter)
"ERA", # eradicate (commented out code)
"T20", # print statements
"ARG", # unused arguments
]
# Rules to ignore
ignore = [
# Complexity - handled by pylint
"C901", # Function is too complex
"PLR0911", # Too many return statements
"PLR0912", # Too many branches
"PLR0913", # Too many arguments
"PLR0915", # Too many statements
"PLR2004", # Magic value in comparison
# Stylistic preferences
"RUF012", # Mutable class attributes should be annotated with typing.ClassVar
# Noise reduction - warnings that often produce false positives
"PLC0414", # Import alias does not rename variable
"PLR0904", # Too many public methods
"PLW0603", # Global statement usage
"PLW2901", # Outer loop variable overwritten
"PT011", # Too broad pytest.raises without match
"SIM102", # Nested if-statements (sometimes better for readability)
"SIM108", # Use ternary instead of if-else (often less readable)
"TRY003", # Avoid long messages in exceptions
# User-requested suppressions
"G004", # Don't warn about f-strings in logging
"PGH003", # Don't warn about unspecific # type: ignore comments
"RET502", # Don't warn about implicit return None
"RET503", # Don't warn about missing explicit return
"RET505", # Don't warn about elif after return
"TRY300", # Don't suggest moving return to else block
"TRY301", # Don't suggest abstracting raise to inner function
"TRY401", # Don't warn about redundant exception in logging.exception
# Security exceptions that make sense for this project
"S101", # Use of assert detected (fine for tests)
# Rule that conflicts with the formatter
"COM812", # Missing trailing comma in collection of items
]
# Import organization settings
[tool.ruff.lint.isort]
combine-as-imports = true
force-sort-within-sections = true
known-first-party = ["signalrgb"]
section-order = [
"future",
"standard-library",
"third-party",
"first-party",
"local-folder",
]
# File-specific rule adjustments
[tool.ruff.lint.per-file-ignores]
# Ignore unused imports in __init__ files
"__init__.py" = ["F401", "E402"]
# Typer-specific ignores
"signalrgb/cli.py" = [
"B008",
] # Typer requires function calls in argument defaults
# More relaxed rules for tests
"tests/**/*.py" = [
"ARG001", # Unused function arguments (common for fixtures)
"ARG002", # Unused function arguments (common for fixtures)
"ARG005", # Unused lambda arguments (common for fixtures)
"E501", # Allow longer lines in tests (assertions can get verbose)
"PIE790", # Allow unnecessary 'pass' statements in mocks
"PLR2004", # Allow magic numbers in tests
"PT018", # Allow complex assertions (common in tests to check multiple conditions)
"PT019", # Allow unused fixtures (they may be used implicitly)
"RET504", # Allow unnecessary assignment before return (clearer in tests)
"S101", # Allow asserts in tests
"S105", # Allow hardcoded passwords in variable assignments (it's just test data!)
"S106", # Allow hardcoded passwords as arguments (it's just test data!)
"S108", # Allow temp file usage in tests
"SLF001", # Allow private member access in tests
"BLE001", # Allow catching blind exceptions in tests
"DTZ001", # Allow naive datetime in tests
]
# Format settings for consistency
[tool.ruff.format]
quote-style = "double"
indent-style = "space"
line-ending = "auto"
docstring-code-format = true
docstring-code-line-length = 80
# Pylint configuration - only for things Ruff can't handle
[tool.pylint]
py-version = "3.11"
jobs = 2
max-line-length = 120
disable = [
# Covered by Ruff
"bad-indentation",
"line-too-long",
"missing-final-newline",
"trailing-whitespace",
"unnecessary-semicolon",
"missing-docstring",
"invalid-name",
"abstract-class-instantiated",
"abstract-method",
"arguments-differ",
"assignment-from-none",
"attribute-defined-outside-init",
"protected-access",
"signature-differs",
"too-few-public-methods",
"import-error",
"no-member",
"no-name-in-module",
"unused-import",
"redefined-outer-name",
"unused-argument",
"unused-variable",
"wrong-import-position",
"import-outside-toplevel",
"too-many-positional-arguments",
"redefined-builtin", # ConnectionError shadows requests.ConnectionError, it's fine
"fixme",
"raise-missing-from", # We're consistently using 'from e' with our exceptions
"broad-exception-caught",
]
# Enable only the high-value checks that Ruff doesn't cover
enable = [
"use-symbolic-message-instead",
"useless-suppression",
"duplicate-code",
]
[tool.pylint.basic]
good-names = ["i", "j", "k", "ex", "id", "fd", "_"]
[tool.pylint.design]
max-parents = 15
max-returns = 10
max-branches = 20
max-statements = 60
max-attributes = 20
max-locals = 25
max-args = 10
max-nested-blocks = 8