From 6cf9b22b5a9f6f8dd6c77ee26fc70840f023c408 Mon Sep 17 00:00:00 2001 From: Pascal Vizeli Date: Wed, 22 Jun 2022 19:04:39 +0200 Subject: [PATCH] Python 3.10 / Base image 2022.06.01 (#73830) * Python 3.10 / Base image 2022.06.01 * Update requirements * push opencv * we don't need numpy on core for now * Remove unused ignore Co-authored-by: Franck Nijhof --- .github/workflows/wheels.yml | 126 +----------------- Dockerfile | 15 --- build.yaml | 10 +- .../components/compensation/manifest.json | 2 +- homeassistant/components/iqvia/manifest.json | 2 +- homeassistant/components/iqvia/sensor.py | 2 +- homeassistant/components/opencv/manifest.json | 2 +- .../components/tensorflow/manifest.json | 2 +- homeassistant/components/trend/manifest.json | 2 +- homeassistant/package_constraints.txt | 3 + machine/khadas-vim3 | 7 +- machine/raspberrypi3 | 4 +- machine/raspberrypi3-64 | 4 +- machine/raspberrypi4 | 4 +- machine/raspberrypi4-64 | 4 +- machine/tinker | 7 +- requirements_all.txt | 4 +- requirements_test_all.txt | 2 +- script/gen_requirements_all.py | 3 + 19 files changed, 43 insertions(+), 162 deletions(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 9bfcb48e09abbb..27307388546214 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -65,47 +65,6 @@ jobs: path: ./requirements_diff.txt core: - name: Build wheels with ${{ matrix.tag }} (${{ matrix.arch }}) for core - if: github.repository_owner == 'home-assistant' - needs: init - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - arch: ${{ fromJson(needs.init.outputs.architectures) }} - tag: - - "3.9-alpine3.14" - steps: - - name: Checkout the repository - uses: actions/checkout@v3.0.2 - - - name: Download env_file - uses: actions/download-artifact@v3 - with: - name: env_file - - - name: Download requirements_diff - uses: actions/download-artifact@v3 - with: - name: requirements_diff - - - name: Build wheels - uses: home-assistant/wheels@2022.01.2 - with: - tag: ${{ matrix.tag }} - arch: ${{ matrix.arch }} - wheels-host: wheels.hass.io - wheels-key: ${{ secrets.WHEELS_KEY }} - wheels-user: wheels - env-file: true - apk: "build-base;cmake;git;linux-headers;bluez-dev;libffi-dev;openssl-dev;glib-dev;eudev-dev;libxml2-dev;libxslt-dev;cargo" - pip: "Cython;numpy==1.21.6" - skip-binary: aiohttp - constraints: "homeassistant/package_constraints.txt" - requirements-diff: "requirements_diff.txt" - requirements: "requirements.txt" - - core_musllinux: name: Build musllinux wheels with musllinux_1_2 / cp310 at ${{ matrix.arch }} for core if: github.repository_owner == 'home-assistant' needs: init @@ -128,18 +87,6 @@ jobs: with: name: requirements_diff - - name: Adjust ENV / CP310 - run: | - if [ "${{ matrix.arch }}" = "i386" ]; then - echo "NPY_DISABLE_SVML=1" >> .env_file - fi - - requirement_files="requirements_all.txt requirements_diff.txt" - for requirement_file in ${requirement_files}; do - sed -i "s|numpy==1.21.6|numpy==1.22.4|g" ${requirement_file} - done - echo "numpy==1.22.4" >> homeassistant/package_constraints.txt - - name: Build wheels uses: home-assistant/wheels@2022.06.6 with: @@ -148,76 +95,13 @@ jobs: arch: ${{ matrix.arch }} wheels-key: ${{ secrets.WHEELS_KEY }} env-file: true - apk: "bluez-dev;libffi-dev;openssl-dev;glib-dev;eudev-dev;libxml2-dev;libxslt-dev;yaml-dev" + apk: "libffi-dev;openssl-dev;yaml-dev" skip-binary: aiohttp constraints: "homeassistant/package_constraints.txt" requirements-diff: "requirements_diff.txt" requirements: "requirements.txt" integrations: - name: Build wheels with ${{ matrix.tag }} (${{ matrix.arch }}) for integrations - if: github.repository_owner == 'home-assistant' - needs: init - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - arch: ${{ fromJson(needs.init.outputs.architectures) }} - tag: - - "3.9-alpine3.14" - steps: - - name: Checkout the repository - uses: actions/checkout@v3.0.2 - - - name: Download env_file - uses: actions/download-artifact@v3 - with: - name: env_file - - - name: Download requirements_diff - uses: actions/download-artifact@v3 - with: - name: requirements_diff - - - name: Uncomment packages - run: | - requirement_files="requirements_all.txt requirements_diff.txt" - for requirement_file in ${requirement_files}; do - sed -i "s|# pybluez|pybluez|g" ${requirement_file} - sed -i "s|# bluepy|bluepy|g" ${requirement_file} - sed -i "s|# beacontools|beacontools|g" ${requirement_file} - sed -i "s|# fritzconnection|fritzconnection|g" ${requirement_file} - sed -i "s|# pyuserinput|pyuserinput|g" ${requirement_file} - sed -i "s|# evdev|evdev|g" ${requirement_file} - sed -i "s|# python-eq3bt|python-eq3bt|g" ${requirement_file} - sed -i "s|# pycups|pycups|g" ${requirement_file} - sed -i "s|# homekit|homekit|g" ${requirement_file} - sed -i "s|# decora_wifi|decora_wifi|g" ${requirement_file} - sed -i "s|# decora|decora|g" ${requirement_file} - sed -i "s|# avion|avion|g" ${requirement_file} - sed -i "s|# PySwitchbot|PySwitchbot|g" ${requirement_file} - sed -i "s|# pySwitchmate|pySwitchmate|g" ${requirement_file} - sed -i "s|# face_recognition|face_recognition|g" ${requirement_file} - sed -i "s|# python-gammu|python-gammu|g" ${requirement_file} - done - - - name: Build wheels - uses: home-assistant/wheels@2022.01.2 - with: - tag: ${{ matrix.tag }} - arch: ${{ matrix.arch }} - wheels-host: wheels.hass.io - wheels-key: ${{ secrets.WHEELS_KEY }} - wheels-user: wheels - env-file: true - apk: "build-base;cmake;git;linux-headers;libexecinfo-dev;bluez-dev;libffi-dev;openssl-dev;glib-dev;eudev-dev;libxml2-dev;libxslt-dev;libpng-dev;libjpeg-turbo-dev;tiff-dev;autoconf;automake;cups-dev;gmp-dev;mpfr-dev;mpc1-dev;ffmpeg-dev;gammu-dev;yaml-dev;cargo" - pip: "Cython;numpy;scikit-build" - skip-binary: aiohttp,grpcio - constraints: "homeassistant/package_constraints.txt" - requirements-diff: "requirements_diff.txt" - requirements: "requirements_all.txt" - - integrations_musllinux: name: Build musllinux wheels with musllinux_1_2 / cp310 at ${{ matrix.arch }} for integrations if: github.repository_owner == 'home-assistant' needs: init @@ -256,18 +140,12 @@ jobs: sed -i "s|# python-gammu|python-gammu|g" ${requirement_file} done - - name: Adjust ENV / CP310 + - name: Adjust ENV run: | if [ "${{ matrix.arch }}" = "i386" ]; then echo "NPY_DISABLE_SVML=1" >> .env_file fi - requirement_files="requirements_all.txt requirements_diff.txt" - for requirement_file in ${requirement_files}; do - sed -i "s|numpy==1.21.6|numpy==1.22.4|g" ${requirement_file} - done - echo "numpy==1.22.4" >> homeassistant/package_constraints.txt - - name: Build wheels uses: home-assistant/wheels@2022.06.6 with: diff --git a/Dockerfile b/Dockerfile index 1d6ce675e74da5..13552d55a3d033 100644 --- a/Dockerfile +++ b/Dockerfile @@ -25,21 +25,6 @@ RUN \ -e ./homeassistant --use-deprecated=legacy-resolver \ && python3 -m compileall homeassistant/homeassistant -# Fix Bug with Alpine 3.14 and sqlite 3.35 -# https://gitlab.alpinelinux.org/alpine/aports/-/issues/12524 -ARG BUILD_ARCH -RUN \ - if [ "${BUILD_ARCH}" = "amd64" ]; then \ - export APK_ARCH=x86_64; \ - elif [ "${BUILD_ARCH}" = "i386" ]; then \ - export APK_ARCH=x86; \ - else \ - export APK_ARCH=${BUILD_ARCH}; \ - fi \ - && curl -O http://dl-cdn.alpinelinux.org/alpine/v3.13/main/${APK_ARCH}/sqlite-libs-3.34.1-r0.apk \ - && apk add --no-cache sqlite-libs-3.34.1-r0.apk \ - && rm -f sqlite-libs-3.34.1-r0.apk - # Home Assistant S6-Overlay COPY rootfs / diff --git a/build.yaml b/build.yaml index 196277184a31be..23486fb55107c0 100644 --- a/build.yaml +++ b/build.yaml @@ -1,11 +1,11 @@ image: homeassistant/{arch}-homeassistant shadow_repository: ghcr.io/home-assistant build_from: - aarch64: ghcr.io/home-assistant/aarch64-homeassistant-base:2022.05.0 - armhf: ghcr.io/home-assistant/armhf-homeassistant-base:2022.05.0 - armv7: ghcr.io/home-assistant/armv7-homeassistant-base:2022.05.0 - amd64: ghcr.io/home-assistant/amd64-homeassistant-base:2022.05.0 - i386: ghcr.io/home-assistant/i386-homeassistant-base:2022.05.0 + aarch64: ghcr.io/home-assistant/aarch64-homeassistant-base:2022.06.1 + armhf: ghcr.io/home-assistant/armhf-homeassistant-base:2022.06.1 + armv7: ghcr.io/home-assistant/armv7-homeassistant-base:2022.06.1 + amd64: ghcr.io/home-assistant/amd64-homeassistant-base:2022.06.1 + i386: ghcr.io/home-assistant/i386-homeassistant-base:2022.06.1 codenotary: signer: notary@home-assistant.io base_image: notary@home-assistant.io diff --git a/homeassistant/components/compensation/manifest.json b/homeassistant/components/compensation/manifest.json index 213e8888e23efb..eb3135954b0491 100644 --- a/homeassistant/components/compensation/manifest.json +++ b/homeassistant/components/compensation/manifest.json @@ -2,7 +2,7 @@ "domain": "compensation", "name": "Compensation", "documentation": "https://www.home-assistant.io/integrations/compensation", - "requirements": ["numpy==1.21.6"], + "requirements": ["numpy==1.22.4"], "codeowners": ["@Petro31"], "iot_class": "calculated" } diff --git a/homeassistant/components/iqvia/manifest.json b/homeassistant/components/iqvia/manifest.json index 9bb07157b54a2d..8b0dacd3575a11 100644 --- a/homeassistant/components/iqvia/manifest.json +++ b/homeassistant/components/iqvia/manifest.json @@ -3,7 +3,7 @@ "name": "IQVIA", "config_flow": true, "documentation": "https://www.home-assistant.io/integrations/iqvia", - "requirements": ["numpy==1.21.6", "pyiqvia==2022.04.0"], + "requirements": ["numpy==1.22.4", "pyiqvia==2022.04.0"], "codeowners": ["@bachya"], "iot_class": "cloud_polling", "loggers": ["pyiqvia"] diff --git a/homeassistant/components/iqvia/sensor.py b/homeassistant/components/iqvia/sensor.py index 51f2969e9fe46d..d8c7ea317c8efe 100644 --- a/homeassistant/components/iqvia/sensor.py +++ b/homeassistant/components/iqvia/sensor.py @@ -161,7 +161,7 @@ def calculate_trend(indices: list[float]) -> str: """Calculate the "moving average" of a set of indices.""" index_range = np.arange(0, len(indices)) index_array = np.array(indices) - linear_fit = np.polyfit(index_range, index_array, 1) # type: ignore[no-untyped-call] + linear_fit = np.polyfit(index_range, index_array, 1) slope = round(linear_fit[0], 2) if slope > 0: diff --git a/homeassistant/components/opencv/manifest.json b/homeassistant/components/opencv/manifest.json index 504b83bdaf903b..8cd1604f106658 100644 --- a/homeassistant/components/opencv/manifest.json +++ b/homeassistant/components/opencv/manifest.json @@ -2,7 +2,7 @@ "domain": "opencv", "name": "OpenCV", "documentation": "https://www.home-assistant.io/integrations/opencv", - "requirements": ["numpy==1.21.6", "opencv-python-headless==4.5.2.54"], + "requirements": ["numpy==1.22.4", "opencv-python-headless==4.6.0.66"], "codeowners": [], "iot_class": "local_push" } diff --git a/homeassistant/components/tensorflow/manifest.json b/homeassistant/components/tensorflow/manifest.json index efd4f3d76d0333..4168d820fb673a 100644 --- a/homeassistant/components/tensorflow/manifest.json +++ b/homeassistant/components/tensorflow/manifest.json @@ -6,7 +6,7 @@ "tensorflow==2.5.0", "tf-models-official==2.5.0", "pycocotools==2.0.1", - "numpy==1.21.6", + "numpy==1.22.4", "pillow==9.1.1" ], "codeowners": [], diff --git a/homeassistant/components/trend/manifest.json b/homeassistant/components/trend/manifest.json index aaae8f7cc546ae..578aea3bbc657e 100644 --- a/homeassistant/components/trend/manifest.json +++ b/homeassistant/components/trend/manifest.json @@ -2,7 +2,7 @@ "domain": "trend", "name": "Trend", "documentation": "https://www.home-assistant.io/integrations/trend", - "requirements": ["numpy==1.21.6"], + "requirements": ["numpy==1.22.4"], "codeowners": [], "quality_scale": "internal", "iot_class": "local_push" diff --git a/homeassistant/package_constraints.txt b/homeassistant/package_constraints.txt index 8452b4e62fbe03..16e508ddcda1f7 100644 --- a/homeassistant/package_constraints.txt +++ b/homeassistant/package_constraints.txt @@ -86,6 +86,9 @@ httpcore==0.15.0 # 5.2.0 fixed a collections abc deprecation hyperframe>=5.2.0 +# Ensure we run compatible with musllinux build env +numpy>=1.22.0 + # pytest_asyncio breaks our test suite. We rely on pytest-aiohttp instead pytest_asyncio==1000000000.0.0 diff --git a/machine/khadas-vim3 b/machine/khadas-vim3 index be07d6c8abae7e..5aeaca50780242 100644 --- a/machine/khadas-vim3 +++ b/machine/khadas-vim3 @@ -2,4 +2,9 @@ ARG BUILD_VERSION FROM homeassistant/aarch64-homeassistant:$BUILD_VERSION RUN apk --no-cache add \ - usbutils + usbutils \ + && pip3 install --no-cache-dir --no-index --only-binary=:all: --find-links "${WHEELS_LINKS}" \ + pybluez \ + pygatt[GATTTOOL] \ + -c /usr/src/homeassistant/requirements_all.txt \ + --use-deprecated=legacy-resolver diff --git a/machine/raspberrypi3 b/machine/raspberrypi3 index 9985b4a3b7a744..6eed9e94142750 100644 --- a/machine/raspberrypi3 +++ b/machine/raspberrypi3 @@ -6,7 +6,9 @@ RUN apk --no-cache add \ raspberrypi-libs \ usbutils \ && pip3 install --no-cache-dir --no-index --only-binary=:all: --find-links "${WHEELS_LINKS}" \ - bluepy pybluez -c /usr/src/homeassistant/requirements_all.txt \ + pybluez \ + pygatt[GATTTOOL] \ + -c /usr/src/homeassistant/requirements_all.txt \ --use-deprecated=legacy-resolver ## diff --git a/machine/raspberrypi3-64 b/machine/raspberrypi3-64 index 35c6eec77de4fc..1647f91813cce4 100644 --- a/machine/raspberrypi3-64 +++ b/machine/raspberrypi3-64 @@ -6,7 +6,9 @@ RUN apk --no-cache add \ raspberrypi-libs \ usbutils \ && pip3 install --no-cache-dir --no-index --only-binary=:all: --find-links "${WHEELS_LINKS}" \ - bluepy pybluez -c /usr/src/homeassistant/requirements_all.txt \ + pybluez \ + pygatt[GATTTOOL] \ + -c /usr/src/homeassistant/requirements_all.txt \ --use-deprecated=legacy-resolver ## diff --git a/machine/raspberrypi4 b/machine/raspberrypi4 index 9985b4a3b7a744..6eed9e94142750 100644 --- a/machine/raspberrypi4 +++ b/machine/raspberrypi4 @@ -6,7 +6,9 @@ RUN apk --no-cache add \ raspberrypi-libs \ usbutils \ && pip3 install --no-cache-dir --no-index --only-binary=:all: --find-links "${WHEELS_LINKS}" \ - bluepy pybluez -c /usr/src/homeassistant/requirements_all.txt \ + pybluez \ + pygatt[GATTTOOL] \ + -c /usr/src/homeassistant/requirements_all.txt \ --use-deprecated=legacy-resolver ## diff --git a/machine/raspberrypi4-64 b/machine/raspberrypi4-64 index 35c6eec77de4fc..1647f91813cce4 100644 --- a/machine/raspberrypi4-64 +++ b/machine/raspberrypi4-64 @@ -6,7 +6,9 @@ RUN apk --no-cache add \ raspberrypi-libs \ usbutils \ && pip3 install --no-cache-dir --no-index --only-binary=:all: --find-links "${WHEELS_LINKS}" \ - bluepy pybluez -c /usr/src/homeassistant/requirements_all.txt \ + pybluez \ + pygatt[GATTTOOL] \ + -c /usr/src/homeassistant/requirements_all.txt \ --use-deprecated=legacy-resolver ## diff --git a/machine/tinker b/machine/tinker index 9660ca71b9cbfb..5976d533188c1d 100644 --- a/machine/tinker +++ b/machine/tinker @@ -3,8 +3,7 @@ FROM homeassistant/armv7-homeassistant:$BUILD_VERSION RUN apk --no-cache add usbutils \ && pip3 install --no-cache-dir --no-index --only-binary=:all: --find-links "${WHEELS_LINKS}" \ - -c /usr/src/homeassistant/homeassistant/package_constraints.txt \ - --use-deprecated=legacy-resolver \ - bluepy \ pybluez \ - pygatt[GATTTOOL] + pygatt[GATTTOOL] \ + -c /usr/src/homeassistant/requirements_all.txt \ + --use-deprecated=legacy-resolver diff --git a/requirements_all.txt b/requirements_all.txt index aa93b7bae4c92d..fbe5d177194564 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -1123,7 +1123,7 @@ numato-gpio==0.10.0 # homeassistant.components.opencv # homeassistant.components.tensorflow # homeassistant.components.trend -numpy==1.21.6 +numpy==1.22.4 # homeassistant.components.oasa_telematics oasatelematics==0.3 @@ -1156,7 +1156,7 @@ open-garage==0.2.0 open-meteo==0.2.1 # homeassistant.components.opencv -# opencv-python-headless==4.5.2.54 +# opencv-python-headless==4.6.0.66 # homeassistant.components.openerz openerz-api==0.1.0 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index 1256de737ef614..4a627d0d6da421 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -773,7 +773,7 @@ numato-gpio==0.10.0 # homeassistant.components.opencv # homeassistant.components.tensorflow # homeassistant.components.trend -numpy==1.21.6 +numpy==1.22.4 # homeassistant.components.google oauth2client==4.1.3 diff --git a/script/gen_requirements_all.py b/script/gen_requirements_all.py index 88524ab63de9da..5db46ffbebaaf3 100755 --- a/script/gen_requirements_all.py +++ b/script/gen_requirements_all.py @@ -106,6 +106,9 @@ # 5.2.0 fixed a collections abc deprecation hyperframe>=5.2.0 +# Ensure we run compatible with musllinux build env +numpy>=1.22.0 + # pytest_asyncio breaks our test suite. We rely on pytest-aiohttp instead pytest_asyncio==1000000000.0.0