From 1f868d22fb5eebdbbdfa518542eb42403576321c Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Fri, 21 Aug 2026 17:04:03 -0500 Subject: [PATCH] Expose request_key as the public pair of ConvertedLibrary.node_key The arduino backend consumed the private _node_key across packages to reconstruct the request-side key; the thin public wrapper keeps both sides of the contract on the same API surface. --- esphome/arduino/library.py | 7 ++----- esphome/platformio/library.py | 9 +++++++++ 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/esphome/arduino/library.py b/esphome/arduino/library.py index 45a89784e5..5d2af680d1 100644 --- a/esphome/arduino/library.py +++ b/esphome/arduino/library.py @@ -35,7 +35,6 @@ from esphome.platformio.library import ( IncompatiblePlatform, InvalidLibrary, LibraryBackend, - _node_key, check_library_data, collect_filtered_files, convert_libraries, @@ -46,6 +45,7 @@ from esphome.platformio.library import ( normalize_dependencies, parse_library_json, parse_library_properties, + request_key, ) _LOGGER = logging.getLogger(__name__) @@ -327,10 +327,7 @@ def resolve_libraries( # "bitbank2__pngle"); diff the request-side node keys instead resolved_keys = {c.node_key or c.name for c in resolved} dropped = [ - str(lib) - for lib in external - if _node_key(lib.name, lib.version, lib.repository)[0] - not in resolved_keys + str(lib) for lib in external if request_key(lib) not in resolved_keys ] _LOGGER.warning( "%d of %d requested libraries were not resolved (missing: %s)", diff --git a/esphome/platformio/library.py b/esphome/platformio/library.py index 643a020df8..cc02c6b490 100644 --- a/esphome/platformio/library.py +++ b/esphome/platformio/library.py @@ -776,6 +776,15 @@ def is_lib_ignored(name: str | None, lib_ignore: set[str]) -> bool: ) +def request_key(library: Library) -> str: + """The node key a library spec resolves under. + + Pairs with ``ConvertedLibrary.node_key``: diff requests against resolved + components with these, not against the canonical ``name``. + """ + return _node_key(library.name, library.version, library.repository)[0] + + def convert_libraries( libraries: list[Library], backend: LibraryBackend ) -> list[ConvertedLibrary]: