forked from homeassistant-ai/ha-mcp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpyproject.toml
More file actions
263 lines (241 loc) · 8.48 KB
/
Copy pathpyproject.toml
File metadata and controls
263 lines (241 loc) · 8.48 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
[build-system]
requires = ["setuptools>=61.0", "wheel"]
build-backend = "setuptools.build_meta"
[project]
name = "ha-mcp"
version = "7.9.0"
description = "Home Assistant MCP Server - Complete control of Home Assistant through MCP"
readme = "README.md"
# Upper bound widened to <3.15 so the package installs on Home Assistant's
# interpreter when run in-process by the ha_mcp_tools component (HA
# core-2026.7 ships Python 3.14). src/ stays 3.13-compatible.
requires-python = ">=3.13,<3.15"
license = {text = "MIT"}
authors = [
{name = "Julien", email = "github@qc-h.net"}
]
keywords = ["mcp", "home-assistant", "ai", "automation", "smart-home"]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Topic :: Home Automation",
"Topic :: Software Development :: Libraries :: Python Modules",
]
dependencies = [
"fastmcp==3.4.2",
"httpx[socks]==0.28.1",
"pydantic==2.13.4",
"python-dotenv==1.2.2",
"truststore==0.10.4",
"websockets==16.0",
# Range (not a hard pin) so the resolver can satisfy Home Assistant's own
# cryptography constraint when ha-mcp is installed into the HA venv for
# in-process embedding (HA 2026.6 pins cryptography==48.0.0, 2026.7 pins
# 48.0.1 — the floor must admit every supported core's pin; live-found on
# the embedded e2e lane against the HA 2026.6.4 image).
# cryptography is a transitive dependency only — never imported in src/.
"cryptography>=48.0.0,<50",
"pydantic-monty==0.0.18",
"tzdata>=2024.1",
"packaging>=24.0",
]
[project.urls]
"Homepage" = "https://github.com/homeassistant-ai/ha-mcp"
"Bug Tracker" = "https://github.com/homeassistant-ai/ha-mcp/issues"
"Repository" = "https://github.com/homeassistant-ai/ha-mcp"
[project.scripts]
ha-mcp = "ha_mcp.__main__:main"
ha-mcp-smoke-test = "ha_mcp.smoke_test:main"
hamcp-test-env = "tests.test_env_manager:main"
ha-mcp-web = "ha_mcp.__main__:main_web"
ha-mcp-sse = "ha_mcp.__main__:main_sse"
ha-mcp-oauth = "ha_mcp.__main__:main_oauth"
[tool.setuptools]
package-dir = {"" = "src", "tests" = "tests"}
packages = { find = { where = ["src", "."], include = ["ha_mcp*", "tests"] } }
[tool.setuptools.package-data]
ha_mcp = ["py.typed", "_pypi_marker", "settings_ui/settings.html", "settings_ui/settings.js", "settings_ui/settings.css", "resources/skills-vendor/**/*"]
[tool.mypy]
python_version = "3.13"
mypy_path = "src"
# /tmp keeps the cache on Linux tmpfs — avoids the slow Windows FS in WSL2.
# Windows-native contributors can remove this line or override with MYPY_CACHE_DIR.
cache_dir = "/tmp/.mypy_cache"
warn_return_any = true
warn_unused_configs = true
disallow_untyped_defs = true
disallow_incomplete_defs = true
check_untyped_defs = true
no_implicit_optional = true
warn_redundant_casts = true
warn_unused_ignores = true
show_error_codes = true
namespace_packages = true
explicit_package_bases = true
[[tool.mypy.overrides]]
module = [
"fastmcp.*",
"jq",
"pydantic_monty",
"pydantic_monty.*",
]
ignore_missing_imports = true
[[tool.mypy.overrides]]
module = [
"homeassistant.*",
"aiohasupervisor",
"aiohasupervisor.*",
"aiohttp",
"yarl",
"voluptuous",
"jsonschema",
"requests",
"requests.*",
]
ignore_missing_imports = true
[tool.ruff]
target-version = "py313"
line-length = 88
extend-exclude = [
"tests/initial_test_state",
# HA integration manifests must be strict JSON (no trailing commas);
# ruff 0.15+ formats .json files as JSONC and inserts trailing commas
# which makes Python's json.load() reject the file at HA startup.
"custom_components/**/*.json",
]
[tool.ruff.lint]
select = [
"E", # pycodestyle errors
"W", # pycodestyle warnings
"F", # pyflakes
"I", # isort
"B", # flake8-bugbear
"C4", # flake8-comprehensions
"UP", # pyupgrade
"RUF", # ruff-specific rules
"PIE", # misc lints
"PERF", # performance anti-patterns
"ASYNC", # async best practices
"A", # builtin shadowing
"LOG", # logging best practices
"SIM", # simplify
]
ignore = [
"E501", # line too long — formatter handles this
"B008", # function calls in defaults — FastMCP pattern
"SIM102", # collapsible-if — sometimes less readable
"SIM108", # ternary — sometimes less readable
"SIM105", # contextlib.suppress — style preference
"ASYNC109",# timeout params are standard in HA API patterns
"RUF001", # ambiguous unicode — HA entity names use degree symbols etc
"RUF003", # ambiguous unicode in comments
"RUF010", # explicit f-string type conversion — str(x) is clearer than !s
"RUF059", # unused unpacked variable
"SIM118", # in-dict-keys — style preference
"PIE810", # multiple-starts-ends-with — style preference
"RUF005", # collection-literal-concatenation
"RUF022", # unsorted-dunder-all
"RUF013", # implicit-optional
]
[tool.ruff.lint.per-file-ignores]
"__init__.py" = ["F401"]
"tests/**/*" = ["E501", "B011"]
# C901 ignores for tools files with complex methods (see #925).
# Remove lines as individual methods are simplified below threshold.
"src/ha_mcp/tools/tools_config_dashboards.py" = ["C901"]
[tool.pytest.ini_options]
testpaths = ["tests"]
python_files = ["test_*.py", "*_test.py"]
python_classes = ["Test*"]
python_functions = ["test_*"]
addopts = [
"--strict-markers",
"--strict-config",
"--verbose",
"--tb=short",
]
markers = [
"slow: marks tests as slow (deselect with '-m \"not slow\"')",
"integration: marks tests as integration tests",
"unit: marks tests as unit tests",
"automation: automation lifecycle tests",
"calendar: calendar event management tests",
"device: device control tests",
"script: script orchestration tests",
"helper: helper integration tests",
"convenience: convenience tools tests (scene, weather, energy, docs)",
"error_handling: error handling and edge case tests",
"cleanup: tests that create entities needing cleanup",
"performance: performance measurement and regression tests",
"external_only: skips on HAOS inaddon tier (server runs in a separate addon container, so in-process env monkeypatching doesn't reach it)",
"inaddon_only: only runs on HAOS inaddon tier",
]
asyncio_mode = "auto"
[dependency-groups]
dev = [
"build>=1.2.2",
"docker>=7.1.0",
"httpx2>=2.4.0",
"mypy>=1.17.0",
"openai>=1.0.0",
"psutil>=7.0.0",
"pytest>=8.4.2",
"pytest-asyncio>=1.1.0",
"pytest-cov>=5.0.0",
"pytest-timeout>=2.3.0",
"pytest-rerunfailures>=15.0",
# Real voluptuous for the config-flow tests (the component's
# config_flow imports it; HA provides it at runtime, tests need it here).
"voluptuous>=0.15.2",
"pytest-xdist>=3.8.0",
"requests>=2.25.0",
"lefthook>=1.10.0",
"ruamel.yaml>=0.18.0",
"ruff>=0.12.12",
"testcontainers>=4.13.0",
"ast-grep-cli>=0.42.0",
]
# Semantic versioning configuration
[tool.semantic_release]
version_toml = ["pyproject.toml:project.version"]
version_variables = [
"src/ha_mcp/__init__.py:__version__",
# Keeps the in-process server's stable-channel pin in lockstep with the
# released server/add-on version - a hand-edited pin would drift the
# moment a release ships (owner: the server entry must always match the
# add-on version to avoid confusion).
"custom_components/ha_mcp_tools/const.py:PINNED_HA_MCP_VERSION",
]
build_command = """
pip install uv && uv lock
git add uv.lock
"""
dist_path = "dist/"
upload_to_PyPI = true
upload_to_release = true
remove_dist = false
# Commit message parsing
commit_parser = "angular"
commit_parser_options = { major_tags = ["BREAKING", "!"], minor_tags = ["feat"], patch_tags = ["fix", "perf", "refactor"] }
# Changelog configuration
[tool.semantic_release.changelog]
template_dir = "templates"
exclude_commit_patterns = [
"^.*\\(site\\).*$", # Commits with (site) scope
'''chore\(addon\): [Ss]ync changelog.*''', # Changelog sync commits
]
[tool.semantic_release.changelog.default_templates]
changelog_file = "CHANGELOG.md"
# Version scheme
major_on_zero = true
allow_zero_version = false
# Branch and tag configuration
branch = "master"
# Publish configuration (v10 syntax)
[tool.semantic_release.publish]
# GitHub release is created by build-binary.yml workflow to include binaries
upload_to_vcs_release = false