Skip to content

Commit 3367092

Browse files
committed
Move to prek and pymarkdown
1 parent ca597df commit 3367092

9 files changed

Lines changed: 24 additions & 27 deletions

File tree

.github/workflows/merge.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
name: Latest release
55

66
env:
7-
CACHE_VERSION: 22
7+
CACHE_VERSION: 1
88
DEFAULT_PYTHON: "3.14"
99

1010
# Only run on merges

.github/workflows/verify.yml

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@
44
name: Latest commit
55

66
env:
7-
CACHE_VERSION: 1
7+
CACHE_VERSION: 2
88
DEFAULT_PYTHON: "3.14"
9-
PRE_COMMIT_HOME: ~/.cache/pre-commit
109
VENV: venv
1110

1211
on:
@@ -45,15 +44,15 @@ jobs:
4544
needs: cache
4645
name: Prepare
4746
steps:
48-
- name: Prepare code checkout and python/pre-commit setup
47+
- name: Prepare code checkout and python/prek/pre-commit setup
4948
id: cache-reuse
5049
uses: plugwise/gh-actions/prepare-python-and-code@v2
5150
with:
5251
cache-key: ${{ needs.cache.outputs.cache-key }}
5352
fail-on-miss: false # First time create cache (if not already exists)
5453
python-version: ${{ needs.cache.outputs.python-version }}
5554
venv-dir: ${{ env.VENV }}
56-
precommit-home: ${{ env.PRE_COMMIT_HOME }}
55+
prek-home: ${{ env.PREK_HOME }}
5756

5857
ruff:
5958
runs-on: ubuntu-latest
@@ -73,7 +72,7 @@ jobs:
7372
cache-key: ${{ needs.cache.outputs.cache-key }}
7473
python-version: ${{ needs.cache.outputs.python-version }}
7574
venv-dir: ${{ env.VENV }}
76-
precommit-home: ${{ env.PRE_COMMIT_HOME }}
75+
prek-home: ${{ env.PREK_HOME }}
7776
- name: Ruff (with fix)
7877
run: |
7978
. venv-${{ needs.cache.outputs.python-version }}/bin/activate
@@ -109,11 +108,11 @@ jobs:
109108
cache-key: ${{ needs.cache.outputs.cache-key }}
110109
python-version: ${{ needs.cache.outputs.python-version }}
111110
venv-dir: ${{ env.VENV }}
112-
precommit-home: ${{ env.PRE_COMMIT_HOME }}
111+
prek-home: ${{ env.PREK_HOME }}
113112
- name: Verify commit
114113
run: |
115114
. venv-${{ needs.cache.outputs.python-version }}/bin/activate
116-
pre-commit run --show-diff-on-failure --color=always --all-files --hook-stage manual pylint
115+
prek run --show-diff-on-failure --color=always --all-files --hook-stage manual pylint
117116
# - name: Biome lint
118117
# run: |
119118
# . venv-${{ needs.cache.outputs.python-version }}/bin/activate
@@ -122,7 +121,7 @@ jobs:
122121
- name: Lint markdown files
123122
run: |
124123
. venv-${{ needs.cache.outputs.python-version }}/bin/activate
125-
pre-commit run --show-diff-on-failure --color=always --all-files --hook-stage manual markdownlint
124+
pre-commit run --show-diff-on-failure --color=always --all-files --hook-stage manual pymarkdown
126125
127126
pytest:
128127
runs-on: ubuntu-latest
@@ -150,7 +149,7 @@ jobs:
150149
cache-key: ${{ needs.cache.outputs.cache-key }}
151150
python-version: ${{ steps.python.outputs.python-version }} # Force to installed python minor
152151
venv-dir: ${{ env.VENV }}
153-
precommit-home: ${{ env.PRE_COMMIT_HOME }}
152+
prek-home: ${{ env.PREK_HOME }}
154153
- name: Run all tests
155154
run: |
156155
. venv-${{ steps.python.outputs.python-version }}/bin/activate
@@ -183,11 +182,11 @@ jobs:
183182
cache-key: ${{ needs.cache.outputs.cache-key }}
184183
python-version: ${{ needs.cache.outputs.python-version }}
185184
venv-dir: ${{ env.VENV }}
186-
precommit-home: ${{ env.PRE_COMMIT_HOME }}
185+
prek-home: ${{ env.PREK_HOME }}
187186
- name: Run mypy
188187
run: |
189188
. venv-${{ needs.cache.outputs.python-version }}/bin/activate
190-
pip list | grep -i mypy
189+
uv pip list | grep -i mypy
191190
mypy plugwise_usb/
192191
193192
# Check shellscripts
@@ -228,7 +227,7 @@ jobs:
228227
cache-key: ${{ needs.cache.outputs.cache-key }}
229228
python-version: ${{ needs.cache.outputs.python-version }}
230229
venv-dir: ${{ env.VENV }}
231-
precommit-home: ${{ env.PRE_COMMIT_HOME }}
230+
prek-home: ${{ env.PREK_HOME }}
232231
- name: Download all coverage artifacts
233232
uses: actions/download-artifact@v8
234233
with:
@@ -316,7 +315,7 @@ jobs:
316315
cache-key: ${{ needs.cache.outputs.cache-key }}
317316
python-version: ${{ needs.cache.outputs.python-version }}
318317
venv-dir: ${{ env.VENV }}
319-
precommit-home: ${{ env.PRE_COMMIT_HOME }}
318+
prek-home: ${{ env.PREK_HOME }}
320319
- name: Run complexity report (click to view details)
321320
run: |
322321
. venv-${{ needs.cache.outputs.python-version }}/bin/activate

