From 33670920982c43d0b604977ce96ef63092860f0f Mon Sep 17 00:00:00 2001 From: Tom Scholten Date: Fri, 27 Mar 2026 10:42:00 +0000 Subject: [PATCH 1/2] Move to prek and pymarkdown --- .github/workflows/merge.yml | 2 +- .github/workflows/verify.yml | 25 ++++++++++++------------- .markdownlint.yaml | 2 -- .pre-commit-config.yaml | 8 ++++---- .pymarkdown | 1 + requirements_commit.txt | 2 +- scripts/setup.sh | 4 ++-- scripts/setup_test.sh | 4 ++-- scripts/tests_and_coverage.sh | 3 +-- 9 files changed, 24 insertions(+), 27 deletions(-) delete mode 100644 .markdownlint.yaml create mode 100644 .pymarkdown diff --git a/.github/workflows/merge.yml b/.github/workflows/merge.yml index 23a547c14..f82cfebd6 100644 --- a/.github/workflows/merge.yml +++ b/.github/workflows/merge.yml @@ -4,7 +4,7 @@ name: Latest release env: - CACHE_VERSION: 22 + CACHE_VERSION: 1 DEFAULT_PYTHON: "3.14" # Only run on merges diff --git a/.github/workflows/verify.yml b/.github/workflows/verify.yml index 54f2206f4..ddfac5647 100644 --- a/.github/workflows/verify.yml +++ b/.github/workflows/verify.yml @@ -4,9 +4,8 @@ name: Latest commit env: - CACHE_VERSION: 1 + CACHE_VERSION: 2 DEFAULT_PYTHON: "3.14" - PRE_COMMIT_HOME: ~/.cache/pre-commit VENV: venv on: @@ -45,7 +44,7 @@ jobs: needs: cache name: Prepare steps: - - name: Prepare code checkout and python/pre-commit setup + - name: Prepare code checkout and python/prek/pre-commit setup id: cache-reuse uses: plugwise/gh-actions/prepare-python-and-code@v2 with: @@ -53,7 +52,7 @@ jobs: fail-on-miss: false # First time create cache (if not already exists) python-version: ${{ needs.cache.outputs.python-version }} venv-dir: ${{ env.VENV }} - precommit-home: ${{ env.PRE_COMMIT_HOME }} + prek-home: ${{ env.PREK_HOME }} ruff: runs-on: ubuntu-latest @@ -73,7 +72,7 @@ jobs: cache-key: ${{ needs.cache.outputs.cache-key }} python-version: ${{ needs.cache.outputs.python-version }} venv-dir: ${{ env.VENV }} - precommit-home: ${{ env.PRE_COMMIT_HOME }} + prek-home: ${{ env.PREK_HOME }} - name: Ruff (with fix) run: | . venv-${{ needs.cache.outputs.python-version }}/bin/activate @@ -109,11 +108,11 @@ jobs: cache-key: ${{ needs.cache.outputs.cache-key }} python-version: ${{ needs.cache.outputs.python-version }} venv-dir: ${{ env.VENV }} - precommit-home: ${{ env.PRE_COMMIT_HOME }} + prek-home: ${{ env.PREK_HOME }} - name: Verify commit run: | . venv-${{ needs.cache.outputs.python-version }}/bin/activate - pre-commit run --show-diff-on-failure --color=always --all-files --hook-stage manual pylint + prek run --show-diff-on-failure --color=always --all-files --hook-stage manual pylint # - name: Biome lint # run: | # . venv-${{ needs.cache.outputs.python-version }}/bin/activate @@ -122,7 +121,7 @@ jobs: - name: Lint markdown files run: | . venv-${{ needs.cache.outputs.python-version }}/bin/activate - pre-commit run --show-diff-on-failure --color=always --all-files --hook-stage manual markdownlint + pre-commit run --show-diff-on-failure --color=always --all-files --hook-stage manual pymarkdown pytest: runs-on: ubuntu-latest @@ -150,7 +149,7 @@ jobs: cache-key: ${{ needs.cache.outputs.cache-key }} python-version: ${{ steps.python.outputs.python-version }} # Force to installed python minor venv-dir: ${{ env.VENV }} - precommit-home: ${{ env.PRE_COMMIT_HOME }} + prek-home: ${{ env.PREK_HOME }} - name: Run all tests run: | . venv-${{ steps.python.outputs.python-version }}/bin/activate @@ -183,11 +182,11 @@ jobs: cache-key: ${{ needs.cache.outputs.cache-key }} python-version: ${{ needs.cache.outputs.python-version }} venv-dir: ${{ env.VENV }} - precommit-home: ${{ env.PRE_COMMIT_HOME }} + prek-home: ${{ env.PREK_HOME }} - name: Run mypy run: | . venv-${{ needs.cache.outputs.python-version }}/bin/activate - pip list | grep -i mypy + uv pip list | grep -i mypy mypy plugwise_usb/ # Check shellscripts @@ -228,7 +227,7 @@ jobs: cache-key: ${{ needs.cache.outputs.cache-key }} python-version: ${{ needs.cache.outputs.python-version }} venv-dir: ${{ env.VENV }} - precommit-home: ${{ env.PRE_COMMIT_HOME }} + prek-home: ${{ env.PREK_HOME }} - name: Download all coverage artifacts uses: actions/download-artifact@v8 with: @@ -316,7 +315,7 @@ jobs: cache-key: ${{ needs.cache.outputs.cache-key }} python-version: ${{ needs.cache.outputs.python-version }} venv-dir: ${{ env.VENV }} - precommit-home: ${{ env.PRE_COMMIT_HOME }} + prek-home: ${{ env.PREK_HOME }} - name: Run complexity report (click to view details) run: | . venv-${{ needs.cache.outputs.python-version }}/bin/activate diff --git a/.markdownlint.yaml b/.markdownlint.yaml deleted file mode 100644 index 320406db4..000000000 --- a/.markdownlint.yaml +++ /dev/null @@ -1,2 +0,0 @@ -default: true -MD013: false diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a87cc4b4d..18ae02382 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -118,8 +118,8 @@ repos: name: "Biome (prettier)" 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 language: script - - repo: https://github.com/igorshubovych/markdownlint-cli - rev: v0.48.0 + - repo: https://github.com/jackdewinter/pymarkdown + rev: v0.9.36 hooks: - - id: markdownlint - name: "Markdown linting" + - id: pymarkdown + name: MarkDown Lint diff --git a/.pymarkdown b/.pymarkdown new file mode 100644 index 000000000..7cdbe9000 --- /dev/null +++ b/.pymarkdown @@ -0,0 +1 @@ +{ "plugins": { "md013": { "enabled": false } } } diff --git a/requirements_commit.txt b/requirements_commit.txt index 703b892eb..0934a754b 100644 --- a/requirements_commit.txt +++ b/requirements_commit.txt @@ -4,7 +4,7 @@ # Versioning omitted (leave this up to HA-core) coverage mypy -pre-commit +prek pylint pylint_strict_informational==0.1 ruff diff --git a/scripts/setup.sh b/scripts/setup.sh index 8f4c80e6e..e22e1d603 100755 --- a/scripts/setup.sh +++ b/scripts/setup.sh @@ -19,6 +19,6 @@ fi # Install commit requirements 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 -# Install pre-commit hook -pre-commit install +# Install prek hook +prek install --install-hooks diff --git a/scripts/setup_test.sh b/scripts/setup_test.sh index 6535660ca..84dcb0609 100755 --- a/scripts/setup_test.sh +++ b/scripts/setup_test.sh @@ -36,8 +36,8 @@ curl -sL "https://github.com/biomejs/biome/releases/latest/download/biome-${use_ # Make biome executable (if necessary) chmod +x "${my_path}/tmp/biome" -# Install pre-commit hook unless running from within pre-commit +# Install prek hook unless running from within pre-commit if [ "$#" -eq 0 ]; then - pre-commit install + prek install --install-hooks fi diff --git a/scripts/tests_and_coverage.sh b/scripts/tests_and_coverage.sh index 749dec0f5..e3b7ee971 100755 --- a/scripts/tests_and_coverage.sh +++ b/scripts/tests_and_coverage.sh @@ -49,9 +49,8 @@ biome_format() { } # Install/update dependencies -pre-commit install -pre-commit install-hooks uv pip install -r requirements_test.txt -r requirements_commit.txt +prek install --install-hooks set +u From f48b9ce90ebb77fd716ba9abe5034348fd62f246 Mon Sep 17 00:00:00 2001 From: Tom Scholten Date: Fri, 27 Mar 2026 10:45:20 +0000 Subject: [PATCH 2/2] Leftover precommit --- .github/workflows/verify.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/verify.yml b/.github/workflows/verify.yml index ddfac5647..3a4e00288 100644 --- a/.github/workflows/verify.yml +++ b/.github/workflows/verify.yml @@ -121,7 +121,7 @@ jobs: - name: Lint markdown files run: | . venv-${{ needs.cache.outputs.python-version }}/bin/activate - pre-commit run --show-diff-on-failure --color=always --all-files --hook-stage manual pymarkdown + prek run --show-diff-on-failure --color=always --all-files --hook-stage manual pymarkdown pytest: runs-on: ubuntu-latest