From 2e2543e022ae077efe84b3565fb5ba55002eb1e9 Mon Sep 17 00:00:00 2001 From: Tom Scholten Date: Tue, 28 Dec 2021 13:44:26 +0100 Subject: [PATCH 1/9] Bump caches, add setuptools to be sure --- .github/workflows/merge.yml | 2 +- .github/workflows/verify.yml | 2 +- requirements_commit.txt | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/merge.yml b/.github/workflows/merge.yml index c95dfa34a..80a6d3423 100644 --- a/.github/workflows/merge.yml +++ b/.github/workflows/merge.yml @@ -4,7 +4,7 @@ name: Latest release env: - CACHE_VERSION: 1 + CACHE_VERSION: 2 DEFAULT_PYTHON: 3.9 # Only run on merges diff --git a/.github/workflows/verify.yml b/.github/workflows/verify.yml index 2e43fb0bd..3f5a9c0fd 100644 --- a/.github/workflows/verify.yml +++ b/.github/workflows/verify.yml @@ -4,7 +4,7 @@ name: Latest commit env: - CACHE_VERSION: 11 + CACHE_VERSION: 12 DEFAULT_PYTHON: 3.9 PRE_COMMIT_HOME: ~/.cache/pre-commit diff --git a/requirements_commit.txt b/requirements_commit.txt index a7e45e40b..f035e6bed 100644 --- a/requirements_commit.txt +++ b/requirements_commit.txt @@ -3,6 +3,7 @@ # Import from setup.py -e . # Minimal requirements for committing +setuptools coverage flake8-black mypy From 53f3be79e993932ff80955998a67e907e675d025 Mon Sep 17 00:00:00 2001 From: Tom Scholten Date: Tue, 28 Dec 2021 13:50:38 +0100 Subject: [PATCH 2/9] Pre-commit updates --- .pre-commit-config.yaml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 679903d68..2cfe39783 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,7 +1,7 @@ repos: # Run manually in CI skipping the branch checks - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v3.2.0 + rev: v4.1.0 hooks: - id: check-executables-have-shebangs stages: [manual] @@ -9,12 +9,12 @@ repos: args: - --branch=main - repo: https://github.com/asottile/pyupgrade - rev: v2.7.2 + rev: v2.30.0 hooks: - id: pyupgrade args: [--py37-plus] - repo: https://github.com/psf/black - rev: 21.10b0 + rev: 21.12b0 hooks: - id: black args: @@ -22,7 +22,7 @@ repos: - --quiet files: ^((plugwise|tests)/.+)?[^/]+\.py$ - repo: https://github.com/codespell-project/codespell - rev: v1.17.1 + rev: v2.1.0 hooks: - id: codespell args: @@ -31,7 +31,7 @@ repos: - --quiet-level=2 exclude_types: [csv, json] - repo: https://gitlab.com/pycqa/flake8 - rev: 3.8.4 + rev: 3.9.2 hooks: - id: flake8 additional_dependencies: @@ -39,7 +39,7 @@ repos: - pydocstyle==5.1.1 files: ^(plugwise|tests)/.+\.py$ - repo: https://github.com/PyCQA/bandit - rev: 1.6.2 + rev: 1.7.1 hooks: - id: bandit args: @@ -48,11 +48,11 @@ repos: - --configfile=tests/bandit.yaml files: ^(plugwise|tests)/.+\.py$ - repo: https://github.com/PyCQA/isort - rev: 5.5.3 + rev: 5.10.1 hooks: - id: isort - repo: https://github.com/adrienverge/yamllint.git - rev: v1.24.2 + rev: v1.26.3 hooks: - id: yamllint - repo: https://github.com/prettier/prettier From eb143b79ddc94f13700f2b388a6f6e00dfb5ebfb Mon Sep 17 00:00:00 2001 From: Tom Scholten Date: Tue, 28 Dec 2021 14:13:32 +0100 Subject: [PATCH 3/9] Rework dependencies --- .github/workflows/merge.yml | 2 +- .github/workflows/verify.yml | 2 +- requirements_test.txt | 5 ++--- scripts/setup_test.sh | 2 +- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/merge.yml b/.github/workflows/merge.yml index 80a6d3423..5c3d7ffa1 100644 --- a/.github/workflows/merge.yml +++ b/.github/workflows/merge.yml @@ -4,7 +4,7 @@ name: Latest release env: - CACHE_VERSION: 2 + CACHE_VERSION: 3 DEFAULT_PYTHON: 3.9 # Only run on merges diff --git a/.github/workflows/verify.yml b/.github/workflows/verify.yml index 3f5a9c0fd..3f9487dbd 100644 --- a/.github/workflows/verify.yml +++ b/.github/workflows/verify.yml @@ -4,7 +4,7 @@ name: Latest commit env: - CACHE_VERSION: 12 + CACHE_VERSION: 14 DEFAULT_PYTHON: 3.9 PRE_COMMIT_HOME: ~/.cache/pre-commit diff --git a/requirements_test.txt b/requirements_test.txt index 62d69d079..73c48ae69 100644 --- a/requirements_test.txt +++ b/requirements_test.txt @@ -1,10 +1,9 @@ # In addition to Upstream HA (devbranch) -r https://raw.githubusercontent.com/home-assistant/core/dev/requirements_test.txt -# and commit -# -r requirements_commit.txt +-r https://raw.githubusercontent.com/home-assistant/core/dev/requirements_test_pre_commit.txt # and setup -e . -# # pytest-asyncio +setuptools pytest-cover radon diff --git a/scripts/setup_test.sh b/scripts/setup_test.sh index 0028dcd3f..9b40f4750 100755 --- a/scripts/setup_test.sh +++ b/scripts/setup_test.sh @@ -17,7 +17,7 @@ for venv in venv .venv .; do . "${my_path}/${venv}/bin/activate" # Install testing requirements - pip install --upgrade -r requirements_test.txt + pip install --upgrade -r requirements_test.txt # Install pre-commit hook ${my_path}/${venv}/bin/pre-commit install fi From 4678747720fa2e7e7e24f2319e38e90ffebb84d7 Mon Sep 17 00:00:00 2001 From: Tom Scholten Date: Tue, 28 Dec 2021 14:24:47 +0100 Subject: [PATCH 4/9] Try pre-commit #1526 --- .pre-commit-config.yaml | 1 + requirements_commit.txt | 1 - requirements_test.txt | 1 - 3 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 2cfe39783..c0e9d512e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -51,6 +51,7 @@ repos: rev: 5.10.1 hooks: - id: isort + additional_dependencies: ['.[pyproject]'] - repo: https://github.com/adrienverge/yamllint.git rev: v1.26.3 hooks: diff --git a/requirements_commit.txt b/requirements_commit.txt index f035e6bed..a7e45e40b 100644 --- a/requirements_commit.txt +++ b/requirements_commit.txt @@ -3,7 +3,6 @@ # Import from setup.py -e . # Minimal requirements for committing -setuptools coverage flake8-black mypy diff --git a/requirements_test.txt b/requirements_test.txt index 73c48ae69..abf861b8c 100644 --- a/requirements_test.txt +++ b/requirements_test.txt @@ -4,6 +4,5 @@ # and setup -e . # pytest-asyncio -setuptools pytest-cover radon From 5514e58b9dd999bbfba287859491adeb5a804f34 Mon Sep 17 00:00:00 2001 From: Tom Scholten Date: Tue, 28 Dec 2021 14:43:42 +0100 Subject: [PATCH 5/9] Revert --- .pre-commit-config.yaml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c0e9d512e..25d68c22c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -47,11 +47,6 @@ repos: - --format=custom - --configfile=tests/bandit.yaml files: ^(plugwise|tests)/.+\.py$ - - repo: https://github.com/PyCQA/isort - rev: 5.10.1 - hooks: - - id: isort - additional_dependencies: ['.[pyproject]'] - repo: https://github.com/adrienverge/yamllint.git rev: v1.26.3 hooks: @@ -61,6 +56,10 @@ repos: hooks: - id: prettier stages: [manual] + - repo: https://github.com/PyCQA/isort + rev: 5.10.1 + hooks: + - id: isort - repo: local hooks: # Run mypy through our wrapper script in order to get the possible From 6bfbb1de7743d07b17d348e4ed4b459ea7676daf Mon Sep 17 00:00:00 2001 From: Tom Scholten Date: Tue, 28 Dec 2021 14:44:45 +0100 Subject: [PATCH 6/9] Add wheel to be consistent --- .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 3f9487dbd..c16d817f7 100644 --- a/.github/workflows/verify.yml +++ b/.github/workflows/verify.yml @@ -47,7 +47,7 @@ jobs: run: | python -m venv venv . venv/bin/activate - pip install -U pip setuptools + pip install -U pip setuptools wheel pip install -e . pip install -r requirements_test.txt - name: Restore pre-commit environment from cache From 87d821a9870481d523c378ca13ba12e8292fc5ab Mon Sep 17 00:00:00 2001 From: Tom Scholten Date: Tue, 28 Dec 2021 14:57:51 +0100 Subject: [PATCH 7/9] Single-step cache --- .github/workflows/verify.yml | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/.github/workflows/verify.yml b/.github/workflows/verify.yml index c16d817f7..72ef5350b 100644 --- a/.github/workflows/verify.yml +++ b/.github/workflows/verify.yml @@ -4,8 +4,8 @@ name: Latest commit env: - CACHE_VERSION: 14 - DEFAULT_PYTHON: 3.9 + CACHE_VERSION: 15 + DEFAULT_PYTHON: "3.10" PRE_COMMIT_HOME: ~/.cache/pre-commit on: @@ -50,19 +50,6 @@ jobs: pip install -U pip setuptools wheel pip install -e . pip install -r requirements_test.txt - - name: Restore pre-commit environment from cache - id: cache-precommit - uses: actions/cache@v2 - with: - path: ${{ env.PRE_COMMIT_HOME }} - key: | - ${{ env.CACHE_VERSION}}-${{ runner.os }}-pre-commit-${{ hashFiles('.pre-commit-config.yaml') }} - restore-keys: | - ${{ env.CACHE_VERSION}}-${{ runner.os }}-pre-commit- - - name: Install pre-commit dependencies - if: steps.cache-precommit.outputs.cache-hit != 'true' - run: | - . venv/bin/activate pre-commit install-hooks black: From bc2ec4475ffac19c5d3f10e99cd9f9a0660d0326 Mon Sep 17 00:00:00 2001 From: Tom Scholten Date: Tue, 28 Dec 2021 15:31:05 +0100 Subject: [PATCH 8/9] Retry --- .github/workflows/verify.yml | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/.github/workflows/verify.yml b/.github/workflows/verify.yml index 72ef5350b..721839b85 100644 --- a/.github/workflows/verify.yml +++ b/.github/workflows/verify.yml @@ -4,8 +4,8 @@ name: Latest commit env: - CACHE_VERSION: 15 - DEFAULT_PYTHON: "3.10" + CACHE_VERSION: 16 + DEFAULT_PYTHON: "3.9" PRE_COMMIT_HOME: ~/.cache/pre-commit on: @@ -45,11 +45,24 @@ jobs: - name: Create Python virtual environment if: steps.cache-venv.outputs.cache-hit != 'true' run: | + pip install virtualenv --upgrade python -m venv venv . venv/bin/activate pip install -U pip setuptools wheel - pip install -e . pip install -r requirements_test.txt + - name: Restore pre-commit environment from cache + id: cache-precommit + uses: actions/cache@v2 + with: + path: ${{ env.PRE_COMMIT_HOME }} + key: | + ${{ env.CACHE_VERSION}}-${{ runner.os }}-pre-commit-${{ hashFiles('.pre-commit-config.yaml') }} + restore-keys: | + ${{ env.CACHE_VERSION}}-${{ runner.os }}-pre-commit- + - name: Install pre-commit dependencies + if: steps.cache-precommit.outputs.cache-hit != 'true' + run: | + . venv/bin/activate pre-commit install-hooks black: @@ -182,7 +195,6 @@ jobs: python -m venv venv . venv/bin/activate pip install -U pip setuptools wheel - pip install -e . pip install -r requirements_test.txt pytest: From 17a2b72063bada47d96af5b8853eff6d70a19ec2 Mon Sep 17 00:00:00 2001 From: Tom Scholten Date: Tue, 28 Dec 2021 15:40:32 +0100 Subject: [PATCH 9/9] Leave out isort --- .github/workflows/verify.yml | 2 +- .pre-commit-config.yaml | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/verify.yml b/.github/workflows/verify.yml index 721839b85..7af67abcd 100644 --- a/.github/workflows/verify.yml +++ b/.github/workflows/verify.yml @@ -156,7 +156,7 @@ jobs: pre-commit run --show-diff-on-failure --color=always --all-files --hook-stage manual black pre-commit run --show-diff-on-failure --color=always --all-files --hook-stage manual codespell pre-commit run --show-diff-on-failure --color=always --all-files --hook-stage manual flake8 - pre-commit run --show-diff-on-failure --color=always --all-files --hook-stage manual isort + #pre-commit run --show-diff-on-failure --color=always --all-files --hook-stage manual isort pre-commit run --show-diff-on-failure --color=always --all-files --hook-stage manual mypy pre-commit run --show-diff-on-failure --color=always --all-files --hook-stage manual userdata pre-commit run --show-diff-on-failure --color=always --all-files --hook-stage manual yamllint diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 25d68c22c..320801a61 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -56,10 +56,6 @@ repos: hooks: - id: prettier stages: [manual] - - repo: https://github.com/PyCQA/isort - rev: 5.10.1 - hooks: - - id: isort - repo: local hooks: # Run mypy through our wrapper script in order to get the possible @@ -79,3 +75,7 @@ repos: types: [python] require_serial: true files: ^plugwise/.+\.py$ +# - repo: https://github.com/PyCQA/isort +# rev: 5.10.1 +# hooks: +# - id: isort