Skip to content

Commit

Permalink
Update devcontainer configuration for development
Browse files Browse the repository at this point in the history
New configuration is based on the the integration blueprint from:
https://github.com/ludeeus/integration_blueprint
  • Loading branch information
msvisser committed Nov 19, 2023
1 parent dbc64b1 commit 602ebc8
Show file tree
Hide file tree
Showing 21 changed files with 265 additions and 137 deletions.
42 changes: 42 additions & 0 deletions .devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// See https://aka.ms/vscode-remote/devcontainer.json for format details.
{
"image": "mcr.microsoft.com/devcontainers/python:3.11-bullseye",
"name": "Remeha Home integration development",
"postCreateCommand": "scripts/setup",
"forwardPorts": [
8123
],
"portsAttributes": {
"8123": {
"label": "Home Assistant",
"onAutoForward": "notify"
}
},
"customizations": {
"vscode": {
"extensions": [
"ms-python.python",
"github.vscode-pull-request-github",
"ryanluker.vscode-coverage-gutters",
"ms-python.vscode-pylance",
"ms-python.black-formatter",
"ms-python.pylint"
],
"settings": {
"files.eol": "\n",
"editor.tabSize": 4,
"terminal.integrated.shell.linux": "/bin/bash",
"python.pythonPath": "/usr/bin/python3",
"python.analysis.autoSearchPaths": false,
"editor.formatOnPaste": false,
"editor.formatOnSave": true,
"editor.formatOnType": true,
"files.trimTrailingWhitespace": true
}
}
},
"remoteUser": "vscode",
"features": {
"ghcr.io/devcontainers/features/rust:1": {}
}
}
9 changes: 0 additions & 9 deletions .devcontainer/configuration.yaml

This file was deleted.

31 changes: 0 additions & 31 deletions .devcontainer/devcontainer.json

This file was deleted.

1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto eol=lf
17 changes: 0 additions & 17 deletions .github/workflows/hacs.yaml

This file was deleted.

14 changes: 0 additions & 14 deletions .github/workflows/hassfest.yaml

This file was deleted.

29 changes: 29 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: "Lint"

on:
push:
branches:
- "main"
pull_request:
branches:
- "main"

jobs:
ruff:
name: "Ruff"
runs-on: "ubuntu-latest"
steps:
- name: "Checkout the repository"
uses: "actions/checkout@v4.1.0"

- name: "Set up Python"
uses: actions/setup-python@v4.7.1
with:
python-version: "3.11"
cache: "pip"

- name: "Install requirements"
run: python3 -m pip install -r requirements.txt

- name: "Run"
run: python3 -m ruff check .
35 changes: 35 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: "Release"

on:
release:
types:
- "published"

permissions: {}

jobs:
release:
name: "Release"
runs-on: "ubuntu-latest"
permissions:
contents: write
steps:
- name: "Checkout the repository"
uses: "actions/checkout@v4.1.0"

- name: "Adjust version number"
shell: "bash"
run: |
yq -i -o json '.version="${{ github.event.release.tag_name }}"' \
"${{ github.workspace }}/custom_components/remeha_home/manifest.json"
- name: "ZIP the integration directory"
shell: "bash"
run: |
cd "${{ github.workspace }}/custom_components/remeha_home"
zip remeha_home.zip -r ./
- name: "Upload the ZIP file to the release"
uses: softprops/action-gh-release@v0.1.15
with:
files: ${{ github.workspace }}/custom_components/remeha_home/remeha_home.zip
37 changes: 37 additions & 0 deletions .github/workflows/validate.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: "Validate"

on:
workflow_dispatch:
schedule:
- cron: "0 0 * * *"
push:
branches:
- "main"
pull_request:
branches:
- "main"

jobs:
hassfest: # https://developers.home-assistant.io/blog/2020/04/16/hassfest
name: "Hassfest Validation"
runs-on: "ubuntu-latest"
steps:
- name: "Checkout the repository"
uses: "actions/checkout@v4.1.0"

- name: "Run hassfest validation"
uses: "home-assistant/actions/hassfest@master"

hacs: # https://github.com/hacs/action
name: "HACS Validation"
runs-on: "ubuntu-latest"
steps:
- name: "Checkout the repository"
uses: "actions/checkout@v4.1.0"

