diff --git a/CODEOWNERS b/CODEOWNERS index f1fb578155b..fcb3f9cf498 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -692,6 +692,8 @@ build.json @home-assistant/supervisor /homeassistant/components/iqvia/ @bachya /tests/components/iqvia/ @bachya /homeassistant/components/irish_rail_transport/ @ttroy50 +/homeassistant/components/isal/ @bdraco +/tests/components/isal/ @bdraco /homeassistant/components/islamic_prayer_times/ @engrbm87 @cpfair /tests/components/islamic_prayer_times/ @engrbm87 @cpfair /homeassistant/components/iss/ @DurgNomis-drol diff --git a/homeassistant/components/http/__init__.py b/homeassistant/components/http/__init__.py index 83601599d88..48f46bf973d 100644 --- a/homeassistant/components/http/__init__.py +++ b/homeassistant/components/http/__init__.py @@ -21,7 +21,6 @@ from aiohttp.typedefs import JSONDecoder, StrOrURL from aiohttp.web_exceptions import HTTPMovedPermanently, HTTPRedirection from aiohttp.web_protocol import RequestHandler from aiohttp_fast_url_dispatcher import FastUrlDispatcher, attach_fast_url_dispatcher -from aiohttp_isal import enable_isal from cryptography import x509 from cryptography.hazmat.primitives import hashes, serialization from cryptography.hazmat.primitives.asymmetric import rsa @@ -54,6 +53,7 @@ from homeassistant.helpers.http import ( HomeAssistantView, current_request, ) +from homeassistant.helpers.importlib import async_import_module from homeassistant.helpers.network import NoURLAvailableError, get_url from homeassistant.helpers.typing import ConfigType from homeassistant.loader import bind_hass @@ -201,7 +201,9 @@ class ApiConfig: async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up the HTTP API and debug interface.""" - enable_isal() + # Late import to ensure isal is updated before + # we import aiohttp_fast_zlib + (await async_import_module(hass, "aiohttp_fast_zlib")).enable() conf: ConfData | None = config.get(DOMAIN) diff --git a/homeassistant/components/http/manifest.json b/homeassistant/components/http/manifest.json index fb804251edc..b48a188cf47 100644 --- a/homeassistant/components/http/manifest.json +++ b/homeassistant/components/http/manifest.json @@ -1,6 +1,7 @@ { "domain": "http", "name": "HTTP", + "after_dependencies": ["isal"], "codeowners": ["@home-assistant/core"], "documentation": "https://www.home-assistant.io/integrations/http", "integration_type": "system", diff --git a/homeassistant/components/isal/__init__.py b/homeassistant/components/isal/__init__.py new file mode 100644 index 00000000000..3df59b7ea9f --- /dev/null +++ b/homeassistant/components/isal/__init__.py @@ -0,0 +1,20 @@ +"""The isal integration.""" + +from __future__ import annotations + +from homeassistant.core import HomeAssistant +from homeassistant.helpers import config_validation as cv +from homeassistant.helpers.typing import ConfigType + +DOMAIN = "isal" + +CONFIG_SCHEMA = cv.empty_config_schema(DOMAIN) + + +async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: + """Set up up isal. + + This integration is only used so that isal can be an optional + dep for aiohttp-fast-zlib. + """ + return True diff --git a/homeassistant/components/isal/manifest.json b/homeassistant/components/isal/manifest.json new file mode 100644 index 00000000000..d367b1c8eb9 --- /dev/null +++ b/homeassistant/components/isal/manifest.json @@ -0,0 +1,10 @@ +{ + "domain": "isal", + "name": "Intelligent Storage Acceleration", + "codeowners": ["@bdraco"], + "documentation": "https://www.home-assistant.io/integrations/isal", + "integration_type": "system", + "iot_class": "local_polling", + "quality_scale": "internal", + "requirements": ["isal==1.6.1"] +} diff --git a/homeassistant/package_constraints.txt b/homeassistant/package_constraints.txt index 9823505cee1..1f86ce8c5f7 100644 --- a/homeassistant/package_constraints.txt +++ b/homeassistant/package_constraints.txt @@ -4,7 +4,7 @@ aiodhcpwatcher==1.0.0 aiodiscover==2.1.0 aiodns==3.2.0 aiohttp-fast-url-dispatcher==0.3.0 -aiohttp-isal==0.3.1 +aiohttp-fast-zlib==0.1.0 aiohttp==3.9.5 aiohttp_cors==0.7.0 aiohttp_session==2.12.0 diff --git a/pyproject.toml b/pyproject.toml index c036daeb35e..5ff627600b5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -28,7 +28,7 @@ dependencies = [ "aiohttp_cors==0.7.0", "aiohttp_session==2.12.0", "aiohttp-fast-url-dispatcher==0.3.0", - "aiohttp-isal==0.3.1", + "aiohttp-fast-zlib==0.1.0", "astral==2.2", "async-interrupt==1.1.1", "attrs==23.2.0", diff --git a/requirements.txt b/requirements.txt index df001251a04..d112263386b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,7 +8,7 @@ aiohttp==3.9.5 aiohttp_cors==0.7.0 aiohttp_session==2.12.0 aiohttp-fast-url-dispatcher==0.3.0 -aiohttp-isal==0.3.1 +aiohttp-fast-zlib==0.1.0 astral==2.2 async-interrupt==1.1.1 attrs==23.2.0 diff --git a/requirements_all.txt b/requirements_all.txt index 9df14bf9eea..dc83388b9df 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -1160,6 +1160,9 @@ intellifire4py==2.2.2 # homeassistant.components.iperf3 iperf3==0.1.11 +# homeassistant.components.isal +isal==1.6.1 + # homeassistant.components.gogogate2 ismartgate==5.0.1 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index 257c2d4033d..e7bfcd5e1a3 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -941,6 +941,9 @@ insteon-frontend-home-assistant==0.5.0 # homeassistant.components.intellifire intellifire4py==2.2.2 +# homeassistant.components.isal +isal==1.6.1 + # homeassistant.components.gogogate2 ismartgate==5.0.1 diff --git a/tests/components/isal/__init__.py b/tests/components/isal/__init__.py new file mode 100644 index 00000000000..388be1aa266 --- /dev/null +++ b/tests/components/isal/__init__.py @@ -0,0 +1 @@ +"""Tests for the Intelligent Storage Acceleration integration.""" diff --git a/tests/components/isal/test_init.py b/tests/components/isal/test_init.py new file mode 100644 index 00000000000..66e9984dfe2 --- /dev/null +++ b/tests/components/isal/test_init.py @@ -0,0 +1,10 @@ +"""Test the Intelligent Storage Acceleration setup.""" + +from homeassistant.components.isal import DOMAIN +from homeassistant.core import HomeAssistant +from homeassistant.setup import async_setup_component + + +async def test_setup(hass: HomeAssistant) -> None: + """Ensure we can setup.""" + assert await async_setup_component(hass, DOMAIN, {}) diff --git a/tests/test_requirements.py b/tests/test_requirements.py index 73f3f54c3c4..2b2415e22a8 100644 --- a/tests/test_requirements.py +++ b/tests/test_requirements.py @@ -591,7 +591,7 @@ async def test_discovery_requirements_mqtt(hass: HomeAssistant) -> None: ) as mock_process: await async_get_integration_with_requirements(hass, "mqtt_comp") - assert len(mock_process.mock_calls) == 1 + assert len(mock_process.mock_calls) == 2 assert mock_process.mock_calls[0][1][1] == mqtt.requirements @@ -608,12 +608,13 @@ async def test_discovery_requirements_ssdp(hass: HomeAssistant) -> None: ) as mock_process: await async_get_integration_with_requirements(hass, "ssdp_comp") - assert len(mock_process.mock_calls) == 3 + assert len(mock_process.mock_calls) == 4 assert mock_process.mock_calls[0][1][1] == ssdp.requirements assert { mock_process.mock_calls[1][1][0], mock_process.mock_calls[2][1][0], - } == {"network", "recorder"} + mock_process.mock_calls[3][1][0], + } == {"network", "recorder", "isal"} @pytest.mark.parametrize( @@ -637,7 +638,7 @@ async def test_discovery_requirements_zeroconf( ) as mock_process: await async_get_integration_with_requirements(hass, "comp") - assert len(mock_process.mock_calls) == 3 + assert len(mock_process.mock_calls) == 4 assert mock_process.mock_calls[0][1][1] == zeroconf.requirements