Skip to content

Commit 890f961

Browse files
committed
switch to poetry
1 parent 48ebf7c commit 890f961

8 files changed

+3047
-119
lines changed

.bumpversion.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ tag = True
77

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

10-
[bumpversion:file:setup.cfg]
10+
[bumpversion:file:pyproject.toml]

.github/workflows/linting.yaml

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Linting
2+
3+
on:
4+
push:
5+
pull_request:
6+
schedule:
7+
- cron: "0 0 * * *"
8+
9+
jobs:
10+
pre-commit:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
- uses: actions/setup-python@v5
15+
with:
16+
python-version: 3.x
17+
- uses: pre-commit/action@v3
18+
19+
hacs:
20+
runs-on: "ubuntu-latest"
21+
name: HACS
22+
steps:
23+
- uses: actions/checkout@v4
24+
- name: HACS validation
25+
uses: "hacs/action@main"
26+
with:
27+
category: "integration"
28+
ignore: brands
29+
30+
hassfest:
31+
runs-on: "ubuntu-latest"
32+
name: Hassfest
33+
steps:
34+
- uses: actions/checkout@v4
35+
- uses: "home-assistant/actions/hassfest@master"

.github/workflows/tests.yaml

+16-69
Original file line numberDiff line numberDiff line change
@@ -1,86 +1,33 @@
1-
name: Linting
1+
name: CI
22

33
on:
44
push:
5-
branches:
6-
- main
7-
- master
8-
- dev
95
pull_request:
10-
schedule:
11-
- cron: "0 0 * * *"
126

137
env:
148
DEFAULT_PYTHON: "3.12"
159

1610
jobs:
17-
pre-commit:
18-
runs-on: "ubuntu-latest"
19-
name: Pre-commit
20-
steps:
21-
- name: Check out the repository
22-
uses: actions/checkout@v4
23-
24-
- name: Set up Python ${{ env.DEFAULT_PYTHON }}
25-
uses: actions/setup-python@v5
26-
with:
27-
python-version: ${{ env.DEFAULT_PYTHON }}
28-
29-
- name: Upgrade pip
30-
run: |
31-
pip install --constraint=.github/workflows/constraints.txt pip
32-
pip --version
33-
34-
- name: Install Python modules
35-
run: |
36-
pip install --constraint=.github/workflows/constraints.txt pre-commit black flake8 reorder-python-imports
37-
38-
- name: Run pre-commit on all files
39-
run: |
40-
pre-commit run --all-files --show-diff-on-failure --color=always
41-
42-
hacs:
43-
runs-on: "ubuntu-latest"
44-
name: HACS
45-
steps:
46-
- name: Check out the repository
47-
uses: actions/checkout@v4
48-
49-
- name: HACS validation
50-
uses: "hacs/action@22.5.0"
51-
with:
52-
category: "integration"
53-
ignore: brands
54-
55-
hassfest:
56-
runs-on: "ubuntu-latest"
57-
name: Hassfest
58-
steps:
59-
- name: Check out the repository
60-
uses: actions/checkout@v4
61-
62-
- name: Hassfest validation
63-
uses: "home-assistant/actions/hassfest@master"
6411

6512
tests:
6613
runs-on: "ubuntu-latest"
6714
name: Run tests
6815
steps:
69-
- name: Check out code from GitHub
70-
uses: actions/checkout@v4
71-
- name: Setup Python ${{ env.DEFAULT_PYTHON }}
16+
- uses: actions/checkout@v4
17+
- name: Set up Python
7218
uses: actions/setup-python@v5
7319
with:
7420
python-version: ${{ env.DEFAULT_PYTHON }}
75-
- name: Install requirements
76-
run: |
77-
pip install --constraint=.github/workflows/constraints.txt pip
78-
pip install -r requirements_test.txt
79-
- name: Tests suite
80-
run: |
81-
pytest \
82-
--timeout=9 \
83-
--durations=10 \
84-
-n auto \
85-
-p no:sugar \
86-
tests
21+
- uses: snok/install-poetry@main
22+
- name: Install Dependencies
23+
run: poetry install
24+
shell: bash
25+
- name: Test with Pytest
26+
run: poetry run pytest --cov-report=xml
27+
shell: bash
28+
# yamllint disable
29+
# - name: Upload coverage to Codecov
30+
# uses: codecov/codecov-action@v3
31+
# with:
32+
# token: ${{ secrets.CODECOV_TOKEN }}
33+
# yamllint enable

poetry.lock

+2,907
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

+88
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
[tool.poetry]
2+
name = "hass-myheat"
3+
version = "0.2.0"
4+
description = "MyHeat integration plugin for HomeAssistant"
5+
authors = ["Vladimir Ermakov <vooon341@gmail.com>"]
6+
readme = "README.md"
7+
license = "MIT"
8+
9+
[tool.poetry.dependencies]
10+
python = "^3.12"
11+
aiohttp = "*"
12+
home-assistant-bluetooth = "^1"
13+
homeassistant = ">=2023"
14+
voluptuous = ">=0.12.1"
15+
16+
[tool.poetry.group.dev.dependencies]
17+
flake8 = "*"
18+
reorder-python-imports = "*"
19+
pytest-homeassistant-custom-component = "*"
20+
bandit = "*"
21+
black = {version = "*", allow-prereleases = true}
22+
mypy = "*"
23+
pre-commit = "*"
24+
pydocstyle = ">=6.0.0"
25+
prospector = {extras = ["with_vulture"], version = "*"}
26+
27+
[build-system]
28+
requires = ["poetry-core"]
29+
build-backend = "poetry.core.masonry.api"
30+
31+
[tool.isort]
32+
multi_line_output = 3
33+
include_trailing_comma = true
34+
force_grid_wrap = 0
35+
use_parentheses = true
36+
line_length = 88
37+
indent = "\" \""
38+
not_skip = "__init__.py"
39+
force_sort_within_sections = true
40+
sections = "FUTURE,STDLIB,INBETWEENS,THIRDPARTY,FIRSTPARTY,LOCALFOLDER"
41+
default_section = "THIRDPARTY"
42+
known_first_party = "custom_components.myheat, tests"
43+
combine_as_imports = true
44+
45+
[tool.pytest.ini_options]
46+
addopts = ["-qq", "--cov=custom_components.myheat"]
47+
console_output_style = "count"
48+
49+
[tool.coverage.run]
50+
branch = false
51+
52+
[tool.coverage.report]
53+
show_missing = true
54+
fail_under = 100
55+
56+
[tool.mypy]
57+
python_version = '3.12'
58+
ignore_errors = false
59+
follow_imports = "silent"
60+
ignore_missing_imports = true
61+
warn_incomplete_stub = true
62+
warn_redundant_casts = true
63+
warn_unused_configs = true
64+
exclude='custom_components\/(?!myheat).*'
65+
66+
[tool.black]
67+
line-length = 88
68+
target-version = ['py38']
69+
exclude = '''
70+
71+
(
72+
/(
73+
\.eggs # exclude a few common directories in the
74+
| \.git # root of the project
75+
| \.hg
76+
| \.mypy_cache
77+
| \.tox
78+
| \.venv
79+
| _build
80+
| buck-out
81+
| build
82+
| dist
83+
)/
84+
| deps
85+
# the root of the project
86+
)
87+
| custom_components\/(?!myheat).*
88+
'''

requirements_dev.txt

-1
This file was deleted.

requirements_test.txt

-2
This file was deleted.

setup.cfg

-46
This file was deleted.

0 commit comments

Comments
 (0)