- name: "Run HACS validation"
uses: "hacs/action@main"
with:
category: "integration"
# Remove this 'ignore' key when you have added brand images for your integration to https://github.com/home-assistant/brands
ignore: "brands"
21 changes: 17 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# artifacts
__pycache__
.pytest*
*.egg-info
*/build/*
*/dist/*


# misc
.coverage
.vscode
coverage.xml


# Home Assistant configuration
config/*
!config/configuration.yaml
48 changes: 48 additions & 0 deletions .ruff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# The contents of this file is based on https://github.com/home-assistant/core/blob/dev/pyproject.toml

target-version = "py310"

select = [
"B007", # Loop control variable {name} not used within loop body
"B014", # Exception handler with duplicate exception
"C", # complexity
"D", # docstrings
"E", # pycodestyle
"F", # pyflakes/autoflake
"ICN001", # import concentions; {name} should be imported as {asname}
"PGH004", # Use specific rule codes when using noqa
"PLC0414", # Useless import alias. Import alias does not rename original package.
"SIM105", # Use contextlib.suppress({exception}) instead of try-except-pass
"SIM117", # Merge with-statements that use the same scope
"SIM118", # Use {key} in {dict} instead of {key} in {dict}.keys()
"SIM201", # Use {left} != {right} instead of not {left} == {right}
"SIM212", # Use {a} if {a} else {b} instead of {b} if not {a} else {a}
"SIM300", # Yoda conditions. Use 'age == 42' instead of '42 == age'.
"SIM401", # Use get from dict with default instead of an if block
"T20", # flake8-print
"TRY004", # Prefer TypeError exception for invalid type
"RUF006", # Store a reference to the return value of asyncio.create_task
"UP", # pyupgrade
"W", # pycodestyle
]

ignore = [
"D202", # No blank lines allowed after function docstring
"D203", # 1 blank line required before class docstring
"D213", # Multi-line docstring summary should start at the second line
"D404", # First word of the docstring should not be This
"D406", # Section name should end with a newline
"D407", # Section name underlining
"D411", # Missing blank line before section
"E501", # line too long
"E731", # do not assign a lambda expression, use a def
]

[flake8-pytest-style]
fixture-parentheses = false

[pyupgrade]
keep-runtime-typing = true

[mccabe]
max-complexity = 25
34 changes: 0 additions & 34 deletions .vscode/launch.json

This file was deleted.

10 changes: 4 additions & 6 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
{
"python.linting.pylintEnabled": true,
"python.linting.enabled": true,
"python.pythonPath": "/usr/local/bin/python",
"files.associations": {
"*.yaml": "home-assistant"
}
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter"
},
"python.formatting.provider": "none"
}
22 changes: 2 additions & 20 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,9 @@
"version": "2.0.0",
"tasks": [
{
"label": "Run Home Assistant on port 9123",
"label": "Run Home Assistant on port 8123",
"type": "shell",
"command": "container start",
"problemMatcher": []
},
{
"label": "Run Home Assistant configuration against /config",
"type": "shell",
"command": "container check",
"problemMatcher": []
},
{
"label": "Upgrade Home Assistant to latest dev",
"type": "shell",
"command": "container install",
"problemMatcher": []
},
{
"label": "Install a specific version of Home Assistant",
"type": "shell",
"command": "container set-version",
"command": "scripts/develop",
"problemMatcher": []
}
]
Expand Down
8 changes: 8 additions & 0 deletions config/configuration.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# https://www.home-assistant.io/integrations/default_config/
default_config:

# https://www.home-assistant.io/integrations/logger/
logger:
default: info
logs:
custom_components.remeha_home: debug
2 changes: 1 addition & 1 deletion custom_components/remeha_home/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@
"integration_type": "device",
"iot_class": "cloud_polling",
"issue_tracker": "https://github.com/msvisser/remeha_home/issues",
"version": "0.1.13"
"version": "0.0.0"
}
4 changes: 3 additions & 1 deletion hacs.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
"name": "Remeha Home",
"filename": "remeha_home.zip",
"homeassistant": "2022.12.0",
"render_readme": true,
"country": "NL"
"country": "NL",
"zip_release": true
}
Loading

0 comments on commit 602ebc8

Please sign in to comment.