Skip to content

Commit

Permalink
Merge remote-tracking branch 'template/master' into develop
Browse files Browse the repository at this point in the history
# Conflicts:
#	.editorconfig
#	.gitattributes
#	.github/ISSUE_TEMPLATE/bug_report.md
#	.github/ISSUE_TEMPLATE/feature_request.md
#	.github/PULL_REQUEST_TEMPLATE.md
#	.github/settings.yml
#	.github/workflows/release.yml
#	.gitignore
#	.pre-commit-config.yaml
#	CONTRIBUTING.md
#	LICENSE.md
#	README.md
#	bin/gen_releasenotes
#	bin/release
#	bin/run-in-env
#	bin/setup
#	bin/update
#	bin/update_requirements
#	hacs.json
#	info.md
#	requirements-dev.txt
#	requirements.txt
#	setup.cfg
  • Loading branch information
Limych committed Mar 5, 2021
2 parents e83a8ca + f817a68 commit 3275f39
Show file tree
Hide file tree
Showing 53 changed files with 1,425 additions and 301 deletions.
60 changes: 60 additions & 0 deletions .devcontainer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
## Developing with Visual Studio Code + devcontainer

The easiest way to get started with custom integration development is to use Visual Studio Code with devcontainers. This approach will create a preconfigured development environment with all the tools you need.

In the container you will have a dedicated Home Assistant core instance running with your custom component code. You can configure this instance by updating the `./devcontainer/configuration.yaml` file.

**Prerequisites**

