From 4f0792a0ccc3d2f63562af560be316615aa25c01 Mon Sep 17 00:00:00 2001 From: ludeeus Date: Sat, 11 Feb 2023 17:52:23 +0000 Subject: [PATCH] Replace devcontainer --- .devcontainer.json | 34 ++++++++++++++++++ .devcontainer/README.md | 60 -------------------------------- .devcontainer/configuration.yaml | 9 ----- .devcontainer/devcontainer.json | 30 ---------------- .github/workflows/push.yml | 3 +- CONTRIBUTING.md | 2 +- README.md | 2 +- configuration.yaml | 8 +++++ info.md | 2 +- 9 files changed, 46 insertions(+), 104 deletions(-) create mode 100644 .devcontainer.json delete mode 100644 .devcontainer/README.md delete mode 100644 .devcontainer/configuration.yaml delete mode 100644 .devcontainer/devcontainer.json create mode 100644 configuration.yaml diff --git a/.devcontainer.json b/.devcontainer.json new file mode 100644 index 0000000..d29116c --- /dev/null +++ b/.devcontainer.json @@ -0,0 +1,34 @@ +{ + "name": "ludeeus/integration_blueprint", + "image": "mcr.microsoft.com/vscode/devcontainers/python:0-3.10-bullseye", + "forwardPorts": [ + 8123 + ], + "customizations": { + "vscode": { + "extensions": [ + "ms-python.python", + "github.vscode-pull-request-github", + "ryanluker.vscode-coverage-gutters", + "ms-python.vscode-pylance" + ], + "settings": { + "files.eol": "\n", + "editor.tabSize": 4, + "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 + } + } + }, + "remoteUser": "vscode", + "features": { + "rust": "latest" + } +} \ No newline at end of file diff --git a/.devcontainer/README.md b/.devcontainer/README.md deleted file mode 100644 index e304a9a..0000000 --- a/.devcontainer/README.md +++ /dev/null @@ -1,60 +0,0 @@ -## 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 debugger -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/). diff --git a/.devcontainer/configuration.yaml b/.devcontainer/configuration.yaml deleted file mode 100644 index 38c0eb6..0000000 --- a/.devcontainer/configuration.yaml +++ /dev/null @@ -1,9 +0,0 @@ -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: diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json deleted file mode 100644 index 826daa2..0000000 --- a/.devcontainer/devcontainer.json +++ /dev/null @@ -1,30 +0,0 @@ -// See https://aka.ms/vscode-remote/devcontainer.json for format details. -{ - "image": "ghcr.io/ludeeus/devcontainer/integration:stable", - "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 - } -} diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index d0ff7bf..05b3d59 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -3,8 +3,7 @@ name: Push actions on: push: branches: - - master - - dev + - main jobs: validate: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a24a872..43ab101 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -13,7 +13,7 @@ Github is used to host code, to track issues and feature requests, as well as ac Pull requests are the best way to propose changes to the codebase. -1. Fork the repo and create your branch from `master`. +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 black). 4. Test you contribution. diff --git a/README.md b/README.md index 18b8a6f..e86cb9d 100644 --- a/README.md +++ b/README.md @@ -137,7 +137,7 @@ If you want to contribute to this please read the [Contribution guidelines](CONT [buymecoffee]: https://www.buymeacoffee.com/ludeeus [buymecoffeebadge]: https://img.shields.io/badge/buy%20me%20a%20coffee-donate-yellow.svg?style=for-the-badge [commits-shield]: https://img.shields.io/github/commit-activity/y/custom-components/blueprint.svg?style=for-the-badge -[commits]: https://github.com/custom-components/integration_blueprint/commits/master +[commits]: https://github.com/custom-components/integration_blueprint/commits/main [hacs]: https://github.com/custom-components/hacs [hacsbadge]: https://img.shields.io/badge/HACS-Custom-orange.svg?style=for-the-badge [discord]: https://discord.gg/Qa5fW2R diff --git a/configuration.yaml b/configuration.yaml new file mode 100644 index 0000000..8c0d4e4 --- /dev/null +++ b/configuration.yaml @@ -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.integration_blueprint: debug diff --git a/info.md b/info.md index 714b9e5..39aa23a 100644 --- a/info.md +++ b/info.md @@ -40,7 +40,7 @@ Platform | Description [buymecoffee]: https://www.buymeacoffee.com/ludeeus [buymecoffeebadge]: https://img.shields.io/badge/buy%20me%20a%20coffee-donate-yellow.svg?style=for-the-badge [commits-shield]: https://img.shields.io/github/commit-activity/y/custom-components/integration_blueprint.svg?style=for-the-badge -[commits]: https://github.com/custom-components/integration_blueprint/commits/master +[commits]: https://github.com/custom-components/integration_blueprint/commits/main [hacs]: https://hacs.xyz [hacsbadge]: https://img.shields.io/badge/HACS-Custom-orange.svg?style=for-the-badge [discord]: https://discord.gg/Qa5fW2R