From f330a9c9feff7e2fc2aadb706724bda3128384d8 Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Sat, 21 Aug 2021 11:56:01 +0200 Subject: [PATCH 1/6] Remove typing ignore for platformdirs --- setup.cfg | 3 --- 1 file changed, 3 deletions(-) diff --git a/setup.cfg b/setup.cfg index ae3eb47f73..7ee763a59b 100644 --- a/setup.cfg +++ b/setup.cfg @@ -83,9 +83,6 @@ src_paths = pylint [mypy] scripts_are_modules = True -[mypy-platformdirs] -ignore_missing_imports = True - [mypy-astroid.*] ignore_missing_imports = True From 84d3a821f257d1aa6d94573a78649bd2c2c555a7 Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Sat, 21 Aug 2021 12:09:56 +0200 Subject: [PATCH 2/6] Use local environment for mypy pre-commit --- .pre-commit-config.yaml | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 9966b4d0fb..1a3b3638cf 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -61,6 +61,14 @@ repos: ] # disabled plugins: pylint.extensions.mccabe exclude: tests/functional/|tests/input|tests/extensions/data|tests/regrtest_data/|tests/data/|doc/ + - id: mypy + name: mypy + entry: mypy + language: system + types: [python] + args: [] + require_serial: true + exclude: tests/functional/|tests/input|tests(/.*)*/data|tests/regrtest_data/|tests/data/|tests(/.*)+/conftest.py|doc/|bin/ - id: fix-documentation name: Fix documentation entry: python3 -m script.fix_documentation @@ -74,18 +82,6 @@ repos: args: ["--ignore-roles=func,class,mod", "--report=warning"] types: [text] # necessary to include ChangeLog file files: ^(ChangeLog|doc/(.*/)*.*\.rst) - - repo: https://github.com/pre-commit/mirrors-mypy - rev: v0.910 - hooks: - - id: mypy - name: mypy - entry: mypy - language: python - types: [python] - args: [] - require_serial: true - additional_dependencies: ["types-pkg_resources==0.1.3", "types-toml==0.1.3"] - exclude: tests/functional/|tests/input|tests(/.*)*/data|tests/regrtest_data/|tests/data/|tests(/.*)+/conftest.py|doc/|bin/ - repo: https://github.com/pre-commit/mirrors-prettier rev: v2.3.2 hooks: From 11b5d7ab863f88939c856bfe4ffb55ce317c2ab1 Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Sat, 21 Aug 2021 12:10:24 +0200 Subject: [PATCH 3/6] Update ci workflow --- .github/workflows/ci.yaml | 46 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 44 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 2eec5b96c4..4977932ba2 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -72,8 +72,8 @@ jobs: . venv/bin/activate pre-commit install --install-hooks - formatting: - name: Run pre-commit checks + pylint: + name: Run pylint check runs-on: ubuntu-latest needs: prepare-base steps: @@ -114,6 +114,48 @@ jobs: pip install -e . pre-commit run pylint --all-files + mypy: + name: Run mypy check + runs-on: ubuntu-latest + needs: prepare-base + steps: + - name: Check out code from GitHub + uses: actions/checkout@v2.3.4 + - name: Set up Python ${{ env.DEFAULT_PYTHON }} + id: python + uses: actions/setup-python@v2.2.2 + with: + python-version: ${{ env.DEFAULT_PYTHON }} + - name: Restore Python virtual environment + id: cache-venv + uses: actions/cache@v2.1.6 + with: + path: venv + key: + ${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{ + needs.prepare-base.outputs.python-key }} + - name: Fail job if Python cache restore failed + if: steps.cache-venv.outputs.cache-hit != 'true' + run: | + echo "Failed to restore Python venv from cache" + exit 1 + - name: Restore pre-commit environment + id: cache-precommit + uses: actions/cache@v2.1.6 + with: + path: ${{ env.PRE_COMMIT_CACHE }} + key: ${{ runner.os }}-${{ needs.prepare-base.outputs.pre-commit-key }} + - name: Fail job if pre-commit cache restore failed + if: steps.cache-precommit.outputs.cache-hit != 'true' + run: | + echo "Failed to restore pre-commit environment from cache" + exit 1 + - name: Run formatting check + run: | + . venv/bin/activate + pip install -e . + pre-commit run mypy --all-files + spelling: name: Run spelling checks runs-on: ubuntu-latest From cb743fe5a3a3b2f1a6352f5dac99dc142b5d2c88 Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Sat, 21 Aug 2021 14:02:37 +0200 Subject: [PATCH 4/6] Revert "Use local environment for mypy pre-commit" This reverts commit 2052d0a96946ac086430b87dfd9e29c8c43721f9. --- .pre-commit-config.yaml | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1a3b3638cf..9966b4d0fb 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -61,14 +61,6 @@ repos: ] # disabled plugins: pylint.extensions.mccabe exclude: tests/functional/|tests/input|tests/extensions/data|tests/regrtest_data/|tests/data/|doc/ - - id: mypy - name: mypy - entry: mypy - language: system - types: [python] - args: [] - require_serial: true - exclude: tests/functional/|tests/input|tests(/.*)*/data|tests/regrtest_data/|tests/data/|tests(/.*)+/conftest.py|doc/|bin/ - id: fix-documentation name: Fix documentation entry: python3 -m script.fix_documentation @@ -82,6 +74,18 @@ repos: args: ["--ignore-roles=func,class,mod", "--report=warning"] types: [text] # necessary to include ChangeLog file files: ^(ChangeLog|doc/(.*/)*.*\.rst) + - repo: https://github.com/pre-commit/mirrors-mypy + rev: v0.910 + hooks: + - id: mypy + name: mypy + entry: mypy + language: python + types: [python] + args: [] + require_serial: true + additional_dependencies: ["types-pkg_resources==0.1.3", "types-toml==0.1.3"] + exclude: tests/functional/|tests/input|tests(/.*)*/data|tests/regrtest_data/|tests/data/|tests(/.*)+/conftest.py|doc/|bin/ - repo: https://github.com/pre-commit/mirrors-prettier rev: v2.3.2 hooks: From 24ba5f333979297431a7ca694b7df82e63ad98e1 Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Sat, 21 Aug 2021 14:02:45 +0200 Subject: [PATCH 5/6] Revert "Update ci workflow" This reverts commit a0f8174b29e972b1665655a1e29517e3bd7bc184. --- .github/workflows/ci.yaml | 46 ++------------------------------------- 1 file changed, 2 insertions(+), 44 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 4977932ba2..2eec5b96c4 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -72,8 +72,8 @@ jobs: . venv/bin/activate pre-commit install --install-hooks - pylint: - name: Run pylint check + formatting: + name: Run pre-commit checks runs-on: ubuntu-latest needs: prepare-base steps: @@ -114,48 +114,6 @@ jobs: pip install -e . pre-commit run pylint --all-files - mypy: - name: Run mypy check - runs-on: ubuntu-latest - needs: prepare-base - steps: - - name: Check out code from GitHub - uses: actions/checkout@v2.3.4 - - name: Set up Python ${{ env.DEFAULT_PYTHON }} - id: python - uses: actions/setup-python@v2.2.2 - with: - python-version: ${{ env.DEFAULT_PYTHON }} - - name: Restore Python virtual environment - id: cache-venv - uses: actions/cache@v2.1.6 - with: - path: venv - key: - ${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{ - needs.prepare-base.outputs.python-key }} - - name: Fail job if Python cache restore failed - if: steps.cache-venv.outputs.cache-hit != 'true' - run: | - echo "Failed to restore Python venv from cache" - exit 1 - - name: Restore pre-commit environment - id: cache-precommit - uses: actions/cache@v2.1.6 - with: - path: ${{ env.PRE_COMMIT_CACHE }} - key: ${{ runner.os }}-${{ needs.prepare-base.outputs.pre-commit-key }} - - name: Fail job if pre-commit cache restore failed - if: steps.cache-precommit.outputs.cache-hit != 'true' - run: | - echo "Failed to restore pre-commit environment from cache" - exit 1 - - name: Run formatting check - run: | - . venv/bin/activate - pip install -e . - pre-commit run mypy --all-files - spelling: name: Run spelling checks runs-on: ubuntu-latest From a04d6bc9d18946267c74d8194757c5c25a3f6276 Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Sat, 21 Aug 2021 14:04:13 +0200 Subject: [PATCH 6/6] Add platformdirs as additional dependency --- .pre-commit-config.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 9966b4d0fb..c4d1088b6a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -84,7 +84,8 @@ repos: types: [python] args: [] require_serial: true - additional_dependencies: ["types-pkg_resources==0.1.3", "types-toml==0.1.3"] + additional_dependencies: + ["platformdirs==2.2.0", "types-pkg_resources==0.1.3", "types-toml==0.1.3"] exclude: tests/functional/|tests/input|tests(/.*)*/data|tests/regrtest_data/|tests/data/|tests(/.*)+/conftest.py|doc/|bin/ - repo: https://github.com/pre-commit/mirrors-prettier rev: v2.3.2