Skip to content

Commit d10723d

Browse files
new devcontainer files
1 parent 91762e0 commit d10723d

File tree

9 files changed

+82
-119
lines changed

9 files changed

+82
-119
lines changed

.devcontainer.json

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"name": "ludeeus/integration_blueprint",
3+
"image": "mcr.microsoft.com/devcontainers/python:3.12",
4+
"postCreateCommand": "scripts/setup",
5+
"forwardPorts": [
6+
8123
7+
],
8+
"portsAttributes": {
9+
"8123": {
10+
"label": "Home Assistant",
11+
"onAutoForward": "notify"
12+
}
13+
},
14+
"customizations": {
15+
"vscode": {
16+
"extensions": [
17+
"charliermarsh.ruff",
18+
"github.vscode-pull-request-github",
19+
"ms-python.python",
20+
"ms-python.vscode-pylance",
21+
"ryanluker.vscode-coverage-gutters"
22+
],
23+
"settings": {
24+
"files.eol": "\n",
25+
"editor.tabSize": 4,
26+
"editor.formatOnPaste": true,
27+
"editor.formatOnSave": true,
28+
"editor.formatOnType": false,
29+
"files.trimTrailingWhitespace": true,
30+
"python.analysis.typeCheckingMode": "basic",
31+
"python.analysis.autoImportCompletions": true,
32+
"python.defaultInterpreterPath": "/usr/local/bin/python",
33+
"[python]": {
34+
"editor.defaultFormatter": "charliermarsh.ruff"
35+
}
36+
}
37+
}
38+
},
39+
"remoteUser": "vscode",
40+
"features": {}
41+
}

.devcontainer/README.md

Lines changed: 0 additions & 60 deletions
This file was deleted.

.devcontainer/configuration.yaml

Lines changed: 0 additions & 9 deletions
This file was deleted.

.devcontainer/devcontainer.json

Lines changed: 0 additions & 30 deletions
This file was deleted.

.vscode/tasks.json

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,9 @@
22
"version": "2.0.0",
33
"tasks": [
44
{
5-
"label": "Run Home Assistant on port 9123",
5+
"label": "Run Home Assistant on port 8123",
66
"type": "shell",
7-
"command": "container start",
8-
"problemMatcher": []
9-
},
10-
{
11-
"label": "Run Home Assistant configuration against /config",
12-
"type": "shell",
13-
"command": "container check",
14-
"problemMatcher": []
15-
},
16-
{
17-
"label": "Upgrade Home Assistant to latest dev",
18-
"type": "shell",
19-
"command": "container install",
20-
"problemMatcher": []
21-
},
22-
{
23-
"label": "Install a specific version of Home Assistant",
24-
"type": "shell",
25-
"command": "container set-version",
7+
"command": "scripts/develop",
268
"problemMatcher": []
279
}
2810
]

requirements.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
colorlog==6.9.0
2+
homeassistant==2024.6.0
3+
pip>=21.3.1
4+
ruff==0.7.2

scripts/develop

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
5+
cd "$(dirname "$0")/.."
6+
7+
# Create config dir if not present
8+
if [[ ! -d "${PWD}/config" ]]; then
9+
mkdir -p "${PWD}/config"
10+
hass --config "${PWD}/config" --script ensure_config
11+
fi
12+
13+
# Set the path to custom_components
14+
## This let's us have the structure we want <root>/custom_components/integration_blueprint
15+
## while at the same time have Home Assistant configuration inside <root>/config
16+
## without resulting to symlinks.
17+
export PYTHONPATH="${PYTHONPATH}:${PWD}/custom_components"
18+
19+
# Start Home Assistant
20+
hass --config "${PWD}/config" --debug

scripts/lint

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
5+
cd "$(dirname "$0")/.."
6+
7+
ruff format .
8+
ruff check . --fix

scripts/setup

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
5+
cd "$(dirname "$0")/.."
6+
7+
python3 -m pip install --requirement requirements.txt

0 commit comments

Comments
 (0)