Skip to content

Commit

Permalink
switch to poetry
Browse files Browse the repository at this point in the history
  • Loading branch information
vooon committed Feb 10, 2024
1 parent 48ebf7c commit 890f961
Show file tree
Hide file tree
Showing 8 changed files with 3,047 additions and 119 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ tag = True

[bumpversion:file:custom_components/myheat/const.py]

[bumpversion:file:setup.cfg]
[bumpversion:file:pyproject.toml]
35 changes: 35 additions & 0 deletions .github/workflows/linting.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Linting

on:
push:
pull_request:
schedule:
- cron: "0 0 * * *"

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.x
- uses: pre-commit/action@v3

hacs:
runs-on: "ubuntu-latest"
name: HACS
steps:
- uses: actions/checkout@v4
- name: HACS validation
uses: "hacs/action@main"
with:
category: "integration"
ignore: brands

hassfest:
runs-on: "ubuntu-latest"
name: Hassfest
steps:
- uses: actions/checkout@v4
- uses: "home-assistant/actions/hassfest@master"
85 changes: 16 additions & 69 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -1,86 +1,33 @@
name: Linting
name: CI

on:
push:
branches:
- main
- master
- dev
pull_request:
schedule:
- cron: "0 0 * * *"

env:
DEFAULT_PYTHON: "3.12"

jobs:
pre-commit:
runs-on: "ubuntu-latest"
name: Pre-commit
steps:
- name: Check out the repository
uses: actions/checkout@v4

- name: Set up Python ${{ env.DEFAULT_PYTHON }}
uses: actions/setup-python@v5
with:
python-version: ${{ env.DEFAULT_PYTHON }}

- name: Upgrade pip
run: |
pip install --constraint=.github/workflows/constraints.txt pip
pip --version
- name: Install Python modules
run: |
pip install --constraint=.github/workflows/constraints.txt pre-commit black flake8 reorder-python-imports
- name: Run pre-commit on all files
run: |
pre-commit run --all-files --show-diff-on-failure --color=always
hacs:
runs-on: "ubuntu-latest"
name: HACS
steps:
- name: Check out the repository
uses: actions/checkout@v4

- name: HACS validation
uses: "hacs/[email protected]"
with:
category: "integration"
ignore: brands

hassfest:
runs-on: "ubuntu-latest"
name: Hassfest
steps:
- name: Check out the repository
uses: actions/checkout@v4

- name: Hassfest validation
uses: "home-assistant/actions/hassfest@master"

tests:
runs-on: "ubuntu-latest"
name: Run tests
steps:
- name: Check out code from GitHub
uses: actions/checkout@v4
- name: Setup Python ${{ env.DEFAULT_PYTHON }}
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.DEFAULT_PYTHON }}
- name: Install requirements
run: |
pip install --constraint=.github/workflows/constraints.txt pip
pip install -r requirements_test.txt
- name: Tests suite
run: |
pytest \
--timeout=9 \
--durations=10 \
-n auto \
-p no:sugar \
tests
- uses: snok/install-poetry@main
- name: Install Dependencies
run: poetry install
shell: bash
- name: Test with Pytest
run: poetry run pytest --cov-report=xml
shell: bash
# yamllint disable
# - name: Upload coverage to Codecov
# uses: codecov/codecov-action@v3
# with:
# token: ${{ secrets.CODECOV_TOKEN }}
# yamllint enable
2,907 changes: 2,907 additions & 0 deletions poetry.lock

Large diffs are not rendered by default.

88 changes: 88 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
[tool.poetry]
name = "hass-myheat"
version = "0.2.0"
description = "MyHeat integration plugin for HomeAssistant"
authors = ["Vladimir Ermakov <[email protected]>"]
readme = "README.md"
license = "MIT"

[tool.poetry.dependencies]
python = "^3.12"
aiohttp = "*"
home-assistant-bluetooth = "^1"
homeassistant = ">=2023"
voluptuous = ">=0.12.1"

[tool.poetry.group.dev.dependencies]
flake8 = "*"
reorder-python-imports = "*"
pytest-homeassistant-custom-component = "*"
bandit = "*"
black = {version = "*", allow-prereleases = true}
mypy = "*"
pre-commit = "*"
pydocstyle = ">=6.0.0"
prospector = {extras = ["with_vulture"], version = "*"}

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

[tool.isort]
multi_line_output = 3
include_trailing_comma = true
force_grid_wrap = 0
use_parentheses = true
line_length = 88
indent = "\" \""
not_skip = "__init__.py"
force_sort_within_sections = true
sections = "FUTURE,STDLIB,INBETWEENS,THIRDPARTY,FIRSTPARTY,LOCALFOLDER"
default_section = "THIRDPARTY"
known_first_party = "custom_components.myheat, tests"
combine_as_imports = true

[tool.pytest.ini_options]
addopts = ["-qq", "--cov=custom_components.myheat"]
console_output_style = "count"

[tool.coverage.run]
branch = false

[tool.coverage.report]
show_missing = true
fail_under = 100

[tool.mypy]
python_version = '3.12'
ignore_errors = false
follow_imports = "silent"
ignore_missing_imports = true
warn_incomplete_stub = true
warn_redundant_casts = true
warn_unused_configs = true
exclude='custom_components\/(?!myheat).*'

[tool.black]
line-length = 88
target-version = ['py38']
exclude = '''
(
/(
\.eggs # exclude a few common directories in the
| \.git # root of the project
| \.hg
| \.mypy_cache
| \.tox
| \.venv
| _build
| buck-out
| build
| dist
)/
| deps
# the root of the project
)
| custom_components\/(?!myheat).*
'''
1 change: 0 additions & 1 deletion requirements_dev.txt

This file was deleted.

2 changes: 0 additions & 2 deletions requirements_test.txt

This file was deleted.

46 changes: 0 additions & 46 deletions setup.cfg

This file was deleted.

0 comments on commit 890f961

Please sign in to comment.