fix(deps): make aioesphomeapi an optional [esphome] extra (fixes #38) - #47
chriguschneider wants to merge 1 commit into
Conversation
…62#38) Declaring `aioesphomeapi` as a hard runtime dependency breaks every Noise-encrypted ESPHome device on a Home Assistant instance that installs this integration. Root cause: HA Core pins aioesphomeapi (via the `esphome` / `bleak_esphome` integrations, e.g. ==45.6.1). Because this package requires it without a version constraint AND is installed from a git URL, pip installs the newest PyPI release over Core's pin and, on interpreters without prebuilt wheels (e.g. cp314 / Python 3.14), rebuilds it from source. The resulting ABI-incompatible Cython artifacts crash the Noise frame-helper import ("APIConnection size changed ... Expected 240 ... got 232" followed by "'__reduce_cython__'"), so all Noise-encrypted ESPHome devices go unavailable. A `ha core rebuild` only recovers it until the next Core update recreates the container and reinstalls the unpinned version. Fix: aioesphomeapi is not needed inside HA (HA provides it and uses its own habluetooth stack, not this package's ESP32-Bluetooth-Proxy transport). Move it to an optional `esphome` extra so the HA manifest install (`geberit-aquaclean @ git+...`, no extra) no longer overrides Core's pin. All aioesphomeapi imports are already lazy (function-level), so the package imports and runs fine without the extra when the ESPHome transport is unused. Standalone bridge users keep the transport: install/update scripts and the README now install `geberit-aquaclean[esphome]`. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Hi @jens62 👋 — friendly nudge on this one. It's a small change (moves The PR is CI-green and shows as mergeable, and all |
Problem
Declaring
aioesphomeapias a hard runtime dependency inpyproject.tomlbreaks every Noise-encrypted ESPHome device on a Home Assistant instance that has this integration installed (issue #38).Root cause
aioesphomeapiexactly via itsesphome/bleak_esphomeintegrations (e.g.==45.6.1).aioesphomeapiwithout a version constraint and is installed from a git URL. So onha core rebuild(and on every Core update that recreates the container), pip installs the newest PyPI release over Core's pin.unavailablewhile the devices themselves stay online. Aha core rebuildonly recovers it until the next Core update reinstalls the unpinned version.As noted in #38, pinning alone is insufficient (the git-URL install still rebuilds from source into a second binary of the same version). Not declaring the dependency for the HA path avoids both the version override and the source rebuild.
Fix
aioesphomeapiis not needed inside HA: HA provides it, and in HA the ESP32-Bluetooth-Proxy transport (ESPHomeAPIClient) is not used — HA has its ownhabluetoothstack. So this moves it to an optionalesphomeextra:geberit-aquaclean @ git+..., no extra) → no longer overrides Core's pinnedaioesphomeapi.aioesphomeapiimports in the codebase are already lazy (function-level), so the package imports and runs fine without the extra when the ESPHome-proxy transport is not used.Standalone bridge is preserved
Standalone / non-HA users who use the ESP32-Bluetooth-Proxy transport still get
aioesphomeapi—operation_support/install.sh,operation_support/update.sh, and the README now installgeberit-aquaclean[esphome].Changes
pyproject.toml: moveaioesphomeapifromdependenciestooptional-dependencies.esphome(with explanatory comment).operation_support/install.sh,operation_support/update.sh: install with[esphome]extra.README.md: manual install uses[esphome]extra.Verified
pyproject.tomlparses;aioesphomeapiabsent from base deps, present underoptional-dependencies.esphome.aioesphomeapiimports are function-level (grep), so no import-time breakage without the extra.Independent reproduction environment: HA OS 18.2 / RPi 5 (aarch64) / Core 2026.8.3 / Python 3.14.6, aquaclean 3.1.2 — full trace posted in #38.