-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpyproject.toml
More file actions
207 lines (182 loc) · 5.42 KB
/
Copy pathpyproject.toml
File metadata and controls
207 lines (182 loc) · 5.42 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
[build-system]
requires = ["hatchling>=1.21.0", "cython>=3.0.0", "setuptools>=75.0.0"]
build-backend = "hatchling.build"
[project]
name = "shelly-speedwire-gateway"
dynamic = ["version"]
description = "Shelly 3EM to SMA Speedwire Gateway"
readme = "README.md"
license = { text = "MIT" }
requires-python = ">=3.13"
authors = [
{ name = "Grzegorz Sterniczuk", email = "grzegorz@sternicz.uk" }
]
keywords = ["shelly", "sma", "speedwire", "mqtt", "energy", "meter", "iot"]
classifiers = [
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.13",
"Topic :: Home Automation",
"Topic :: System :: Networking",
"Typing :: Typed",
]
dependencies = [
"aiomqtt>=2.3.0",
"pydantic>=2.11.7",
"pydantic-settings>=2.6.0",
"structlog>=25.4.0",
"PyYAML>=6.0.2",
"uvloop>=0.21.0; sys_platform != 'win32'",
"cython>=3.1.3",
"numpy>=2.2.1",
"psutil>=7.0.0",
"types-pyyaml>=6.0.12.20250822",
"setuptools>=80.9.0",
"pylint-pydantic>=0.3.5",
]
[project.optional-dependencies]
dev = [
"pytest>=8.3.4",
"pytest-asyncio>=0.24.0",
"pytest-cov>=5.0.0",
"mypy>=1.17.1",
"pylint>=3.3.0",
"pylint-pydantic>=0.3.2",
]
monitoring = [
"prometheus-client>=0.21.1",
]
[project.urls]
Homepage = "https://github.com/dzikus/shelly-speedwire-gateway"
Issues = "https://github.com/dzikus/shelly-speedwire-gateway/issues"
[project.scripts]
shelly-speedwire-gateway = "shelly_speedwire_gateway.main:cli_main"
[tool.hatch.version]
path = "shelly_speedwire_gateway/__init__.py"
[tool.ruff]
target-version = "py313"
line-length = 120
output-format = "concise"
cache-dir = ".cache/ruff"
[tool.ruff.lint]
select = [
"E", # pycodestyle errors
"W", # pycodestyle warnings
"F", # Pyflakes
"UP", # pyupgrade
"B", # flake8-bugbear
"SIM", # flake8-simplify
"I", # isort
"N", # pep8-naming
"D", # pydocstyle
"S", # flake8-bandit (security)
"BLE", # flake8-blind-except
"FBT", # flake8-boolean-trap
"A", # flake8-builtins
"COM", # flake8-commas
"C4", # flake8-comprehensions
"T10", # flake8-debugger
"ISC", # flake8-implicit-str-concat
"ICN", # flake8-import-conventions
"T20", # flake8-print
"PT", # flake8-pytest-style
"Q", # flake8-quotes
"RSE", # flake8-raise
"RET", # flake8-return
"SLF", # flake8-self
"TID", # flake8-tidy-imports
"ARG", # flake8-unused-arguments
"PTH", # flake8-use-pathlib
"ERA", # eradicate
"PGH", # pygrep-hooks
"PL", # Pylint
"TRY", # tryceratops
"RUF", # Ruff-specific rules
"ASYNC", # flake8-async
]
ignore = [
"PLR0911", # Too many return statements
"TRY003", # Avoid specifying long messages outside the exception class
"TRY300", # Consider moving statement to else block
"SIM103", # Return condition directly
]
[tool.ruff.lint.pydocstyle]
convention = "google"
[tool.ruff.lint.isort]
known-first-party = ["shelly_speedwire_gateway"]
required-imports = ["from __future__ import annotations"]
[tool.ruff.lint.flake8-tidy-imports]
ban-relative-imports = "all"
[tool.ruff.lint.per-file-ignores]
# Test files can be more relaxed
"tests/*" = [
"D", # No docstring requirements in tests
"S", # Security rules less relevant in tests
"PLR0913", # Many arguments OK in test fixtures
"PLR2004", # Magic values are OK in tests
"FBT", # Boolean traps OK in tests
"SLF001", # Private member access OK in tests
"TRY301", # Abstract raise to inner function (false positives in tests)
"PT012", # Multiple statements in pytest.raises block (acceptable in tests)
"RUF006", # Asyncio task dangling reference (acceptable in tests)
]
# Scripts can use print for user output
"scripts/*" = [
"T20", # Print statements allowed in scripts
"T201", # Print allowed for user feedback
]
# Configuration files don't need docstrings
"setup.py" = ["D"]
[tool.ruff.format]
# Double quotes, indent with spaces
quote-style = "double"
indent-style = "space"
skip-magic-trailing-comma = false
line-ending = "auto"
docstring-code-format = true
[tool.mypy]
python_version = "3.13"
cache_dir = ".cache/mypy"
warn_return_any = true
warn_unused_configs = true
disallow_untyped_defs = true
disallow_incomplete_defs = true
check_untyped_defs = true
disallow_untyped_decorators = false
no_implicit_optional = true
warn_redundant_casts = true
warn_unused_ignores = true
warn_no_return = true
warn_unreachable = true
strict_equality = true
# Per-module overrides
[[tool.mypy.overrides]]
module = "tests.*"
warn_unreachable = false
[tool.pytest.ini_options]
minversion = "7.0"
addopts = "-ra -q --strict-markers"
testpaths = ["tests"]
asyncio_mode = "auto"
[tool.pylint.main]
load-plugins = ["pylint_pydantic"]
[tool.pylint.format]
max-line-length = 120
[tool.pylint.design]
max-args = 8
max-locals = 20
max-attributes = 20
max-branches = 15
[tool.pylint.similarities]
min-similarity-lines = 20
ignore-comments = true
ignore-docstrings = true
ignore-imports = true
[tool.pylint.messages_control]
disable = [
"too-few-public-methods",
"no-member", # Handled by pylint-pydantic
"too-many-return-statements", # Complex error handling requires multiple return paths
"too-many-lines", # Large modules are acceptable for complex processing
]