Skip to content

Commit 417f92c

Browse files
authored
Merge pull request #174 from plugwise/ci-tooling
Bump versions + Downstream HA-core suggestions
2 parents 19526b3 + 495fb96 commit 417f92c

File tree

12 files changed

+301
-203
lines changed

12 files changed

+301
-203
lines changed

.github/workflows/verify.yml

Lines changed: 39 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -240,13 +240,48 @@ jobs:
240240
name: coverage-${{ matrix.python-version }}
241241
path: .coverage
242242

243+
mypy:
244+
runs-on: ubuntu-latest
245+
name: Run mypy
246+
needs: pytest
247+
steps:
248+
- name: Check out committed code
249+
uses: actions/checkout@v3
250+
with:
251+
persist-credentials: false
252+
- name: Set up Python ${{ env.DEFAULT_PYTHON }}
253+
id: python
254+
uses: actions/setup-python@v3
255+
with:
256+
python-version: ${{ env.DEFAULT_PYTHON }}
257+
- name: Restore base Python ${{ env.DEFAULT_PYTHON }} virtual environment
258+
id: cache-venv
259+
uses: actions/cache@v3
260+
with:
261+
path: venv
262+
key: >-
263+
${{ env.CACHE_VERSION}}-${{ runner.os }}-base-venv-${{
264+
steps.python.outputs.python-version }}-${{
265+
hashFiles('requirements_test.txt') }}-${{
266+
hashFiles('setup.py') }}
267+
- name: Fail job if Python cache restore failed
268+
if: steps.cache-venv.outputs.cache-hit != 'true'
269+
run: |
270+
echo "Failed to restore Python ${{ env.DEFAULT_PYTHON }} virtual environment from cache"
271+
exit 1
272+
- name: Run mypy
273+
run: |
274+
. venv/bin/activate
275+
pip list | grep -i mypy
276+
mypy plugwise/
277+
243278
shellcheck:
244279
name: Shellcheck
245280
runs-on: ubuntu-latest
246281
steps:
247-
- uses: actions/checkout@v3
248-
- name: Run ShellCheck
249-
uses: ludeeus/action-shellcheck@master
282+
- uses: actions/checkout@v3
283+
- name: Run ShellCheck
284+
uses: ludeeus/action-shellcheck@master
250285

251286
coverage:
252287
name: Process test coverage
@@ -289,7 +324,7 @@ jobs:
289324
test-publishing:
290325
name: Build and publish Python 🐍 distributions 📦 to TestPyPI
291326
runs-on: ubuntu-latest
292-
needs: coverage
327+
needs: [coverage, mypy]
293328
steps:
294329
- name: Check out code from GitHub
295330
uses: actions/checkout@v3

.pre-commit-config.yaml

