From 261d31e16affc47244727571a8574b93c5876aaa Mon Sep 17 00:00:00 2001 From: lbbrhzn <8673442+lbbrhzn@users.noreply.github.com> Date: Thu, 31 Jul 2025 16:44:36 +0000 Subject: [PATCH 01/11] use same devcontainer as home assistant core --- .devcontainer/devcontainer.json | 81 ++++ scripts/json_schemas/manifest_schema.json | 449 ++++++++++++++++++++++ 2 files changed, 530 insertions(+) create mode 100644 .devcontainer/devcontainer.json create mode 100644 scripts/json_schemas/manifest_schema.json diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 00000000..e40b2110 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,81 @@ +{ + "name": "Home Assistant Dev", + "context": "..", + "dockerFile": "../Dockerfile.dev", + "postCreateCommand": "git config --global --add safe.directory ${containerWorkspaceFolder} && script/setup", + "postStartCommand": "script/bootstrap", + "containerEnv": { + "PYTHONASYNCIODEBUG": "1" + }, + "features": { + "ghcr.io/anthropics/devcontainer-features/claude-code:1.0": {}, + "ghcr.io/devcontainers/features/github-cli:1": {} + }, + // Port 5683 udp is used by Shelly integration + "appPort": [ + "8123:8123", + "5683:5683/udp" + ], + "runArgs": [ + "-e", + "GIT_EDITOR=code --wait", + "--security-opt", + "label=disable" + ], + "customizations": { + "vscode": { + "extensions": [ + "charliermarsh.ruff", + "ms-python.pylint", + "ms-python.vscode-pylance", + "visualstudioexptteam.vscodeintellicode", + "redhat.vscode-yaml", + "esbenp.prettier-vscode", + "GitHub.vscode-pull-request-github", + "GitHub.copilot" + ], + // Please keep this file in sync with settings in home-assistant/.vscode/settings.default.json + "settings": { + "python.experiments.optOutFrom": [ + "pythonTestAdapter" + ], + "python.defaultInterpreterPath": "/home/vscode/.local/ha-venv/bin/python", + "python.pythonPath": "/home/vscode/.local/ha-venv/bin/python", + "python.terminal.activateEnvInCurrentTerminal": true, + "python.testing.pytestArgs": [ + "--no-cov" + ], + "pylint.importStrategy": "fromEnvironment", + "editor.formatOnPaste": false, + "editor.formatOnSave": true, + "editor.formatOnType": true, + "files.trimTrailingWhitespace": true, + "terminal.integrated.profiles.linux": { + "zsh": { + "path": "/usr/bin/zsh" + } + }, + "terminal.integrated.defaultProfile.linux": "zsh", + "yaml.customTags": [ + "!input scalar", + "!secret scalar", + "!include_dir_named scalar", + "!include_dir_list scalar", + "!include_dir_merge_list scalar", + "!include_dir_merge_named scalar" + ], + "[python]": { + "editor.defaultFormatter": "charliermarsh.ruff" + }, + "json.schemas": [ + { + "fileMatch": [ + "homeassistant/components/*/manifest.json" + ], + "url": "${containerWorkspaceFolder}/script/json_schemas/manifest_schema.json" + } + ] + } + } + } +} \ No newline at end of file diff --git a/scripts/json_schemas/manifest_schema.json b/scripts/json_schemas/manifest_schema.json new file mode 100644 index 00000000..3a382cc5 --- /dev/null +++ b/scripts/json_schemas/manifest_schema.json @@ -0,0 +1,449 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Home Assistant integration manifest", + "description": "The manifest for a Home Assistant integration", + "type": "object", + "if": { + "properties": { + "integration_type": { + "const": "virtual" + } + }, + "required": [ + "integration_type" + ] + }, + "then": { + "oneOf": [ + { + "properties": { + "domain": { + "description": "The domain identifier of the integration.\nhttps://developers.home-assistant.io/docs/creating_integration_manifest/#domain", + "examples": [ + "mobile_app" + ], + "type": "string", + "pattern": "[0-9a-z_]+" + }, + "name": { + "description": "The friendly name of the integration.", + "type": "string" + }, + "integration_type": { + "description": "The integration type.\nhttps://developers.home-assistant.io/docs/creating_integration_manifest/#integration-type", + "const": "virtual" + }, + "iot_standards": { + "description": "The IoT standards which supports devices or services of this virtual integration.\nhttps://developers.home-assistant.io/docs/creating_integration_manifest/#iot-standards", + "type": "array", + "minItems": 1, + "items": { + "type": "string", + "enum": [ + "homekit", + "zigbee", + "zwave" + ] + } + } + }, + "additionalProperties": false, + "required": [ + "domain", + "name", + "integration_type", + "iot_standards" + ] + }, + { + "properties": { + "domain": { + "description": "The domain identifier of the integration.\nhttps://developers.home-assistant.io/docs/creating_integration_manifest/#domain", + "examples": [ + "mobile_app" + ], + "type": "string", + "pattern": "[0-9a-z_]+" + }, + "name": { + "description": "The friendly name of the integration.", + "type": "string" + }, + "integration_type": { + "description": "The integration type.\nhttps://developers.home-assistant.io/docs/creating_integration_manifest/#integration-type", + "const": "virtual" + }, + "supported_by": { + "description": "The integration which supports devices or services of this virtual integration.\nhttps://developers.home-assistant.io/docs/creating_integration_manifest/#supported-by", + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "domain", + "name", + "integration_type", + "supported_by" + ] + } + ] + }, + "else": { + "properties": { + "domain": { + "description": "The domain identifier of the integration.\nhttps://developers.home-assistant.io/docs/creating_integration_manifest/#domain", + "examples": [ + "mobile_app" + ], + "type": "string", + "pattern": "[0-9a-z_]+" + }, + "name": { + "description": "The friendly name of the integration.", + "type": "string" + }, + "integration_type": { + "description": "The integration type.\nhttps://developers.home-assistant.io/docs/creating_integration_manifest/#integration-type", + "type": "string", + "default": "hub", + "enum": [ + "device", + "entity", + "hardware", + "helper", + "hub", + "service", + "system" + ] + }, + "config_flow": { + "description": "Whether the integration is configurable from the UI.\nhttps://developers.home-assistant.io/docs/creating_integration_manifest/#config-flow", + "type": "boolean" + }, + "mqtt": { + "description": "A list of topics to subscribe for the discovery of devices via MQTT.\nThis requires to specify \"mqtt\" in either the \"dependencies\" or \"after_dependencies\".\nhttps://developers.home-assistant.io/docs/creating_integration_manifest/#mqtt", + "type": "array", + "items": { + "type": "string" + }, + "uniqueItems": true + }, + "zeroconf": { + "description": "A list containing service domains to search for devices to discover via Zeroconf. Items can either be strings, which discovers all devices in the specific service domain, and/or objects which include filters. (useful for generic service domains like _http._tcp.local.)\nA device is discovered if it matches one of the items, but inside the individual item all properties have to be matched.\nhttps://developers.home-assistant.io/docs/creating_integration_manifest/#zeroconf", + "type": "array", + "minItems": 1, + "items": { + "anyOf": [ + { + "type": "string", + "pattern": "^.*\\.local\\.$", + "description": "Service domain to search for devices." + }, + { + "type": "object", + "properties": { + "type": { + "description": "The service domain to search for devices.", + "examples": [ + "_http._tcp.local." + ], + "type": "string", + "pattern": "^.*\\.local\\.$" + }, + "name": { + "description": "The name or name pattern of the devices to filter.", + "type": "string" + }, + "properties": { + "description": "The properties of the Zeroconf advertisement to filter.", + "type": "object", + "additionalProperties": { + "type": "string" + } + } + }, + "required": [ + "type" + ], + "additionalProperties": false + } + ] + }, + "uniqueItems": true + }, + "ssdp": { + "description": "A list of matchers to find devices discoverable via SSDP/UPnP. In order to be discovered, the device has to match all properties of any of the matchers.\nhttps://developers.home-assistant.io/docs/creating_integration_manifest/#ssdp", + "type": "array", + "minItems": 1, + "items": { + "description": "A matcher for the SSDP discovery.", + "type": "object", + "properties": { + "st": { + "type": "string" + }, + "deviceType": { + "type": "string" + }, + "manufacturer": { + "type": "string" + }, + "modelDescription": { + "type": "string" + } + }, + "additionalProperties": { + "type": "string" + } + } + }, + "bluetooth": { + "description": "A list of matchers to find devices discoverable via Bluetooth. In order to be discovered, the device has to match all properties of any of the matchers.\nhttps://developers.home-assistant.io/docs/creating_integration_manifest/#bluetooth", + "type": "array", + "minItems": 1, + "items": { + "description": "A matcher for the bluetooth discovery", + "type": "object", + "properties": { + "connectable": { + "description": "Whether the device needs to be connected to or it works with just advertisement data.", + "type": "boolean" + }, + "local_name": { + "description": "The name or a name pattern of the device to match.", + "type": "string", + "pattern": "^([^*]+|[^*]{3,}[*].*)$" + }, + "service_uuid": { + "description": "The 128-bit service data UUID to match.", + "type": "string", + "pattern": "[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}" + }, + "service_data_uuid": { + "description": "The 16-bit service data UUID to match, converted into the corresponding 128-bit UUID by replacing the 3rd and 4th byte of `00000000-0000-1000-8000-00805f9b34fb` with the 16-bit UUID.", + "examples": [ + "0000fd3d-0000-1000-8000-00805f9b34fb" + ], + "type": "string", + "pattern": "0000[0-9a-f]{4}-0000-1000-8000-00805f9b34fb" + }, + "manufacturer_id": { + "description": "The Manufacturer ID to match.", + "type": "integer" + }, + "manufacturer_data_start": { + "description": "The start bytes of the manufacturer data to match.", + "type": "array", + "minItems": 1, + "items": { + "type": "integer", + "minimum": 0, + "maximum": 255 + } + } + }, + "additionalProperties": false + }, + "uniqueItems": true + }, + "homekit": { + "description": "A list of model names to find devices which are discoverable via HomeKit. A device is discovered if the model name of the device starts with any of the specified model names.\nhttps://developers.home-assistant.io/docs/creating_integration_manifest/#homekit", + "type": "object", + "properties": { + "models": { + "description": "The model names to search for.", + "type": "array", + "items": { + "type": "string" + }, + "uniqueItems": true + } + }, + "required": [ + "models" + ], + "additionalProperties": false + }, + "dhcp": { + "description": "A list of matchers to find devices discoverable via DHCP. In order to be discovered, the device has to match all properties of any of the matchers.\nYou can specify an item with \"registered_devices\" set to true to check for devices with MAC addresses specified in the device registry.\nhttps://developers.home-assistant.io/docs/creating_integration_manifest/#dhcp", + "type": "array", + "items": { + "anyOf": [ + { + "type": "object", + "properties": { + "registered_devices": { + "description": "Whether the MAC addresses of devices in the device registry should be used for discovery, useful if the discovery is used to update the IP address of already registered devices.", + "const": true + } + }, + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "hostname": { + "description": "The hostname or hostname pattern to match.", + "type": "string" + }, + "macaddress": { + "description": "The MAC address or MAC address pattern to match.", + "type": "string", + "maxLength": 12 + } + }, + "additionalProperties": false + } + ] + }, + "uniqueItems": true + }, + "usb": { + "description": "A list of matchers to find devices discoverable via USB. In order to be discovered, the device has to match all properties of any of the matchers.\nhttps://developers.home-assistant.io/docs/creating_integration_manifest/#usb", + "type": "array", + "uniqueItems": true, + "items": { + "type": "object", + "additionalProperties": false, + "properties": { + "vid": { + "description": "The vendor ID to match.", + "type": "string", + "pattern": "[0-9A-F]{4}" + }, + "pid": { + "description": "The product ID to match.", + "type": "string", + "pattern": "[0-9A-F]{4}" + }, + "description": { + "description": "The USB device description to match.", + "type": "string" + }, + "manufacturer": { + "description": "The manufacturer to match.", + "type": "string" + }, + "serial_number": { + "description": "The serial number to match.", + "type": "string" + }, + "known_devices": { + "type": "array", + "items": { + "type": "string" + } + } + } + } + }, + "documentation": { + "description": "The website containing the documentation for the integration. It has to be in the format \"https://www.home-assistant.io/integrations/[domain]\"\nhttps://developers.home-assistant.io/docs/creating_integration_manifest/#documentation", + "type": "string", + "pattern": "^https://www.home-assistant.io/integrations/[0-9a-z_]+$", + "format": "uri" + }, + "quality_scale": { + "description": "The quality scale of the integration.\nhttps://developers.home-assistant.io/docs/creating_integration_manifest/#integration-quality-scale", + "type": "string", + "enum": [ + "bronze", + "silver", + "gold", + "platinum", + "internal", + "legacy" + ] + }, + "requirements": { + "description": "The PyPI package requirements for the integration. The package has to be pinned to a specific version.\nhttps://developers.home-assistant.io/docs/creating_integration_manifest/#requirements", + "type": "array", + "items": { + "type": "string", + "pattern": ".+==.+" + }, + "uniqueItems": true + }, + "dependencies": { + "description": "A list of integrations which need to be loaded before this integration can be set up.\nhttps://developers.home-assistant.io/docs/creating_integration_manifest/#dependencies", + "type": "array", + "items": { + "type": "string" + }, + "minItems": 1, + "uniqueItems": true + }, + "after_dependencies": { + "description": "A list of integrations which need to be loaded before this integration is set up when it is configured. The integration will still be set up when the \"after_dependencies\" are not configured.\nhttps://developers.home-assistant.io/docs/creating_integration_manifest/#after-dependencies", + "type": "array", + "items": { + "type": "string" + }, + "minItems": 1, + "uniqueItems": true + }, + "codeowners": { + "description": "A list of GitHub usernames or GitHub team names of the integration owners.\nhttps://developers.home-assistant.io/docs/creating_integration_manifest/#code-owners", + "type": "array", + "minItems": 0, + "items": { + "type": "string", + "pattern": "^@.+$" + }, + "uniqueItems": true + }, + "loggers": { + "description": "A list of logger names used by the requirements.\nhttps://developers.home-assistant.io/docs/creating_integration_manifest/#loggers", + "type": "array", + "minItems": 1, + "items": { + "type": "string" + }, + "uniqueItems": true + }, + "disabled": { + "description": "The reason for the integration being disabled.", + "type": "string" + }, + "iot_class": { + "description": "The IoT class of the integration, describing how the integration connects to the device or service.\nhttps://developers.home-assistant.io/docs/creating_integration_manifest/#iot-class", + "type": "string", + "enum": [ + "assumed_state", + "cloud_polling", + "cloud_push", + "local_polling", + "local_push", + "calculated" + ] + }, + "single_config_entry": { + "description": "Whether the integration only supports a single config entry.\nhttps://developers.home-assistant.io/docs/creating_integration_manifest/#single-config-entry-only", + "const": true + } + }, + "additionalProperties": false, + "required": [ + "domain", + "name", + "codeowners", + "documentation" + ], + "dependencies": { + "mqtt": { + "anyOf": [ + { + "required": [ + "dependencies" + ] + }, + { + "required": [ + "after_dependencies" + ] + } + ] + } + } + } +} \ No newline at end of file From 9c4fcdc4d8ad2aefb80c9c16a9606e3718c6b3c1 Mon Sep 17 00:00:00 2001 From: lbbrhzn <8673442+lbbrhzn@users.noreply.github.com> Date: Thu, 31 Jul 2025 16:47:25 +0000 Subject: [PATCH 02/11] remove old devcontainer.json --- .devcontainer.json | 41 ----------------------------------------- 1 file changed, 41 deletions(-) delete mode 100644 .devcontainer.json diff --git a/.devcontainer.json b/.devcontainer.json deleted file mode 100644 index c2f0edcd..00000000 --- a/.devcontainer.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "name": "lbbrhzn/ocpp", - "image": "mcr.microsoft.com/devcontainers/python:3.13", - "postCreateCommand": "scripts/setup", - "forwardPorts": [ - 8123 - ], - "portsAttributes": { - "8123": { - "label": "Home Assistant", - "onAutoForward": "notify" - } - }, - "customizations": { - "vscode": { - "extensions": [ - "charliermarsh.ruff", - "github.vscode-pull-request-github", - "ms-python.python", - "ms-python.vscode-pylance", - "ryanluker.vscode-coverage-gutters" - ], - "settings": { - "files.eol": "\n", - "editor.tabSize": 4, - "editor.formatOnPaste": true, - "editor.formatOnSave": true, - "editor.formatOnType": false, - "files.trimTrailingWhitespace": true, - "python.analysis.typeCheckingMode": "basic", - "python.analysis.autoImportCompletions": true, - "python.defaultInterpreterPath": "/usr/local/bin/python", - "[python]": { - "editor.defaultFormatter": "charliermarsh.ruff" - } - } - } - }, - "remoteUser": "vscode", - "features": {} -} \ No newline at end of file From 703e8e8f3f2300f91d3fdad840f679ddd02d0a8e Mon Sep 17 00:00:00 2001 From: lbbrhzn <8673442+lbbrhzn@users.noreply.github.com> Date: Thu, 31 Jul 2025 16:52:24 +0000 Subject: [PATCH 03/11] Add Dockerfile --- Dockerfile | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++ Dockerfile.dev | 61 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 124 insertions(+) create mode 100644 Dockerfile create mode 100644 Dockerfile.dev diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..0064dce3 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,63 @@ +# Automatically generated by hassfest. +# +# To update, run python3 -m script.hassfest -p docker +ARG BUILD_FROM +FROM ${BUILD_FROM} + +# Synchronize with homeassistant/core.py:async_stop +ENV \ + S6_SERVICES_GRACETIME=240000 \ + UV_SYSTEM_PYTHON=true \ + UV_NO_CACHE=true + +ARG QEMU_CPU + +# Home Assistant S6-Overlay +COPY rootfs / + +# Needs to be redefined inside the FROM statement to be set for RUN commands +ARG BUILD_ARCH +# Get go2rtc binary +RUN \ + case "${BUILD_ARCH}" in \ + "aarch64") go2rtc_suffix='arm64' ;; \ + "armhf") go2rtc_suffix='armv6' ;; \ + "armv7") go2rtc_suffix='arm' ;; \ + *) go2rtc_suffix=${BUILD_ARCH} ;; \ + esac \ + && curl -L https://github.com/AlexxIT/go2rtc/releases/download/v1.9.9/go2rtc_linux_${go2rtc_suffix} --output /bin/go2rtc \ + && chmod +x /bin/go2rtc \ + # Verify go2rtc can be executed + && go2rtc --version + +# Install uv +RUN pip3 install uv==0.7.1 + +WORKDIR /usr/src + +## Setup Home Assistant Core dependencies +COPY requirements.txt homeassistant/ +COPY homeassistant/package_constraints.txt homeassistant/homeassistant/ +RUN \ + uv pip install \ + --no-build \ + -r homeassistant/requirements.txt + +COPY requirements_all.txt home_assistant_frontend-* home_assistant_intents-* homeassistant/ +RUN \ + if ls homeassistant/home_assistant_*.whl 1> /dev/null 2>&1; then \ + uv pip install homeassistant/home_assistant_*.whl; \ + fi \ + && uv pip install \ + --no-build \ + -r homeassistant/requirements_all.txt + +## Setup Home Assistant Core +COPY . homeassistant/ +RUN \ + uv pip install \ + -e ./homeassistant \ + && python3 -m compileall \ + homeassistant/homeassistant + +WORKDIR /config \ No newline at end of file diff --git a/Dockerfile.dev b/Dockerfile.dev new file mode 100644 index 00000000..4161ef6c --- /dev/null +++ b/Dockerfile.dev @@ -0,0 +1,61 @@ +FROM mcr.microsoft.com/vscode/devcontainers/base:debian + +SHELL ["/bin/bash", "-o", "pipefail", "-c"] + +RUN \ + curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \ + && apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ + # Additional library needed by some tests and accordingly by VScode Tests Discovery + bluez \ + ffmpeg \ + libudev-dev \ + libavformat-dev \ + libavcodec-dev \ + libavdevice-dev \ + libavutil-dev \ + libgammu-dev \ + libswscale-dev \ + libswresample-dev \ + libavfilter-dev \ + libpcap-dev \ + libturbojpeg0 \ + libyaml-dev \ + libxml2 \ + git \ + cmake \ + autoconf \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +# Add go2rtc binary +COPY --from=ghcr.io/alexxit/go2rtc:latest /usr/local/bin/go2rtc /bin/go2rtc + +WORKDIR /usr/src + +COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv + +RUN uv python install 3.13.2 + +USER vscode +ENV VIRTUAL_ENV="/home/vscode/.local/ha-venv" +RUN uv venv $VIRTUAL_ENV +ENV PATH="$VIRTUAL_ENV/bin:$PATH" + +WORKDIR /tmp + +# Setup hass-release +RUN git clone --depth 1 https://github.com/home-assistant/hass-release ~/hass-release \ + && uv pip install -e ~/hass-release/ + +# Install Python dependencies from requirements +COPY requirements.txt ./ +COPY homeassistant/package_constraints.txt homeassistant/package_constraints.txt +RUN uv pip install -r requirements.txt +COPY requirements_test.txt requirements_test_pre_commit.txt ./ +RUN uv pip install -r requirements_test.txt + +WORKDIR /workspaces + +# Set the default shell to bash instead of sh +ENV SHELL=/bin/bash \ No newline at end of file From f1c2e48f2d2709c4bf580f7fc2fc52e5b98bfe10 Mon Sep 17 00:00:00 2001 From: lbbrhzn <8673442+lbbrhzn@users.noreply.github.com> Date: Thu, 31 Jul 2025 16:57:50 +0000 Subject: [PATCH 04/11] update port settings --- .devcontainer/devcontainer.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index e40b2110..87693222 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -11,10 +11,10 @@ "ghcr.io/anthropics/devcontainer-features/claude-code:1.0": {}, "ghcr.io/devcontainers/features/github-cli:1": {} }, - // Port 5683 udp is used by Shelly integration "appPort": [ - "8123:8123", - "5683:5683/udp" + "9000:9000", // OCPP + "8123:8123", // Home Assistant + "5683:5683/udp" // Shelly integration ], "runArgs": [ "-e", From 32e2ab57f382d7de8d761ce2f2dc74d234ff0254 Mon Sep 17 00:00:00 2001 From: lbbrhzn <8673442+lbbrhzn@users.noreply.github.com> Date: Thu, 31 Jul 2025 16:59:22 +0000 Subject: [PATCH 05/11] fix location of schemas --- .devcontainer/devcontainer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 87693222..1cee1a9f 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -72,7 +72,7 @@ "fileMatch": [ "homeassistant/components/*/manifest.json" ], - "url": "${containerWorkspaceFolder}/script/json_schemas/manifest_schema.json" + "url": "${containerWorkspaceFolder}/scripts/json_schemas/manifest_schema.json" } ] } From 81853c1d2f9762e15dc26031dfadca26a10eaf43 Mon Sep 17 00:00:00 2001 From: lbbrhzn <8673442+lbbrhzn@users.noreply.github.com> Date: Thu, 31 Jul 2025 17:00:25 +0000 Subject: [PATCH 06/11] fix location of setup script --- .devcontainer/devcontainer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 1cee1a9f..59d595aa 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -2,7 +2,7 @@ "name": "Home Assistant Dev", "context": "..", "dockerFile": "../Dockerfile.dev", - "postCreateCommand": "git config --global --add safe.directory ${containerWorkspaceFolder} && script/setup", + "postCreateCommand": "git config --global --add safe.directory ${containerWorkspaceFolder} && scripts/setup", "postStartCommand": "script/bootstrap", "containerEnv": { "PYTHONASYNCIODEBUG": "1" From 93ef195801605220ce62c3f76f0ed0541ca11330 Mon Sep 17 00:00:00 2001 From: lbbrhzn <8673442+lbbrhzn@users.noreply.github.com> Date: Thu, 31 Jul 2025 17:09:25 +0000 Subject: [PATCH 07/11] add bootstrap script --- .devcontainer/devcontainer.json | 2 +- scripts/bootstrap | 9 +++++++++ scripts/setup | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 scripts/bootstrap diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 59d595aa..8c3f3e9d 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -3,7 +3,7 @@ "context": "..", "dockerFile": "../Dockerfile.dev", "postCreateCommand": "git config --global --add safe.directory ${containerWorkspaceFolder} && scripts/setup", - "postStartCommand": "script/bootstrap", + "postStartCommand": "scripts/bootstrap", "containerEnv": { "PYTHONASYNCIODEBUG": "1" }, diff --git a/scripts/bootstrap b/scripts/bootstrap new file mode 100644 index 00000000..7bc0759e --- /dev/null +++ b/scripts/bootstrap @@ -0,0 +1,9 @@ +#!/bin/sh +# Resolve all dependencies that the application requires to run. + +# Stop on errors +set -e + +cd "$(dirname "$0")/.." + +python3 -m pip install -r requirements.txt diff --git a/scripts/setup b/scripts/setup index aa662978..555e977b 100755 --- a/scripts/setup +++ b/scripts/setup @@ -4,6 +4,6 @@ set -e cd "$(dirname "$0")/.." -python3 -m pip install --requirement requirements.txt +scripts/bootstrap pre-commit install pre-commit run --all \ No newline at end of file From 6abae1d1a7061a1a3012323941736ee347d20c68 Mon Sep 17 00:00:00 2001 From: lbbrhzn <8673442+lbbrhzn@users.noreply.github.com> Date: Thu, 31 Jul 2025 17:34:36 +0000 Subject: [PATCH 08/11] make bootstrap executable --- scripts/bootstrap | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 scripts/bootstrap diff --git a/scripts/bootstrap b/scripts/bootstrap old mode 100644 new mode 100755 From bbf639c2bf8d6ba2cd4272512dc5e825ca4484c2 Mon Sep 17 00:00:00 2001 From: lbbrhzn <8673442+lbbrhzn@users.noreply.github.com> Date: Thu, 31 Jul 2025 19:31:59 +0000 Subject: [PATCH 09/11] fix Dockerfile --- Dockerfile | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/Dockerfile b/Dockerfile index 0064dce3..b63cd1c7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -35,29 +35,9 @@ RUN pip3 install uv==0.7.1 WORKDIR /usr/src -## Setup Home Assistant Core dependencies -COPY requirements.txt homeassistant/ -COPY homeassistant/package_constraints.txt homeassistant/homeassistant/ RUN \ uv pip install \ - --no-build \ - -r homeassistant/requirements.txt + -r requirements.txt -COPY requirements_all.txt home_assistant_frontend-* home_assistant_intents-* homeassistant/ -RUN \ - if ls homeassistant/home_assistant_*.whl 1> /dev/null 2>&1; then \ - uv pip install homeassistant/home_assistant_*.whl; \ - fi \ - && uv pip install \ - --no-build \ - -r homeassistant/requirements_all.txt - -## Setup Home Assistant Core -COPY . homeassistant/ -RUN \ - uv pip install \ - -e ./homeassistant \ - && python3 -m compileall \ - homeassistant/homeassistant WORKDIR /config \ No newline at end of file From 40e253a27c0f3767aff8f8cc11f25450aaa7f94b Mon Sep 17 00:00:00 2001 From: lbbrhzn <8673442+lbbrhzn@users.noreply.github.com> Date: Thu, 31 Jul 2025 20:39:08 +0000 Subject: [PATCH 10/11] Update Dockerfile.dev --- Dockerfile.dev | 3 --- 1 file changed, 3 deletions(-) diff --git a/Dockerfile.dev b/Dockerfile.dev index 4161ef6c..ff9e0537 100644 --- a/Dockerfile.dev +++ b/Dockerfile.dev @@ -50,10 +50,7 @@ RUN git clone --depth 1 https://github.com/home-assistant/hass-release ~/hass-re # Install Python dependencies from requirements COPY requirements.txt ./ -COPY homeassistant/package_constraints.txt homeassistant/package_constraints.txt RUN uv pip install -r requirements.txt -COPY requirements_test.txt requirements_test_pre_commit.txt ./ -RUN uv pip install -r requirements_test.txt WORKDIR /workspaces From 49c66d4e5ec66ffa49c3b92595ef768844996c81 Mon Sep 17 00:00:00 2001 From: lbbrhzn <8673442+lbbrhzn@users.noreply.github.com> Date: Thu, 31 Jul 2025 20:46:27 +0000 Subject: [PATCH 11/11] allow prereleases --- Dockerfile.dev | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile.dev b/Dockerfile.dev index ff9e0537..a37ca960 100644 --- a/Dockerfile.dev +++ b/Dockerfile.dev @@ -50,7 +50,7 @@ RUN git clone --depth 1 https://github.com/home-assistant/hass-release ~/hass-re # Install Python dependencies from requirements COPY requirements.txt ./ -RUN uv pip install -r requirements.txt +RUN uv pip install --prerelease=allow -r requirements.txt WORKDIR /workspaces