-
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathpyproject.toml
More file actions
303 lines (269 loc) · 8.47 KB
/
Copy pathpyproject.toml
File metadata and controls
303 lines (269 loc) · 8.47 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
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
[project]
name = "ha-4noks-elios4you"
version = "0.3.0"
description = "Home Assistant custom integration for 4-noks Elios4you energy monitoring devices using Telnet"
readme = "README.md"
license = "MIT"
requires-python = ">=3.14.2"
authors = [{ name = "alexdelprete" }]
keywords = ["home-assistant", "4noks", "elios4you", "telnet", "energy", "monitoring"]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Programming Language :: Python :: 3.14",
]
[project.urls]
"Homepage" = "https://github.com/alexdelprete/ha-4noks-elios4you"
"Bug Tracker" = "https://github.com/alexdelprete/ha-4noks-elios4you/issues"
[tool.setuptools.packages.find]
include = ["custom_components*"]
[project.optional-dependencies]
dev = [
"colorlog>=6.10.0",
"homeassistant>=2026.3.0",
"homeassistant-stubs",
"mdformat",
"mdformat-gfm",
"pre-commit",
"pymarkdownlnt",
"telnetlib3>=2.0.4",
"ty",
"ruff>=0.8.0",
"pytest>=8.0.0",
"pytest-asyncio>=0.23.0",
"pytest-cov",
"pytest-homeassistant-custom-component>=0.13.0",
"pytest-timeout",
]
[dependency-groups]
lint = [
"homeassistant-stubs",
"mdformat",
"mdformat-gfm",
"pre-commit",
"pymarkdownlnt",
"ruff>=0.8.0",
"ty",
]
pytest = [
"pytest>=8.0.0",
"pytest-asyncio>=0.23.0",
"pytest-cov",
"pytest-homeassistant-custom-component>=0.13.0",
"pytest-timeout",
]
dev = [
"colorlog>=6.10.0",
"homeassistant>=2026.3.0",
"telnetlib3>=2.0.4",
{ include-group = "lint" },
{ include-group = "pytest" },
]
# <!-- BEGIN SHARED:repo-sync -->
# Synced by repo-sync on 2026-06-27
[tool.codespell]
skip = "*.json"
quiet-level = 3
ignore-words-list = "hass"
[tool.pytest.ini_options]
addopts = """
--timeout=20
"""
testpaths = ["tests"]
asyncio_mode = "auto"
asyncio_default_fixture_loop_scope = "function"
[tool.coverage.run]
branch = true
source = ["custom_components.4noks_elios4you"]
relative_files = true
[tool.coverage.report]
show_missing = true
# ty type checker configuration (Rust-based, faster than mypy)
[tool.ty.environment]
python-version = "3.14"
python-platform = "linux"
[tool.ty.rules]
# Promote warnings to errors for strictness
deprecated = "error"
redundant-cast = "error"
[tool.ruff]
line-length = 100
indent-width = 4
fix = true
target-version = "py314"
required-version = ">=0.15.17"
# Exclude non-code directories from formatting and linting
extend-exclude = [
".vscode",
".devcontainer",
".github",
"build",
"dist",
"e4u-client",
]
[tool.ruff.format]
quote-style = "double"
indent-style = "space"
skip-magic-trailing-comma = false
line-ending = "lf"
docstring-code-format = true
[tool.ruff.lint]
select = [
"A001", # Variable {name} is shadowing a Python builtin
"ASYNC", # flake8-async
"B", # flake8-bugbear
"BLE", # flake8-blind-except
"C", # complexity
"COM818", # Trailing comma on bare tuple prohibited
"D", # pydocstyle
"DTZ", # flake8-datetimez
"E", # pycodestyle errors
"F", # pyflakes
"FLY", # flynt
"FURB", # refurb
"G", # flake8-logging-format
"I", # isort
"ICN001", # import conventions
"INP", # flake8-no-pep420
"ISC", # flake8-implicit-str-concat
"LOG", # flake8-logging
"N", # pep8-naming
"PERF", # perflint
"PGH", # pygrep-hooks
"PIE", # flake8-pie
"PL", # pylint
"PT", # flake8-pytest-style
"PTH", # flake8-pathlib
"PYI", # flake8-pyi
"RET", # flake8-return
"RSE", # flake8-raise
"RUF", # ruff-specific rules
"S", # flake8-bandit (security)
"SIM", # flake8-simplify
"SLF", # flake8-self
"SLOT", # flake8-slots
"T10", # flake8-debugger
"T20", # flake8-print
"TC", # flake8-type-checking
"TID", # flake8-tidy-imports
"TRY", # tryceratops
"UP", # pyupgrade
"W", # pycodestyle warnings
]
ignore = [
"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__
"D202", # No blank lines allowed after function docstring
"D203", # 1 blank line required before class docstring
"D213", # Multi-line docstring summary should start at the second line
"D406", # Section name should end with a newline
"D407", # Section name underlining
"E501", # line too long
"PLC1901", # compare-to-empty-string
"PLR0904", # Too many public methods
"PLR0911", # Too many return statements
"PLR0912", # Too many branches
"PLR0913", # Too many arguments
"PLR0914", # Too many local variables
"PLR0915", # Too many statements
"PLR0916", # Too many Boolean expressions
"PLR0917", # Too many positional arguments
"PLR1702", # Too many nested blocks
"PLR2004", # Magic value used in comparison
"PLW2901", # Outer variable overwritten by inner target
"PT011", # pytest.raises is too broad
"PT018", # Assertion should be broken down
"RUF001", # String contains ambiguous unicode
"RUF002", # Docstring contains ambiguous unicode
"RUF003", # Comment contains ambiguous unicode
"RUF015", # Prefer next(...) over single element slice
"SIM102", # Use a single if statement instead of nested
"SIM103", # Return the condition directly
"SIM108", # Use ternary operator
"SIM115", # Use context handler for opening files
# Moving imports into type-checking blocks can mess with pytest.patch()
"TC001", # Move application import into a type-checking block
"TC002", # Move third-party import into a type-checking block
"TC003", # Move standard library import into a type-checking block
"TRY003", # Avoid specifying long messages outside the exception class
"TRY400", # Use logging.exception instead of logging.error
"PGH003", # Use specific rule codes when ignoring type issues
# May conflict with the formatter
"W191",
"E111",
"E114",
"E117",
"D206",
"D300",
"Q",
"COM812",
"COM819",
"ISC001",
# Disabled because ruff does not understand type of __all__ generated by a function
"PLE0605",
"ASYNC109",
"ASYNC110",
"N999",
"PLW1641",
"TC006",
"UP046",
"UP047",
"UP049",
]
[tool.ruff.lint.per-file-ignores]
"tests/*.py" = [
"INP001",
"E402",
]
"tests/*" = [
"D", # Docstring rules
"S101", # Use of assert detected
"SLF001", # Private member accessed
"PLR2004", # Magic value used in comparison
"PLR0913", # Too many arguments
"C901", # Function is too complex
"B017", # Don't assert blind Exception
"PT006", # Wrong type passed to first argument
"S108", # Probable insecure usage of temporary file
]
"custom_components/4noks_elios4you/api.py" = [
"S101",
"TRY301",
]
[tool.ruff.lint.flake8-import-conventions.extend-aliases]
voluptuous = "vol"
"homeassistant.helpers.area_registry" = "ar"
"homeassistant.helpers.config_validation" = "cv"
"homeassistant.helpers.device_registry" = "dr"
"homeassistant.helpers.entity_registry" = "er"
"homeassistant.helpers.issue_registry" = "ir"
"homeassistant.util.dt" = "dt_util"
[tool.ruff.lint.flake8-pytest-style]
fixture-parentheses = false
mark-parentheses = false
[tool.ruff.lint.flake8-tidy-imports.banned-api]
"async_timeout".msg = "use asyncio.timeout instead"
"pytz".msg = "use zoneinfo instead"
[tool.ruff.lint.isort]
force-sort-within-sections = true
# `custom_components.fournoks_elios4you` is the symlink path used by tests
# (the real package starts with a digit and isn't a valid Python identifier).
# Declaring it as first-party here makes ruff's import classification
# deterministic regardless of whether the symlink exists on disk — CI,
# pre-commit, and ad-hoc `uvx ruff` runs all produce the same ordering.
known-first-party = ["homeassistant", "custom_components.fournoks_elios4you"]
combine-as-imports = true
split-on-trailing-comma = false
[tool.ruff.lint.mccabe]
max-complexity = 25
[tool.ruff.lint.pydocstyle]
convention = "google"
[tool.mdformat]
wrap = 120
number = true
# <!-- END SHARED:repo-sync -->