Skip to content

Commit

Permalink
Python 3.10 / Base image 2022.06.01 (home-assistant#73830)
Browse files Browse the repository at this point in the history
* 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 <git@frenck.dev>
  • Loading branch information
pvizeli and frenck authored Jun 22, 2022
1 parent 6b6e5fa commit 6cf9b22
Show file tree
Hide file tree
Showing 19 changed files with 43 additions and 162 deletions.
126 changes: 2 additions & 124 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand All @@ -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
Expand Down Expand Up @@ -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:
Expand Down
15 changes: 0 additions & 15 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 /

Expand Down
10 changes: 5 additions & 5 deletions build.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/compensation/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
2 changes: 1 addition & 1 deletion homeassistant/components/iqvia/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/iqvia/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/opencv/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
2 changes: 1 addition & 1 deletion homeassistant/components/tensorflow/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [],
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/trend/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
3 changes: 3 additions & 0 deletions homeassistant/package_constraints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
7 changes: 6 additions & 1 deletion machine/khadas-vim3
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 3 additions & 1 deletion machine/raspberrypi3
Original file line number Diff line number Diff line change
Expand Up @@ -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

##
Expand Down
4 changes: 3 additions & 1 deletion machine/raspberrypi3-64
Original file line number Diff line number Diff line change
Expand Up @@ -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

##
Expand Down
4 changes: 3 additions & 1 deletion machine/raspberrypi4
Original file line number Diff line number Diff line change
Expand Up @@ -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

##
Expand Down
4 changes: 3 additions & 1 deletion machine/raspberrypi4-64
Original file line number Diff line number Diff line change
Expand Up @@ -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

##
Expand Down
7 changes: 3 additions & 4 deletions machine/tinker
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions requirements_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion requirements_test_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions script/gen_requirements_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6cf9b22

Please sign in to comment.