- [git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git)
- Docker
- For Linux, macOS, or Windows 10 Pro/Enterprise/Education use the [current release version of Docker](https://docs.docker.com/install/)
- Windows 10 Home requires [WSL 2](https://docs.microsoft.com/windows/wsl/wsl2-install) and the current Edge version of Docker Desktop (see instructions [here](https://docs.docker.com/docker-for-windows/wsl-tech-preview/)). This can also be used for Windows Pro/Enterprise/Education.
- [Visual Studio code](https://code.visualstudio.com/)
- [Remote - Containers (VSC Extension)][extension-link]

[More info about requirements and devcontainer in general](https://code.visualstudio.com/docs/remote/containers#_getting-started)

[extension-link]: https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers

**Getting started:**

1. Fork the repository.
2. Clone the repository to your computer.
3. Open the repository using Visual Studio code.

When you open this repository with Visual Studio code you are asked to "Reopen in Container", this will start the build of the container.

_If you don't see this notification, open the command palette and select `Remote-Containers: Reopen Folder in Container`._

### Tasks

The devcontainer comes with some useful tasks to help you with development, you can start these tasks by opening the command palette and select `Tasks: Run Task` then select the task you want to run.

When a task is currently running (like `Run Home Assistant on port 9123` for the docs), it can be restarted by opening the command palette and selecting `Tasks: Restart Running Task`, then select the task you want to restart.

The available tasks are:

Task | Description
-- | --
Run Home Assistant on port 9123 | Launch Home Assistant with your custom component code and the configuration defined in `.devcontainer/configuration.yaml`.
Run Home Assistant configuration against /config | Check the configuration.
Upgrade Home Assistant to latest dev | Upgrade the Home Assistant core version in the container to the latest version of the `dev` branch.
Install a specific version of Home Assistant | Install a specific version of Home Assistant core in the container.

### Step by Step debugging

With the development container,
you can test your custom component in Home Assistant with step by step debugging.

You need to modify the `configuration.yaml` file in `.devcontainer` folder
by uncommenting the line:

```yaml
# debugpy:
```

Then launch the task `Run Home Assistant on port 9123`, and launch the debbuger
with the existing debugging configuration `Python: Attach Local`.

For more information, look at [the Remote Python Debugger integration documentation](https://www.home-assistant.io/integrations/debugpy/).
9 changes: 9 additions & 0 deletions .devcontainer/configuration.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
default_config:

logger:
default: info
logs:
custom_components.integration_blueprint: debug

# If you need to debug uncomment the line below (doc: https://www.home-assistant.io/integrations/debugpy/)
# debugpy:
30 changes: 30 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// See https://aka.ms/vscode-remote/devcontainer.json for format details.
{
"image": "ludeeus/container:integration-debian",
"name": "Blueprint integration development",
"context": "..",
"appPort": [
"9123:8123"
],
"postCreateCommand": "container install",
"extensions": [
"ms-python.python",
"github.vscode-pull-request-github",
"ryanluker.vscode-coverage-gutters",
"ms-python.vscode-pylance"
],
"settings": {
"files.eol": "\n",
"editor.tabSize": 4,
"terminal.integrated.shell.linux": "/bin/bash",
"python.pythonPath": "/usr/bin/python3",
"python.analysis.autoSearchPaths": false,
"python.linting.pylintEnabled": true,
"python.linting.enabled": true,
"python.formatting.provider": "black",
"editor.formatOnPaste": false,
"editor.formatOnSave": true,
"editor.formatOnType": true,
"files.trimTrailingWhitespace": true
}
}
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@ indent_style = space
insert_final_newline = true
max_line_length = 88
tab_width = 4

[*.{yml,yaml}]
indent_size = 2
3 changes: 2 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
* text=auto eol=lf

.gitattributes export-ignore
.gitignore export-ignore

/docs export-ignore
README.md export-ignore
tracker.json export-ignore
14 changes: 14 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# These are supported funding model platforms

github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: limych
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: #
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: [
"https://sochain.com/a/mjz640g"
]
26 changes: 2 additions & 24 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Issues not containing the minimum requirements will be closed:
**Versions**
<!--
If you are not using the newest version, download and try that before opening an issue.
If you are unsure about the version check the __init__.py or const.py files.
If you are unsure about the version check the manifest.json file of this component.
-->

* Version of the Home Assistant:
Expand All @@ -34,34 +34,12 @@ Add your configs here.
```

**Describe the bug**

A clear and concise description of what the bug is.

**To Reproduce**

If applicable, describe the steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**

A clear and concise description of what you expected to happen.

**Screenshots**

If applicable, add screenshots to help explain your problem.


**Debug log**
<!-- To enable debug logs check this https://www.home-assistant.io/components/logger/ -->
<!-- To enable debug logs check "Troubleshooting" section of README of this component or this https://www.home-assistant.io/components/logger/ -->
```text
Add your logs here.
```

**Additional context**

Add any other context about the problem here.
4 changes: 0 additions & 4 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,13 @@ assignees: ''
---

**Is your feature request related to a problem? Please describe.**

A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**

A clear and concise description of what you want to happen.

**Describe alternatives you've considered**

A clear and concise description of any alternative solutions or features you've considered.

**Additional context**

Add any other context or screenshots about the feature request here.
3 changes: 0 additions & 3 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
<!--
You are amazing! Thanks for contributing to our project!
Please, DO NOT DELETE ANY TEXT from this template! (unless instructed).
Please note, ANY pull requests to MASTER BRANCH will be CLOSED.
Use develop branch instead.
-->
## Breaking change
<!--
Expand Down
15 changes: 15 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Basic set up for three package managers

version: 2
updates:
- package-ecosystem: "github-actions"
# Workflow files stored in the
# default location of `.github/workflows`
directory: "/"
schedule:
interval: "weekly"

- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "daily"
94 changes: 85 additions & 9 deletions .github/settings.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,103 @@
repository:
# Either `true` to make the repository private, or `false` to make it public.
private: false

# Either `true` to enable issues for this repository, `false` to disable them.
has_issues: true

# Either `true` to enable projects for this repository, or `false` to disable them.
# If projects are disabled for the organization, passing `true` will cause an API error.
has_projects: false

# Either `true` to enable the wiki for this repository, `false` to disable it.
has_wiki: false

# Either `true` to enable downloads for this repository, `false` to disable them.
has_downloads: false

# Updates the default branch for this repository.
default_branch: master

# Either `true` to allow merging pull requests with a merge commit, or `false`
# to prevent merging pull requests with merge commits.
allow_merge_commit: true

# Either `true` to allow squash-merging pull requests, or `false` to prevent
# squash-merging.
allow_squash_merge: true
allow_merge_commit: false

# Either `true` to allow rebase-merging pull requests, or `false` to prevent
# rebase-merging.
allow_rebase_merge: false

labels:
- name: "breaking"
color: ffcc00
description: "Breaking change."
- name: "bug"
color: "d73a4a"
color: d73a4a
description: "Something isn't working."
- name: "dependencies"
color: 0366d6
description: "Pull requests that update a dependency file."
- name: "documentation"
color: "0075ca"
color: 0075ca
description: "Improvements or additions to documentation."
- name: "duplicate"
color: "cfd3d7"
color: cfd3d7
description: "This issue or pull request already exists."
- name: "enhancement"
color: "a2eeef"
color: a2eeef
description: "New feature or request."
- name: "invalid"
color: "e4e669"
color: e4e669
description: "This doesn't seem right."
- name: "stale"
color: "930191"
color: 930191
description: "Stale issues and PRs."
- name: "question"
color: "dd9c2c"
color: dd9c2c
description: "Further information is requested."
- name: "tests"
color: bfd4f2
description: "CI, CD and testing related changes."
- name: "wontfix"
color: "ffffff"
color: ffffff
description: "This will not be worked on."

branches:
- name: master
# https://developer.github.com/v3/repos/branches/#update-branch-protection
# Branch Protection settings. Set to null to disable
protection:
# Required. Require at least one approving review on a pull request, before
# merging. Set to null to disable.
required_pull_request_reviews:
# The number of approvals required. (1-6)
required_approving_review_count: 1
# Dismiss approved reviews automatically when a new commit is pushed.
dismiss_stale_reviews: true
# Blocks merge until code owners have reviewed.
require_code_owner_reviews: true
# Specify which users and teams can dismiss pull request reviews. Pass an empty
# dismissal_restrictions object to disable. User and team dismissal_restrictions
# are only available for organization-owned repositories. Omit this parameter
# for personal repositories.
dismissal_restrictions:
users: []
teams: []
# Required. Require status checks to pass before merging. Set to null to disable.
required_status_checks:
# Required. Require branches to be up to date before merging.
strict: true
# Required. The list of status checks to require in order to merge into this branch.
contexts: []
# Required. Enforce all configured restrictions for administrators. Set to true to
# enforce required status checks for repository administrators. Set to null to disable.
enforce_admins: true
# Required. Restrict who can push to this branch. Team and user restrictions are
# only available for organization-owned repositories. Set to null to disable.
restrictions:
apps: []
users: []
teams: []
52 changes: 52 additions & 0 deletions .github/workflows/py-dead-code.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
---
name: "Python Find Dead Code"

on: [pull_request]

jobs:
lint:
name: "Find Dead Code"
runs-on: ubuntu-latest
steps:
- name: "Checkout code"
uses: actions/checkout@master

- run: |
echo "package=$(ls -F | grep \/$ | grep -v "bin\|examples\|tests" | sed -n "s/\///g;1p")" >> $GITHUB_ENV
- name: "Set up Python"
uses: actions/setup-python@v2
with:
python-version: '3.8'

- name: "Cache pip"
uses: actions/cache@v2.1.4
with:
# This path is specific to Ubuntu
path: ~/.cache/pip
# Look to see if there is a cache hit for the corresponding requirements file
key: ${{ runner.os }}-pip-${{ hashFiles('requirements*.txt') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
- name: "Install dependencies"
run: |
python -m pip install --upgrade pip
if [ -f requirements-test.txt ]; then
pip install -r requirements-test.txt
elif [ -f requirements-dev.txt ]; then
pip install -r requirements-dev.txt
elif [ -f requirements.txt ]; then
pip install -r requirements.txt
fi
pip install flake8-eradicate
if [ -d custom_components ]; then
echo '"""Stub."""' >custom_components/__init__.py
fi
- name: "Lint with flake8 & mypy"
run: |
flake8 ${{ env.package }} tests
mypy --warn-unreachable ${{ env.package }} tests

0 comments on commit 3275f39

Please sign in to comment.