From 866f41791a80ae9854a334a078fecf7ebe6772f3 Mon Sep 17 00:00:00 2001 From: Erik Montnemery Date: Mon, 20 Apr 2026 13:19:13 +0200 Subject: [PATCH] Deprecate support for local installation of dependencies (#168164) --- .../components/homeassistant/__init__.py | 10 ++ .../components/homeassistant/strings.json | 4 + tests/components/homeassistant/test_init.py | 91 +++++++++++++++---- 3 files changed, 89 insertions(+), 16 deletions(-) diff --git a/homeassistant/components/homeassistant/__init__.py b/homeassistant/components/homeassistant/__init__.py index 9583857660fd..10d4b70e7b70 100644 --- a/homeassistant/components/homeassistant/__init__.py +++ b/homeassistant/components/homeassistant/__init__.py @@ -452,6 +452,16 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: # noqa: "arch": arch, }, ) + if not info["docker"] and not info["virtualenv"]: + ir.async_create_issue( + hass, + DOMAIN, + "unsupported_local_deps", + learn_more_url=DEPRECATION_URL, + is_fixable=False, + severity=IssueSeverity.WARNING, + translation_key="unsupported_local_deps", + ) # Delay deprecation check to make sure installation method is determined correctly hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STARTED, _async_check_deprecation) diff --git a/homeassistant/components/homeassistant/strings.json b/homeassistant/components/homeassistant/strings.json index 29227aac7be5..419b1ce1fc77 100644 --- a/homeassistant/components/homeassistant/strings.json +++ b/homeassistant/components/homeassistant/strings.json @@ -203,6 +203,10 @@ } }, "title": "Storage corruption detected for {storage_key}" + }, + "unsupported_local_deps": { + "description": "This system is running Home Assistant outside a virtual environment or a Docker container. This is not supported and will not work after the release of Home Assistant 2026.11.", + "title": "Deprecation notice: Installation method" } }, "services": { diff --git a/tests/components/homeassistant/test_init.py b/tests/components/homeassistant/test_init.py index fff855624a3e..c1685ead812e 100644 --- a/tests/components/homeassistant/test_init.py +++ b/tests/components/homeassistant/test_init.py @@ -642,13 +642,68 @@ async def test_reload_all( @pytest.mark.parametrize( - ("arch", "bit_32", "expected_issue"), + ("arch", "bit_32", "installation_type", "venv", "expected_issues"), [ - ("i386", True, "deprecated_method_architecture"), - ("armhf", True, "deprecated_method_architecture"), - ("armv7", True, "deprecated_method_architecture"), - ("aarch64", False, "deprecated_method"), - ("generic-x86-64", False, "deprecated_method"), + ("i386", True, "Unknown", False, [("unsupported_local_deps", None)]), + ("armhf", True, "Unknown", False, [("unsupported_local_deps", None)]), + ("armv7", True, "Unknown", False, [("unsupported_local_deps", None)]), + ("aarch64", False, "Unknown", False, [("unsupported_local_deps", None)]), + ("generic-x86-64", False, "Unknown", False, [("unsupported_local_deps", None)]), + ( + "i386", + True, + "Home Assistant Core", + True, + [ + ( + "deprecated_method_architecture", + {"installation_type": "Core", "arch": "i386"}, + ) + ], + ), + ( + "armhf", + True, + "Home Assistant Core", + True, + [ + ( + "deprecated_method_architecture", + {"installation_type": "Core", "arch": "armhf"}, + ) + ], + ), + ( + "armv7", + True, + "Home Assistant Core", + True, + [ + ( + "deprecated_method_architecture", + {"installation_type": "Core", "arch": "armv7"}, + ) + ], + ), + ( + "aarch64", + False, + "Home Assistant Core", + True, + [("deprecated_method", {"installation_type": "Core", "arch": "aarch64"})], + ), + ( + "generic-x86-64", + False, + "Home Assistant Core", + True, + [ + ( + "deprecated_method", + {"installation_type": "Core", "arch": "generic-x86-64"}, + ) + ], + ), ], ) async def test_deprecated_installation_issue_core( @@ -656,15 +711,19 @@ async def test_deprecated_installation_issue_core( issue_registry: ir.IssueRegistry, arch: str, bit_32: bool, - expected_issue: str, + installation_type: str, + venv: bool, + expected_issues: list[tuple[str, dict[str, str | None]]], ) -> None: """Test deprecated installation issue.""" with ( patch( "homeassistant.components.homeassistant.async_get_system_info", return_value={ - "installation_type": "Home Assistant Core", + "installation_type": installation_type, "arch": arch, + "docker": False, + "virtualenv": venv, }, ), patch( @@ -676,14 +735,12 @@ async def test_deprecated_installation_issue_core( hass.bus.async_fire(EVENT_HOMEASSISTANT_STARTED) await hass.async_block_till_done() - assert len(issue_registry.issues) == 1 - issue = issue_registry.async_get_issue(DOMAIN, expected_issue) - assert issue.domain == DOMAIN - assert issue.severity == ir.IssueSeverity.WARNING - assert issue.translation_placeholders == { - "installation_type": "Core", - "arch": arch, - } + assert len(issue_registry.issues) == len(expected_issues) + for expected_issue, expected_placeholders in expected_issues: + issue = issue_registry.async_get_issue(DOMAIN, expected_issue) + assert issue.domain == DOMAIN + assert issue.severity == ir.IssueSeverity.WARNING + assert issue.translation_placeholders == expected_placeholders @pytest.mark.parametrize( @@ -707,6 +764,8 @@ async def test_deprecated_installation_issue_container_32bit( "installation_type": "Home Assistant Container", "container_arch": arch, "arch": arch, + "docker": True, + "virtualenv": False, }, ), patch(