From 02bdc4b555f0bee035f7584dcf0f1c39b0dfb269 Mon Sep 17 00:00:00 2001 From: Mike Degatano Date: Wed, 3 Jul 2024 11:51:16 -0400 Subject: [PATCH] Use uv instead of pip in Supervisor (#5152) * Migrate supervisor image from pip to uv * Set python paths * Put in i386 conditional to match core * Semicolons within if statements --- .devcontainer/devcontainer.json | 17 +++++++++++------ Dockerfile | 14 +++++++++----- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index d09213424..4071efdea 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -5,7 +5,8 @@ "WORKSPACE_DIRECTORY": "${containerWorkspaceFolder}" }, "appPort": ["9123:8123", "7357:4357"], - "postCreateCommand": "bash devcontainer_bootstrap", + "postCreateCommand": "bash devcontainer_setup", + "postStartCommand": "bash devcontainer_bootstrap", "runArgs": ["-e", "GIT_EDITOR=code --wait", "--privileged"], "customizations": { "vscode": { @@ -19,17 +20,21 @@ "GitHub.vscode-pull-request-github" ], "settings": { + "python.defaultInterpreterPath": "/usr/local/bin/python", + "python.pythonPath": "/usr/local/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", - "editor.formatOnPaste": false, - "editor.formatOnSave": true, - "editor.formatOnType": true, - "files.trimTrailingWhitespace": true, - "python.pythonPath": "/usr/local/bin/python3", "[python]": { "editor.defaultFormatter": "charliermarsh.ruff" } diff --git a/Dockerfile b/Dockerfile index 67b04fc28..8a0aef027 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,7 +4,8 @@ FROM ${BUILD_FROM} ENV \ S6_SERVICES_GRACETIME=10000 \ SUPERVISOR_API=http://localhost \ - CRYPTOGRAPHY_OPENSSL_NO_LEGACY=1 + CRYPTOGRAPHY_OPENSSL_NO_LEGACY=1 \ + UV_SYSTEM_PYTHON=true ARG \ COSIGN_VERSION \ @@ -26,14 +27,17 @@ RUN \ yaml \ \ && curl -Lso /usr/bin/cosign "https://github.com/home-assistant/cosign/releases/download/${COSIGN_VERSION}/cosign_${BUILD_ARCH}" \ - && chmod a+x /usr/bin/cosign + && chmod a+x /usr/bin/cosign \ + && pip3 install uv==0.2.21 # Install requirements COPY requirements.txt . RUN \ - export MAKEFLAGS="-j$(nproc)" \ - && pip3 install --only-binary=:all: \ - -r ./requirements.txt \ + if [ "${BUILD_ARCH}" = "i386" ]; then \ + linux32 uv pip install --no-build -r requirements.txt; \ + else \ + uv pip install --no-build -r requirements.txt; \ + fi \ && rm -f requirements.txt # Install Home Assistant Supervisor