mirror of
https://github.com/esphome/esphome.git
synced 2026-07-10 08:55:36 +00:00
fa055b9e490fa0408fa1293a642d2ec8ddf094ac
Every \`esphome\` CLI invocation pays the cost of whatever \`esphome/__main__.py\` imports at module scope before the requested command even runs. This moves three heavy imports into the functions that actually use them: - \`esphome.zeroconf\` (discover_mdns_devices): only needed for the name_add_mac_suffix OTA discovery path. - \`esphome.writer\`: only needed by compile/clean paths. - \`esphome.yaml_util\`: only needed by codegen, config dump, and rename. Local measurement drops from ~75ms to ~47ms (-37%) for a cold \`python -c 'import esphome.__main__'\`. The zeroconf chain alone accounts for most of the gain — the case that motivated the CI budget check. Also adds a module-level note explaining the intent so future PRs don't innocently promote these back to the top. Retargets four test patches from \`esphome.__main__.discover_mdns_devices\` to \`esphome.zeroconf.discover_mdns_devices\` now that the symbol is only bound inside the function that calls it.
Description
ESPHome is a system to control your ESP8266/ESP32 by simple yet powerful configuration files and control them remotely through Home Automation systems.
Readme
Multiple Licenses
545 MiB
Languages
C++
60.1%
Python
39.3%
C
0.3%
JavaScript
0.2%
