From ee87f312bf692d73c036f46939e6b7e9bed7ccf7 Mon Sep 17 00:00:00 2001 From: Benjamin Drung Date: Wed, 3 Dec 2025 14:54:54 +0100 Subject: [PATCH] run mypy during package build --- debian/control | 2 ++ debian/rules | 2 +- pyproject.toml | 4 ++++ run-linters | 8 ++++++++ 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/debian/control b/debian/control index bbfbc0e..eabd95b 100644 --- a/debian/control +++ b/debian/control @@ -18,6 +18,7 @@ Build-Depends: flake8, isort , lsb-release, + mypy , pylint , python3-all, python3-apt, @@ -30,6 +31,7 @@ Build-Depends: python3-pytest, python3-requests , python3-setuptools, + python3-typeshed , python3-yaml , Standards-Version: 4.7.2 Vcs-Git: https://git.launchpad.net/ubuntu-dev-tools diff --git a/debian/rules b/debian/rules index 42b9d34..4b88722 100755 --- a/debian/rules +++ b/debian/rules @@ -3,7 +3,7 @@ override_dh_auto_clean: dh_auto_clean rm -f .coverage - rm -rf .tox + rm -rf .mypy_cache .tox override_dh_auto_test: ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS))) diff --git a/pyproject.toml b/pyproject.toml index f947450..4fc4278 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,3 +4,7 @@ line-length = 99 [tool.isort] line_length = 99 profile = "black" + +[tool.mypy] +disallow_incomplete_defs = true +ignore_missing_imports = true diff --git a/run-linters b/run-linters index 17dd478..707482d 100755 --- a/run-linters +++ b/run-linters @@ -21,6 +21,12 @@ run_flake8() { flake8 --max-line-length=99 --ignore=E203,W503 . $PYTHON_SCRIPTS } +run_mypy() { + echo "Running mypy..." + mypy . + mypy --scripts-are-modules $PYTHON_SCRIPTS +} + run_pylint() { echo "Running pylint..." pylint "$@" $(find * -name '*.py') $PYTHON_SCRIPTS @@ -31,10 +37,12 @@ if test "${1-}" = "--errors-only"; then run_black || true run_isort || true run_flake8 || true + run_mypy run_pylint --errors-only else run_black run_isort run_flake8 + run_mypy run_pylint fi