Table of Contents generated with DocToc
ha-mqtt-discovery
uses poetry to manage module dependencies and make packaging the module easier. Once you install poetry
, run poetry install
to have it create a venv for you to use during development.
We use pre-commit to run our pre-commit/postcheckout etc git
hooks. Please run pre-commit install
at the root of the repository to enable automatic handling of the git
pre-commit scripts. This won't affect any of your other repositories, just this one. The pre-commit scripts run ruff
on the .py
files that you are committing along with some other checks (preventing accidental large file additions, merge conflict checks, whitespace trimming, etc). Their configuration is managed in [.pre-commit-config.yaml](https://github.com/unixorn/ha-mqtt-discovery/blob/main/.pre-commit-config.yaml.
- PRs should include readme updates with code examples for any added/changed/removed functionality.
- The current state of tests in the repo is frankly terrible. issues/20 to backfill tests is already going to be a lot of work, so please add pytest tests for any new functions you add to keep from piling on more.
- Please use
pydantic
to validate input settings and provide default values. - Please use Google-style docstrings - see their style guide for details.
This project uses Megalinter to check the codebase automatically using Github Actions.
It is also possible to run the linter locally to better understand the problems and check the code before a commit.
You can use the mega-linter-runner, if you have Node
and Docker
locally available.
To run all the linters as configured in the .mega-linter.yml
file, use:
npx mega-linter-runner --flavor python
It will print out the results in the console, as well as generate a megalinter-reports
directory with all its reports.