diff --git a/.gitignore b/.gitignore index 0599dbd..ebbb3c5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +venv .vscode *.code-workspace *.pyc diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 70784c2..865da02 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -51,7 +51,7 @@ repos: - --configfile=tests/bandit.yaml files: ^(homeassistant|script|tests)/.+\.py$ - repo: https://github.com/PyCQA/isort - rev: 5.11.4 + rev: 5.12.0 hooks: - id: isort - repo: https://github.com/pre-commit/pre-commit-hooks diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index 1827929..b9a7a68 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -1,13 +1,49 @@ - # Development This custom component repository is unrelated to the [Home Assistant Core](https://github.com/home-assistant/core) repository. Most of the times it is some commits ahead of the core repository. +## Development environment + +### Install core dependencies: + +Make sure your system has an up to date python version (ideally the same as required [here](https://developers.home-assistant.io/docs/development_environment)). + +``` +sudo apt-get update +sudo apt-get install python3-pip python3-dev python3-venv +``` + +### Create a venv + +In the root directory of this repository create a venv initially: + +``` +python3 -m venv venv +``` + +Change to the venv: + +``` +source venv/bin/activate +``` + +### Install development and test dependencies + +``` +python3 -m pip install -r requirements_dev.txt +python3 -m pip install -r requirements_test.txt +``` + +### Run tests + +Just run `pytest` + # Creating a PR To create a PR to this repository please install this commit hook: + ``` python3 -m pip install pre-commit pre-commit install @@ -22,4 +58,3 @@ Make sure to setup the development environment like as described [here](https:// Create a patch from a given commit e.g. with `git format-patch HEAD~1` and apply it on the HA Core repo with this command: `git am -p2 --directory=homeassistant/components path_to_ha_vicare/custom_components/vicare/0001-some.patch` - diff --git a/README.md b/README.md index 79c25c1..b122883 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,10 @@ Open the `Configuration` of your Home-Assistant instance and select `Integration Add a new integration, search and select `vicare`. A dialog appears to enter your [ViCare API](https://developer.viessmann.com/start.html) credentials. Please see the documentation of the [official Home Assistant ViCare integration](https://www.home-assistant.io/integrations/vicare) for further details. +## Development + +See [DEVELOPMENT.md](DEVELOPMENT.md) for how to set up a development environment and contribute. + ## Links/Credits: - [Original feature request in HA community](https://community.home-assistant.io/t/viessmann-component/77873) diff --git a/requirements_dev.txt b/requirements_dev.txt index 03bb8f5..3b7e579 100644 --- a/requirements_dev.txt +++ b/requirements_dev.txt @@ -1,2 +1,2 @@ -PyViCare >= 2.25.0 +PyViCare == 2.25.0 homeassistant >= 2023.4.1