diff --git a/.arclint b/.arclint --- a/.arclint +++ b/.arclint @@ -273,6 +273,7 @@ }, "lint-python-mypy": { "type": "lint-python-mypy", + "version": ">=0.780", "include": "(\\.py$)", "exclude": "(^contrib/)", "flags": [ diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -133,7 +133,7 @@ On Ubuntu (>= 18.04+updates): ``` -sudo apt-get install clang-format-8 clang-tidy-8 clang-tools-8 cppcheck mypy python3-autopep8 flake8 php-codesniffer yamllint +sudo apt-get install clang-format-8 clang-tidy-8 clang-tools-8 cppcheck python3-autopep8 flake8 php-codesniffer yamllint ``` On Debian (>= 10), the clang-8 family of tools is available from the `buster-backports` repository: @@ -154,6 +154,16 @@ ln -s $PWD/clang+llvm-8.0.0-x86_64-apple-darwin/bin/clang-tidy /usr/local/bin/clang-tidy ``` +If you are modifying a python script, you will need to install `mypy`. The minimum required version is 0.780, because +the previous ones are known to have issues with some python type annotations. +On Debian based systems, this can be installed via: +``` +sudo apt-get install python3-pip +pip3 install mypy==0.780 +echo "export PATH=\"`python3 -m site --user-base`/bin:\$PATH\"" >> ~/.bashrc +source ~/.bashrc +``` + If you are modifying a shell script, you will need to install the `shellcheck` linter. A recent version is required and may not be packaged for your distribution. Standalone binaries are available for download on diff --git a/contrib/utils/install-dependencies.sh b/contrib/utils/install-dependencies.sh --- a/contrib/utils/install-dependencies.sh +++ b/contrib/utils/install-dependencies.sh @@ -58,7 +58,6 @@ libzmq3-dev lld make - mypy ninja-build nsis php-codesniffer @@ -123,6 +122,12 @@ # For running Python test suites pip3 install pytest +# An up-to-date mypy is required as a python linter +pip3 install mypy==0.780 +echo "export PATH=\"$(python3 -m site --user-base)/bin:\$PATH\"" >> ~/.bashrc +# shellcheck source=/dev/null +source ~/.bashrc + # Install pandoc. The version from buster is outdated, so get a more recent one # from github. wget https://github.com/jgm/pandoc/releases/download/2.10.1/pandoc-2.10.1-1-amd64.deb