Skip to content

Commit 4682730

Browse files
authored
Update dependencies (#53)
1 parent ae2faa1 commit 4682730

File tree

16 files changed

+216
-99
lines changed

16 files changed

+216
-99
lines changed

.devcontainer/Dockerfile

Lines changed: 47 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,52 @@
1-
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.177.0/containers/python-3/.devcontainer/base.Dockerfile
1+
FROM mcr.microsoft.com/devcontainers/python:1-3.12
22

3-
FROM mcr.microsoft.com/vscode/devcontainers/python:0-3.11
3+
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
44

5-
# [Option] Install Node.js
6-
ARG INSTALL_NODE="true"
7-
ARG NODE_VERSION="lts/*"
8-
RUN if [ "${INSTALL_NODE}" = "true" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi
5+
# Uninstall pre-installed formatting and linting tools
6+
# They would conflict with our pinned versions
7+
RUN \
8+
pipx uninstall pydocstyle \
9+
&& pipx uninstall pycodestyle \
10+
&& pipx uninstall mypy \
11+
&& pipx uninstall pylint
912

10-
# [Optional] If your pip requirements rarely change, uncomment this section to add them to the image.
11-
# COPY requirements.txt /tmp/pip-tmp/
12-
# RUN pip3 --disable-pip-version-check --no-cache-dir install -r /tmp/pip-tmp/requirements.txt \
13-
# && rm -rf /tmp/pip-tmp
13+
RUN \
14+
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \
15+
&& apt-get update \
16+
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
17+
# Additional library needed by some tests and accordingly by VScode Tests Discovery
18+
bluez \
19+
ffmpeg \
20+
libudev-dev \
21+
libavformat-dev \
22+
libavcodec-dev \
23+
libavdevice-dev \
24+
libavutil-dev \
25+
libgammu-dev \
26+
libswscale-dev \
27+
libswresample-dev \
28+
libavfilter-dev \
29+
libpcap-dev \
30+
libturbojpeg0 \
31+
libyaml-dev \
32+
libxml2 \
33+
git \
34+
cmake \
35+
&& apt-get clean \
36+
&& rm -rf /var/lib/apt/lists/*
1437

15-
# [Optional] Uncomment this section to install additional OS packages.
16-
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
17-
# && apt-get -y install --no-install-recommends <your-package-list-here>
38+
# Install uv
39+
RUN pip3 install uv
1840

19-
# [Optional] Uncomment this line to install global node packages.
20-
# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g <your-package-here>" 2>&1
41+
WORKDIR /usr/src
42+
43+
USER vscode
44+
ENV VIRTUAL_ENV="/home/vscode/.local/ic-venv"
45+
RUN uv venv $VIRTUAL_ENV
46+
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
47+
48+
WORKDIR /workspaces/ha-elro-connects
49+
50+
# Set the default shell to bash instead of sh
51+
ENV SHELL /bin/bash
52+
RUN source $VIRTUAL_ENV/bin/activate

.devcontainer/devcontainer.json

Lines changed: 57 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,62 @@
1-
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
2-
// https://github.com/microsoft/vscode-dev-containers/tree/v0.177.0/containers/python-3
31
{
42
"name": "ha-elro-connects",
5-
"build": {
6-
"dockerfile": "Dockerfile",
7-
"context": "..",
8-
"args": {
9-
// Update 'VARIANT' to pick a Python version: 3, 3.6, 3.7, 3.8, 3.9
10-
"VARIANT": "3.11",
11-
// Options
12-
"INSTALL_NODE": "false",
13-
"NODE_VERSION": "lts/*"
14-
}
3+
"context": "..",
4+
"postCreateCommand": "script/setup",
5+
"dockerFile": "./Dockerfile",
6+
"containerEnv": {
7+
"PYTHONASYNCIODEBUG": "1"
158
},
16-
17-
// Set *default* container specific settings.json values on container create.
18-
"settings": {
19-
"terminal.integrated.profiles.linux": {
20-
"zsh (login)": {
21-
"path": "zsh",
22-
"args": ["-l"]
23-
}
24-
},
25-
"python.pythonPath": "/usr/local/bin/python",
26-
"python.languageServer": "Pylance",
27-
"python.linting.enabled": true,
28-
"python.linting.pylintEnabled": true,
29-
"python.formatting.provider": "black",
30-
"python.testing.pytestArgs": [],
31-
"editor.formatOnPaste": false,
32-
"editor.formatOnSave": true,
33-
"editor.formatOnType": true,
34-
"files.trimTrailingWhitespace": true,
35-
"python.formatting.autopep8Path": "/usr/local/py-utils/bin/autopep8",
36-
"python.formatting.blackPath": "/usr/local/py-utils/bin/black",
37-
"python.formatting.yapfPath": "/usr/local/py-utils/bin/yapf",
38-
"python.linting.banditPath": "/usr/local/py-utils/bin/bandit",
39-
"python.linting.flake8Path": "/usr/local/py-utils/bin/flake8",
40-
"python.linting.mypyPath": "/usr/local/py-utils/bin/mypy",
41-
"python.linting.pycodestylePath": "/usr/local/py-utils/bin/pycodestyle",
42-
"python.linting.pydocstylePath": "/usr/local/py-utils/bin/pydocstyle",
43-
"python.linting.pylintPath": "/usr/local/py-utils/bin/pylint"
9+
"features": {
10+
"ghcr.io/devcontainers/features/github-cli:1": {}
4411
},
45-
46-
// Add the IDs of extensions you want installed when the container is created.
47-
"extensions": [
48-
"ms-python.python",
49-
"ms-python.vscode-pylance",
50-
"visualstudioexptteam.vscodeintellicode",
51-
"redhat.vscode-yaml",
52-
"esbenp.prettier-vscode",
53-
"GitHub.vscode-pull-request-github"
54-
],
55-
56-
// Use 'forwardPorts' to make a list of ports inside the container available locally.
57-
"forwardPorts": [],
58-
59-
// Use 'postCreateCommand' to run commands after the container is created.
60-
"postCreateCommand": "pip3 install --user -r requirements_dev.txt && pre-commit install",
61-
62-
// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
63-
"remoteUser": "vscode",
64-
65-
// Advertize container environment
66-
"containerEnv": { "DEVCONTAINER": "1" },
67-
68-
// Setup appdaemon environment
69-
"runArgs": [
70-
"--env-file",
71-
"${localWorkspaceFolder}/.devcontainer/devcontainer.env"
72-
]
12+
"appPort": [],
13+
"runArgs": ["-e", "GIT_EDITOR=code --wait"],
14+
"customizations": {
15+
"vscode": {
16+
"extensions": [
17+
"charliermarsh.ruff",
18+
"ms-python.python",
19+
"ms-python.pylint",
20+
"ms-python.vscode-pylance",
21+
"visualstudioexptteam.vscodeintellicode",
22+
"redhat.vscode-yaml",
23+
"esbenp.prettier-vscode",
24+
"GitHub.vscode-pull-request-github"
25+
],
26+
// Please keep this file in sync with settings in .vscode/settings.default.json
27+
"settings": {
28+
"python.experiments.optOutFrom": ["pythonTestAdapter"],
29+
"python.defaultInterpreterPath": "/home/vscode/.local/ic-venv/bin/python",
30+
"python.pythonPath": "/home/vscode/.local/ic-venv/bin/python",
31+
"python.terminal.activateEnvInCurrentTerminal": true,
32+
"python.testing.pytestArgs": ["--no-cov"],
33+
"editor.formatOnPaste": false,
34+
"editor.formatOnSave": true,
35+
"editor.formatOnType": true,
36+
"files.trimTrailingWhitespace": true,
37+
"terminal.integrated.profiles.linux": {
38+
"zsh": {
39+
"path": "/usr/bin/zsh"
40+
}
41+
},
42+
"terminal.integrated.defaultProfile.linux": "zsh",
43+
"yaml.customTags": [
44+
"!input scalar",
45+
"!secret scalar",
46+
"!include_dir_named scalar",
47+
"!include_dir_list scalar",
48+
"!include_dir_merge_list scalar",
49+
"!include_dir_merge_named scalar"
50+
],
51+
"[python]": {
52+
"editor.defaultFormatter": null,
53+
"editor.formatOnSave": true,
54+
"python.formatting.provider": "black",
55+
"python.formatting.blackArgs": ["-l 120"],
56+
"editor.formatOnType": true,
57+
"python.formatting.blackPath": "/usr/local/py-utils/bin/black"
58+
}
59+
}
60+
}
61+
}
7362
}

custom_components/elro_connects/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""The Elro Connects integration."""
2+
23
from __future__ import annotations
34

45
import logging

custom_components/elro_connects/config_flow.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Config flow for Elro Connects integration."""
2+
23
from __future__ import annotations
34

45
import logging

custom_components/elro_connects/device.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Elro Connects K1 device communication."""
2+
23
from __future__ import annotations
34

45
import asyncio
@@ -155,9 +156,11 @@ async def _async_device_updated(self, event: Event) -> None:
155156
await self.async_command(
156157
SET_DEVICE_NAME,
157158
device_ID=device_id,
158-
device_name=device_entry.name_by_user[:15]
159-
if len(device_entry.name_by_user) > 15
160-
else device_entry.name_by_user,
159+
device_name=(
160+
device_entry.name_by_user[:15]
161+
if len(device_entry.name_by_user) > 15
162+
else device_entry.name_by_user
163+
),
161164
)
162165

163166
async def _async_fetch_connector_data(self) -> None:
@@ -261,9 +264,11 @@ def device_info(self) -> DeviceInfo:
261264
device_info = DeviceInfo(
262265
identifiers={(DOMAIN, f"{self._connector_id}_{self._device_id}")},
263266
manufacturer="Elro",
264-
model=DEVICE_MODELS[device_type]
265-
if device_type in DEVICE_MODELS
266-
else device_type,
267+
model=(
268+
DEVICE_MODELS[device_type]
269+
if device_type in DEVICE_MODELS
270+
else device_type
271+
),
267272
name=self.data.get(ATTR_NAME, None),
268273
# Link to K1 connector
269274
via_device=(dr.CONNECTION_NETWORK_MAC, mac_address),

custom_components/elro_connects/helpers.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Helper functions for Elro Connects."""
2+
23
from __future__ import annotations
34

45
from elro.device import ATTR_DEVICE_TYPE

custom_components/elro_connects/sensor.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""The Elro Connects sensor platform."""
2+
23
from __future__ import annotations
34

45
from dataclasses import dataclass

custom_components/elro_connects/siren.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""The Elro Connects siren platform."""
2+
23
from __future__ import annotations
34

45
from dataclasses import dataclass

custom_components/elro_connects/switch.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""The Elro Connects switch platform."""
2+
23
from __future__ import annotations
34

45
from dataclasses import dataclass

hacs.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"name": "Elro Connects",
33
"hacs": "1.0.0",
4-
"homeassistant": "2023.7.2"
4+
"homeassistant": "2024.4.7"
55
}

0 commit comments

Comments
 (0)