diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..0583845 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,17 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates + +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: daily + open-pull-requests-limit: 10 + - package-ecosystem: "pip" + directory: "/" # Location of package manifests + schedule: + interval: "weekly" + open-pull-requests-limit: 10 diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml new file mode 100644 index 0000000..a7352b9 --- /dev/null +++ b/.github/release-drafter.yml @@ -0,0 +1,9 @@ +change-template: "- #$NUMBER - $TITLE (@$AUTHOR)" +categories: + - title: "⚠ Breaking Changes" + labels: + - "breaking change" +template: | + ## What’s Changed + + $CHANGES diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml new file mode 100644 index 0000000..a3f43e1 --- /dev/null +++ b/.github/workflows/release-drafter.yml @@ -0,0 +1,15 @@ +name: Release Drafter + +on: + push: + branches: + - main + +jobs: + update_release_draft: + runs-on: ubuntu-latest + steps: + # Drafts your next Release notes as Pull Requests are merged into "main" + - uses: release-drafter/release-drafter@v5 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..0c8c25a --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,34 @@ +# This workflow will install Python dependencies, run tests and lint +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions + +name: Test + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: + - "3.9" + - "3.10" + + steps: + - uses: actions/checkout@v2.3.4 + with: + fetch-depth: 2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2.3.1 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements_lint.txt + - name: Lint + run: pre-commit run diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d940c52 --- /dev/null +++ b/.gitignore @@ -0,0 +1,101 @@ +# Hide sublime text stuff +*.sublime-project +*.sublime-workspace + +# Hide some OS X stuff +.DS_Store +.AppleDouble +.LSOverride +Icon + +# Thumbnails +._* + +# IntelliJ IDEA +.idea +*.iml + +# pytest +.pytest_cache +.cache + +# GITHUB Proposed Python stuff: +*.py[cod] + +# C extensions +*.so + +# Packages +*.egg +*.egg-info +dist +build +eggs +.eggs +parts +bin +var +sdist +develop-eggs +.installed.cfg +lib +lib64 +pip-wheel-metadata + +# Logs +*.log +pip-log.txt + +# Unit test / coverage reports +.coverage +.tox +coverage.xml +nosetests.xml +htmlcov/ +test-reports/ +test-results.xml +test-output.xml + +# Translations +*.mo + +# Mr Developer +.mr.developer.cfg +.project +.pydevproject + +.python-version + +# emacs auto backups +*~ +*# +*.orig + +# venv stuff +pyvenv.cfg +pip-selfcheck.json +venv +.venv +Pipfile* +share/* +Scripts/ + +# vimmy stuff +*.swp +*.swo +tags +ctags.tmp + +# vagrant stuff +virtualization/vagrant/setup_done +virtualization/vagrant/.vagrant +virtualization/vagrant/config + +# Visual Studio Code +.vscode/* +!.vscode/cSpell.json +!.vscode/extensions.json +!.vscode/tasks.json + +# Typing +.mypy_cache diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..2b35888 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,48 @@ +repos: +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.1.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: check-docstring-first + - id: check-yaml + - id: debug-statements +- repo: https://gitlab.com/pycqa/flake8 + rev: 4.0.1 + hooks: + - id: flake8 + args: + - --max-line-length=500 + - --ignore=E203,E266,E501,W503 + - --max-complexity=18 + - --select=B,C,E,F,W,T4,B9 +- repo: https://github.com/ambv/black + rev: 21.12b0 + hooks: + - id: black + language_version: python3 +- repo: https://github.com/asottile/pyupgrade + rev: v2.31.0 + hooks: + - id: pyupgrade + args: ['--py39-plus'] +- repo: https://github.com/pre-commit/mirrors-isort + rev: v5.10.1 + hooks: + - id: isort + args: + - --multi-line=3 + - --trailing-comma + - --force-grid-wrap=0 + - --use-parentheses + - --line-width=88 + - -p=homeassistant + - --force-sort-within-sections +- repo: https://github.com/PyCQA/pydocstyle + rev: 6.1.1 + hooks: + - id: pydocstyle +- repo: https://github.com/pre-commit/mirrors-mypy + rev: 'v0.930' + hooks: + - id: mypy diff --git a/pylintrc b/pylintrc new file mode 100644 index 0000000..f6dfdfa --- /dev/null +++ b/pylintrc @@ -0,0 +1,27 @@ +[MASTER] +ignore=tests +# Use a conservative default here; 2 should speed up most setups and not hurt +# any too bad. Override on command line as appropriate. +jobs=2 +persistent=no + +[BASIC] +good-names=id,i,j,k,ex,Run,_,fp +max-attributes=15 + +[MESSAGES CONTROL] +# Reasons disabled: +# too-many-* - are not enforced for the sake of readability +# too-few-* - same as too-many-* +disable= + too-few-public-methods, + too-many-arguments, + too-many-public-methods, + too-many-instance-attributes, + too-many-branches + +[REPORTS] +score=no + +[FORMAT] +expected-line-ending-format=LF diff --git a/requirements_lint.txt b/requirements_lint.txt new file mode 100644 index 0000000..7035016 --- /dev/null +++ b/requirements_lint.txt @@ -0,0 +1,7 @@ +black==21.12b0 +flake8==4.0.1 +isort==5.10.1 +mypy==0.930 +pre-commit==2.16.0 +pydocstyle==6.1.1 +pylint==2.12.2