Lines changed: 31 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,6 @@ default_language_version:
33
python: python3.9
44
repos:
55
# Run manually in CI skipping the branch checks
6-
- repo: https://github.com/PyCQA/pylint
7-
rev: v2.12.2
8-
hooks:
9-
- id: pylint
10-
name: pylint
11-
entry: scripts/run-in-env.sh pylint
12-
language: system
13-
types: [python]
14-
args: [
15-
"-rn", # Only display messages
16-
"-sn", # Don't display the score
17-
]
186
- repo: https://github.com/PyCQA/isort
197
rev: 5.10.1
208
hooks:
@@ -28,10 +16,10 @@ repos:
2816
args:
2917
- --branch=main
3018
- repo: https://github.com/asottile/pyupgrade
31-
rev: v2.31.0
19+
rev: v2.31.1
3220
hooks:
3321
- id: pyupgrade
34-
args: [--py37-plus]
22+
args: [--py39-plus]
3523
- repo: https://github.com/psf/black
3624
rev: 22.3.0
3725
hooks:
@@ -45,17 +33,22 @@ repos:
4533
hooks:
4634
- id: codespell
4735
args:
48-
- --ignore-words-list=hass,alot,datas,dof,dur,farenheit,hist,iff,ines,ist,lightsensor,mut,nd,pres,referer,ser,serie,te,technik,ue,uint,visability,wan,wanna,withing,iam,incomfort
36+
- --ignore-words-list=hass,alot,datas,dof,dur,ether,farenheit,hist,iff,iif,ines,ist,lightsensor,mut,nd,pres,referer,rime,ser,serie,te,technik,ue,uint,visability,wan,wanna,withing,iam,incomfort,ba,haa,pullrequests
4937
- --skip="./.*,*.csv,*.json"
5038
- --quiet-level=2
5139
exclude_types: [csv, json]
5240
- repo: https://gitlab.com/pycqa/flake8
53-
rev: 3.9.2
41+
rev: 4.0.1
5442
hooks:
5543
- id: flake8
5644
additional_dependencies:
57-
- flake8-docstrings==1.5.0
58-
- pydocstyle==5.1.1
45+
- pycodestyle==2.8.0
46+
- pyflakes==2.4.0
47+
- flake8-docstrings==1.6.0
48+
- pydocstyle==6.1.1
49+
- flake8-comprehensions==3.8.0
50+
- flake8-noqa==1.2.1
51+
- mccabe==0.6.1
5952
files: ^(plugwise|tests)/.+\.py$
6053
- repo: https://github.com/PyCQA/bandit
6154
rev: 1.7.4
@@ -70,11 +63,23 @@ repos:
7063
rev: v1.26.3
7164
hooks:
7265
- id: yamllint
73-
- repo: https://github.com/prettier/prettier
74-
rev: 2.5.1
66+
- repo: https://github.com/pre-commit/mirrors-prettier
67+
rev: v2.6.1
7568
hooks:
7669
- id: prettier
70+
- repo: https://github.com/cdce8p/python-typing-update
71+
rev: v0.3.5
72+
hooks:
73+
# Run `python-typing-update` hook manually from time to time
74+
# to update python typing syntax.
75+
# Will require manual work, before submitting changes!
76+
- id: python-typing-update
7777
stages: [manual]
78+
args:
79+
- --py39-plus
80+
- --force
81+
- --keep-updates
82+
files: ^(plugwise|tests)/.+\.py$
7883
- repo: local
7984
hooks:
8085
# Run mypy through our wrapper script in order to get the possible
@@ -93,4 +98,10 @@ repos:
9398
language: script
9499
types: [python]
95100
require_serial: true
101+
files: ^plugwise/$
102+
- id: pylint
103+
name: pylint
104+
entry: scripts/run-in-env.sh pylint -j 0
105+
language: script
106+
types: [python]
96107
files: ^plugwise/.+\.py$

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.md

.yamllint

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
ignore: |
2-
azure-*.yml
3-
.travis*.yml
42
.github*
53
rules:
64
braces:
@@ -61,4 +59,3 @@ rules:
6159
level: error
6260
truthy:
6361
level: error
64-

plugwise/constants.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@
9595
SENSE_INTERVAL_FAILED,
9696
SLEEP_FAILED,
9797
)
98-
STATUS_RESPONSES: Final[dict[str, str]] = {
98+
STATUS_RESPONSES: Final[dict[bytes, str]] = {
9999
# NodeAckSmallResponse
100100
RESPONSE_TYPE_SUCCESS: "success",
101101
RESPONSE_TYPE_ERROR: "error",
@@ -375,6 +375,7 @@
375375
DEFAULT_TIMEOUT: Final = 30
376376
DEFAULT_USERNAME: Final = "smile"
377377
DEFAULT_PORT: Final = 80
378+
NONE: Final = "None"
378379
FAKE_LOC: Final = "0000aaaa0000aaaa0000aaaa0000aa00"
379380
SEVERITIES: Final[list[str]] = ["other", "info", "warning", "error"]
380381
SWITCH_GROUP_TYPES: Final[list[str]] = ["switching", "report"]

0 commit comments

Comments
 (0)