diff --git a/.github/workflows/install_dependencies/action.yml b/.github/workflows/install_dependencies/action.yml index c1f2ddd8..8f1732d6 100644 --- a/.github/workflows/install_dependencies/action.yml +++ b/.github/workflows/install_dependencies/action.yml @@ -31,8 +31,11 @@ runs: uses: actions/setup-python@v5.3.0 with: python-version: ${{ inputs.python-version }} + - name: Set up UV + uses: astral-sh/setup-uv@v6 - name: Install dependencies shell: bash run: | + uv venv --python ${{ inputs.python-version }} ./scripts/setup-dependencies ./scripts/setup-symlinks diff --git a/.github/workflows/pytest.yaml b/.github/workflows/pytest.yaml index 098a33af..fb25eff0 100644 --- a/.github/workflows/pytest.yaml +++ b/.github/workflows/pytest.yaml @@ -14,46 +14,22 @@ jobs: fail-fast: false matrix: include: - - python-version: "3.11" - core-version: "2023.7.3" - - python-version: "3.11" - core-version: "2023.8.4" - - python-version: "3.11" - core-version: "2023.9.3" - - python-version: "3.11" - core-version: "2023.10.5" - - python-version: "3.11" - core-version: "2023.11.3" - - python-version: "3.11" - core-version: "2023.12.4" - - python-version: "3.11" - core-version: "2024.1.6" - - python-version: "3.11" - core-version: "2024.2.5" - - python-version: "3.12" - core-version: "2024.3.3" - - python-version: "3.12" - core-version: "2024.4.4" - - python-version: "3.12" - core-version: "2024.5.5" - - python-version: "3.12" - core-version: "2024.6.4" - - python-version: "3.12" - core-version: "2024.7.4" - - python-version: "3.12" - core-version: "2024.8.3" - - python-version: "3.12" - core-version: "2024.9.3" - - python-version: "3.12" - core-version: "2024.10.4" - - python-version: "3.12" - core-version: "2024.11.3" - - python-version: "3.12" - core-version: "2024.12.5" - - python-version: "3.12" - core-version: "2025.1.0b5" - - python-version: "3.13" - core-version: "dev" + - core-version: "2024.12.5" + python-version: "3.12" + - core-version: "2025.1.4" + python-version: "3.12" + - core-version: "2025.2.5" + python-version: "3.13" + - core-version: "2025.3.4" + python-version: "3.13" + - core-version: "2025.4.4" + python-version: "3.13" + - core-version: "2025.5.3" + python-version: "3.13" + - core-version: "2025.6.1" + python-version: "3.13" + - core-version: "dev" + python-version: "3.13" steps: - name: Check out code from GitHub uses: actions/checkout@v4 diff --git a/.github/workflows/update-readme.yml b/.github/workflows/update-readme.yml index 1df50935..a4422130 100644 --- a/.github/workflows/update-readme.yml +++ b/.github/workflows/update-readme.yml @@ -20,7 +20,7 @@ jobs: - name: Install Home Assistant uses: ./.github/workflows/install_dependencies with: - python-version: "3.12" + python-version: "3.13" - name: Install markdown-code-runner and README code dependencies run: | diff --git a/Dockerfile b/Dockerfile index 6e871795..87f791e5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,13 +7,7 @@ # Optionally build the image yourself with: # docker build -t basnijholt/adaptive-lighting:latest . -FROM python:3.13-bookworm - -RUN apt-get update && \ - DEBIAN_FRONTEND=noninteractive apt-get install -y \ - git \ - build-essential libssl-dev libffi-dev python3-dev \ - && rm -rf /var/lib/apt/lists/* +FROM ghcr.io/astral-sh/uv:debian # Clone home-assistant/core RUN git clone --depth 1 --branch dev https://github.com/home-assistant/core.git /core @@ -25,9 +19,12 @@ COPY . /app/ RUN ln -s /core /app/core && /app/scripts/setup-symlinks # Install home-assistant/core dependencies +RUN mkdir -p /venv +ENV UV_PROJECT_ENVIRONMENT=/venv UV_PYTHON=3.13 PATH="/venv/bin:$PATH" +RUN uv venv RUN /app/scripts/setup-dependencies -WORKDIR /core +WORKDIR /app/core # Make 'custom_components/adaptive_lighting' imports available to tests ENV PYTHONPATH="${PYTHONPATH}:/app" diff --git a/scripts/develop b/scripts/develop index e7ce50cd..5382e0fc 100644 --- a/scripts/develop +++ b/scripts/develop @@ -1,6 +1,6 @@ #!/usr/bin/env bash -set -e +set -ex cd "$(dirname "$0")/.." diff --git a/scripts/setup-dependencies b/scripts/setup-dependencies index 9409ac0c..b9e2de1f 100755 --- a/scripts/setup-dependencies +++ b/scripts/setup-dependencies @@ -2,24 +2,13 @@ set -ex cd "$(dirname "$0")/.." -pip install uv -uv venv -source .venv/bin/activate +if grep -q 'mypy-dev==1.14.0a3' core/requirements_test.txt; then + # mypy-dev==1.14.0a3 seems to not be available anymore, HA 2024.12 is affected + sed -i 's/mypy-dev==1.14.0a3/mypy-dev==1.14.0a7/' core/requirements_test.txt +fi uv pip install -r core/requirements.txt - -if grep -q 'codecov' core/requirements_test.txt; then - # Older HA versions still have `codecov` in `requirements_test.txt` - # however it is removed from PyPI, so we cannot install it - sed -i '/codecov/d' core/requirements_test.txt -fi - -if grep -q 'mypy-dev==1.10.0a3' core/requirements_test.txt; then - # mypy-dev==1.10.0a3 seems to not be available anymore, HA 2024.4 and 2024.5 are affected - sed -i 's/mypy-dev==1.10.0a3/mypy-dev==1.10.0b1/' core/requirements_test.txt -fi uv pip install -r core/requirements_test.txt - uv pip install -e core/ uv pip install ulid-transform # this is in Adaptive-lighting's manifest.json uv pip install $(python test_dependencies.py) diff --git a/scripts/setup-devcontainer b/scripts/setup-devcontainer index bdb82534..f16c2cbd 100755 --- a/scripts/setup-devcontainer +++ b/scripts/setup-devcontainer @@ -12,6 +12,7 @@ pip install \ pip \ ruff +uv venv --python 3.13 ./scripts/setup-dependencies ./scripts/setup-symlinks uv run pre-commit install-hooks diff --git a/tests/README.md b/tests/README.md index dd125d97..a5b60839 100644 --- a/tests/README.md +++ b/tests/README.md @@ -20,7 +20,7 @@ This command will download the Docker image from [the adaptive-lighting Docker H If you prefer to build the image yourself, use the following command: ```bash -docker build -t basnijholt/adaptive-lighting:latest --no-cache . +docker build -t basnijholt/adaptive-lighting:latest --no-cache --progress=plain . ``` This might be necessary if the image on Docker Hub is outdated or if the [`test_dependencies.py`](../test_dependencies.py) file is updated.