.markdownlint.yaml

Lines changed: 0 additions & 2 deletions
This file was deleted.

.pre-commit-config.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,8 @@ repos:
118118
name: "Biome (prettier)"
119119
entry: ./tmp/biome check plugwise_usb/ tests/ --files-ignore-unknown=true --no-errors-on-unmatched --json-formatter-indent-width=2 --json-formatter-indent-style=space
120120
language: script
121-
- repo: https://github.com/igorshubovych/markdownlint-cli
122-
rev: v0.48.0
121+
- repo: https://github.com/jackdewinter/pymarkdown
122+
rev: v0.9.36
123123
hooks:
124-
- id: markdownlint
125-
name: "Markdown linting"
124+
- id: pymarkdown
125+
name: MarkDown Lint

.pymarkdown

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{ "plugins": { "md013": { "enabled": false } } }

requirements_commit.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# Versioning omitted (leave this up to HA-core)
55
coverage
66
mypy
7-
pre-commit
7+
prek
88
pylint
99
pylint_strict_informational==0.1
1010
ruff

scripts/setup.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ fi
1919
# Install commit requirements
2020
uv pip install --upgrade -e . -r requirements_commit.txt -c https://raw.githubusercontent.com/home-assistant/core/dev/homeassistant/package_constraints.txt -r https://raw.githubusercontent.com/home-assistant/core/dev/requirements_test_pre_commit.txt
2121

22-
# Install pre-commit hook
23-
pre-commit install
22+
# Install prek hook
23+
prek install --install-hooks
2424

scripts/setup_test.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ curl -sL "https://github.com/biomejs/biome/releases/latest/download/biome-${use_
3636
# Make biome executable (if necessary)
3737
chmod +x "${my_path}/tmp/biome"
3838

39-
# Install pre-commit hook unless running from within pre-commit
39+
# Install prek hook unless running from within pre-commit
4040
if [ "$#" -eq 0 ]; then
41-
pre-commit install
41+
prek install --install-hooks
4242
fi
4343

scripts/tests_and_coverage.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,8 @@ biome_format() {
4949
}
5050

5151
# Install/update dependencies
52-
pre-commit install
53-
pre-commit install-hooks
5452
uv pip install -r requirements_test.txt -r requirements_commit.txt
53+
prek install --install-hooks
5554

5655
set +u
5756

0 commit comments

Comments
 (0)