-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #380 from dougiteixeira/add-devcontainer
Add devcontainer, ruff et al
- Loading branch information
Showing
29 changed files
with
611 additions
and
806 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
{ | ||
"name": "Proxmox VE Custom Integration", | ||
"image": "mcr.microsoft.com/devcontainers/python:3.12", | ||
"features": { | ||
"ghcr.io/devcontainers/features/github-cli:1": {}, | ||
"ghcr.io/devcontainers/features/node:1": {}, | ||
"ghcr.io/devcontainers-contrib/features/poetry:2": { | ||
"version": "latest" | ||
}, | ||
"ghcr.io/devcontainers/features/rust:1": {} | ||
}, | ||
"postCreateCommand": "scripts/setup", | ||
"runArgs": [ | ||
"--network=host" | ||
], | ||
"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", | ||
"charliermarsh.ruff" | ||
], | ||
"settings": { | ||
"files.eol": "\n", | ||
"editor.tabSize": 4, | ||
"python.pythonPath": "/usr/bin/python3", | ||
"python.analysis.autoSearchPaths": false, | ||
"editor.formatOnPaste": false, | ||
"editor.formatOnSave": true, | ||
"editor.formatOnType": true, | ||
"files.trimTrailingWhitespace": true, | ||
"[markdown]": { | ||
"files.trimTrailingWhitespace": false | ||
}, | ||
"[python]": { | ||
"editor.defaultFormatter": "charliermarsh.ruff", | ||
"editor.codeActionsOnSave": { | ||
"source.organizeImports": "explicit" | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"remoteUser": "vscode" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* text=auto eol=lf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file | ||
version: 2 | ||
updates: | ||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
interval: "weekly" | ||
|
||
- package-ecosystem: "pip" | ||
directory: "/" | ||
schedule: | ||
interval: "weekly" | ||
ignore: | ||
# Dependabot should not update Home Assistant as that should match the homeassistant key in hacs.json | ||
- dependency-name: "homeassistant" |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
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/[email protected]" | ||
|
||
- name: "Set up Python" | ||
uses: actions/[email protected] | ||
with: | ||
python-version: "3.12" | ||
cache: "pip" | ||
|
||
- name: "Install requirements" | ||
run: python3 -m pip install -r requirements.txt | ||
|
||
- name: "Lint" | ||
run: python3 -m ruff check . | ||
|
||
- name: "Format" | ||
run: python3 -m ruff format . --check |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
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/[email protected]" | ||
|
||
- name: Adjust version number | ||
shell: bash | ||
run: | | ||
version="${{ github.event.release.tag_name }}" | ||
version="${version,,}" | ||
version="${version#v}" | ||
yq e -P -o=json \ | ||
-i ".version = \"${version}\"" \ | ||
"${{ github.workspace }}/custom_components/proxmoxve/manifest.json" | ||
- name: "ZIP the integration directory" | ||
shell: "bash" | ||
run: | | ||
cd "${{ github.workspace }}/custom_components/proxmoxve" | ||
zip proxmoxve.zip -r ./ | ||
- name: Sign release package | ||
uses: sigstore/[email protected] | ||
with: | ||
inputs: ${{ github.workspace }}/custom_components/proxmoxve/proxmoxve.zip | ||
|
||
- name: "Upload the ZIP file to the release" | ||
uses: "softprops/[email protected]" | ||
with: | ||
files: ${{ github.workspace }}/custom_components/proxmoxve/proxmoxve.zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/[email protected]" | ||
|
||
- 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/[email protected]" | ||
|
||
# - 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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,18 @@ | ||
__pycache__ | ||
# artifacts | ||
__pycache__ | ||
.pytest* | ||
*.egg-info | ||
*/build/* | ||
*/dist/* | ||
|
||
|
||
# misc | ||
.coverage | ||
.vscode | ||
coverage.xml | ||
.ruff_cache | ||
|
||
|
||
# Home Assistant configuration | ||
config/* | ||
!config/configuration.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# The contents of this file is based on https://github.com/home-assistant/core/blob/dev/pyproject.toml | ||
|
||
target-version = "py312" | ||
|
||
[lint] | ||
select = ["ALL"] | ||
|
||
ignore = [ | ||
"ANN101", # Missing type annotation for `self` in method | ||
"ANN401", # Dynamically typed expressions (typing.Any) are disallowed | ||
"D203", # no-blank-line-before-class (incompatible with formatter) | ||
"D212", # multi-line-summary-first-line (incompatible with formatter) | ||
"COM812", # incompatible with formatter | ||
"ISC001", # incompatible with formatter | ||
|
||
# Temporary exceptions for Ruff implementation | ||
"PERF401", # manual-list-comprehension | ||
"EXE002", | ||
"PLR0912", | ||
"DTZ005", | ||
"PLR2004", | ||
"E722", | ||
"F821", | ||
"E501", | ||
"PLR0915", | ||
"FBT002", | ||
"PLR0913", | ||
"ANN001", | ||
"SIM102", | ||
"S105", | ||
"ARG002", | ||
"BLE001", | ||
"PERF402", | ||
"S101", | ||
"ANN201", | ||
] | ||
|
||
[lint.flake8-pytest-style] | ||
fixture-parentheses = false | ||
|
||
[lint.pyupgrade] | ||
keep-runtime-typing = true | ||
|
||
[lint.mccabe] | ||
max-complexity = 25 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# Contribution guidelines | ||
|
||
Contributing to this project should be as easy and transparent as possible, whether it's: | ||
|
||
- Reporting a bug | ||
- Discussing the current state of the code | ||
- Submitting a fix | ||
- Proposing new features | ||
|
||
## Github is used for everything | ||
|
||
Github is used to host code, to track issues and feature requests, as well as accept pull requests. | ||
|
||
Pull requests are the best way to propose changes to the codebase. | ||
|
||
1. Fork the repo and create your branch from `main`. | ||
2. If you've changed something, update the documentation. | ||
3. Make sure your code lints (using `scripts/lint`). | ||
4. Test you contribution. | ||
5. Issue that pull request! | ||
|
||
## Any contributions you make will be under the MIT Software License | ||
|
||
In short, when you submit code changes, your submissions are understood to be under the same [MIT License](http://choosealicense.com/licenses/mit/) that covers the project. Feel free to contact the maintainers if that's a concern. | ||
|
||
## Report bugs using Github's [issues](../../issues) | ||
|
||
GitHub issues are used to track public bugs. | ||
Report a bug by [opening a new issue](../../issues/new/choose); it's that easy! | ||
|
||
## Write bug reports with detail, background, and sample code | ||
|
||
**Great Bug Reports** tend to have: | ||
|
||
- A quick summary and/or background | ||
- Steps to reproduce | ||
- Be specific! | ||
- Give sample code if you can. | ||
- What you expected would happen | ||
- What actually happens | ||
- Notes (possibly including why you think this might be happening, or stuff you tried that didn't work) | ||
|
||
People *love* thorough bug reports. I'm not even kidding. | ||
|
||
## Use a Consistent Coding Style | ||
|
||
Use [black](https://github.com/ambv/black) to make sure the code follows the style. | ||
|
||
## Test your code modification | ||
|
||
It comes with development environment in a container, easy to launch | ||
if you use Visual Studio Code. With this container you will have a stand alone | ||
Home Assistant instance running and already configured with the included | ||
[`configuration.yaml`](./config/configuration.yaml) | ||
file. | ||
|
||
## License | ||
|
||
By contributing, you agree that your contributions will be licensed under its MIT License. |
Oops, something went wrong.