-
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathpyproject.toml
More file actions
144 lines (127 loc) · 5.66 KB
/
pyproject.toml
File metadata and controls
144 lines (127 loc) · 5.66 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
[project]
name = "amber-express"
version = "1.0.1rc1"
description = "Home Assistant integration for Amber Electric with smart polling and WebSocket support"
readme = "README.md"
requires-python = ">=3.13.2,<3.14"
dependencies = [
"homeassistant>=2026.1.1",
"amberelectric>=2.0.12",
"http-sf>=1.1.1",
"numpy>=2.2.0",
]
[dependency-groups]
dev = [
"freezegun>=1.5.2",
"pyright>=1.1.408",
"pytest>=9.0.0",
"pytest-cov>=7.0.0",
"pytest-homeassistant-custom-component>=0.13.300",
"ruff>=0.14.0",
"syrupy>=5.0.0",
]
[tool.ruff]
required-version = ">=0.14.0"
line-length = 120
target-version = "py313"
[tool.ruff.lint]
# Enable ALL rules and selectively ignore overly strict ones
select = ["ALL"]
# Ignore overly strict or unwanted rules
ignore = [
'COM812', # Formatter already deals with trailing commas
'D202', # Blank lines after docstring are fine
'D203', # Don't put a newline between the class and docstring (D211 is used instead)
'D213', # Multiline doc strings have an empty first line (Incompatible with D212)
'PLR0913', # Parameter limits are a something for code review not linting
'PLR0915', # Too many statements is something for code review not linting
'PLR0912', # Too many branches is something for code review not linting
'C901', # Complexity is not a good linting rule, it should be a code review issue
'TC001', # Don't use TYPE_CHECKING blocks
'TC002', # Don't use TYPE_CHECKING blocks
'TC003', # Don't use TYPE_CHECKING blocks
'BLE001', # Do not catch blind exception - integration code needs to handle various exception types gracefully
'ANN401', # Dynamically typed expressions - legitimate use of Any for **kwargs parameters
'TRY300', # Consider moving statement to else block - overly pedantic about code structure
'TRY301', # Abstract raise to inner function - overly pedantic, creates unnecessary indirection
'PLR0911', # Too many return statements - something for code review not linting
]
[tool.ruff.lint.isort]
known-first-party = ["amber_express"]
force-sort-within-sections = true
split-on-trailing-comma = false
[tool.ruff.lint.per-file-ignores]
"**/test_*.py" = [
'S101', # Assert is allowed in tests
'B011', # Assert false is allowed in tests
'PT015', # Assert that always fails is fine in a test
'SLF001', # Accessing private methods is ok in testing
'ARG001', # Unused function argument - test fixtures often provide unused parameters for setup
'PLR2004', # Magic value used in comparison - test assertions often use simple numeric values
'S110', # Try-except-pass detected - test exception handling patterns differ from production code
'SIM105', # Use contextlib.suppress instead of try-except-pass - test exception handling patterns differ
'BLE001', # Do not catch blind exception - test code needs to handle various exception types
'FBT001', # Boolean positional argument - common in parametrized tests
'FBT003', # Boolean positional value - test assertions often pass literal booleans
]
"**/conftest.py" = [
'S101', # Assert is allowed in tests
'B011', # Assert false is allowed in tests
'PT015', # Assert that always fails is fine in a test
'SLF001', # Accessing private methods is ok in testing
'ARG001', # Unused function argument - test fixtures often provide unused parameters for setup
'PLR2004', # Magic value used in comparison - test assertions often use simple numeric values
'S110', # Try-except-pass detected - test exception handling patterns differ from production code
'SIM105', # Use contextlib.suppress instead of try-except-pass - test exception handling patterns differ
'BLE001', # Do not catch blind exception - test code needs to handle various exception types
'FBT001', # Boolean positional argument - common in parametrized tests
'FBT003', # Boolean positional value - test assertions often pass literal booleans
]
[tool.ruff.lint.pylint]
max-args = 10
max-branches = 15
max-statements = 60
[tool.pyright]
# Type checking configuration
pythonVersion = "3.13"
typeCheckingMode = "strict"
include = ["custom_components"]
extraPaths = ["."]
# Disable errors that propagate from third-party incomplete types
reportUnknownVariableType = false
reportUnknownMemberType = false
reportUnknownArgumentType = false
reportUnknownLambdaType = false
reportUnknownParameterType = false
# Disable missing stubs warning
reportMissingTypeStubs = false
# Disable checks that conflict with Home Assistant patterns
reportIncompatibleVariableOverride = false # HA uses cached_property pattern
reportIncompatibleMethodOverride = false # HA config flow patterns
reportPrivateImportUsage = false # amberelectric library exports
reportMissingTypeArgument = false # Generic type args in HA patterns
reportReturnType = false # HA config flow return types
reportAttributeAccessIssue = false # HA config entry patterns
reportTypedDictNotRequiredAccess = false # Standard pytest patterns
reportPrivateUsage = false # Allow private access in colocated tests
[tool.pytest.ini_options]
timeout = 5
testpaths = ["custom_components/amber_express"]
python_files = ["test_*.py"]
python_classes = ["Test*"]
python_functions = ["test_*"]
asyncio_mode = "auto"
addopts = ["--strict-markers", "--strict-config", "--import-mode=importlib"]
filterwarnings = ["error"]
[tool.coverage.run]
omit = [
"**/tests/*",
]
[tool.setuptools]
package-dir = { "" = "." }
[tool.setuptools.packages.find]
where = ["."]
include = ["custom_components*"]
[build-system]
requires = ["setuptools>=65", "wheel"]
build-backend = "setuptools.build_meta"