From 67c2077962a54a4ccc014a8b8a9ed113050b765d Mon Sep 17 00:00:00 2001 From: Athanasius Date: Fri, 11 Feb 2022 16:15:24 +0000 Subject: [PATCH] pre-commit: pre-commit runs mypy *in its own venv* As such it doesn't have access to any extra modules you installed for your program, or manually running `mypy `. So, leverage `additional_dependencies` to list anything that mypy ends up complaining "that's not installed". Ref: plugins\eddn.py:40: error: Library stubs not installed for "requests" (or incompatible with Python 3.10) plugins\eddn.py:40: note: Hint: "python3 -m pip install types-requests" plugins\eddn.py:40: note: (or run "mypy --install-types" to install all missing stub packages) plugins\eddn.py:40: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports Found 1 error in 1 file (checked 1 source file) --- .pre-commit-config.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e9b0cc92..19b21930 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,11 @@ # See https://pre-commit.com for more information # See https://pre-commit.com/hooks.html for more hooks repos: +# This can be used to check how pre-commit is being run +# - repo: meta +# hooks: +# - id: identity + - repo: https://github.com/pre-commit/pre-commit-hooks rev: 'v4.1.0' hooks: @@ -44,6 +49,9 @@ repos: rev: 'v0.931' hooks: - id: mypy + # verbose: true + # log_file: 'pre-commit_mypy.log' + additional_dependencies: [ types-requests ] # args: [ "--follow-imports", "skip", "--ignore-missing-imports", "--scripts-are-modules" ] ### # pydocstyle.exe