From b97a15059206203abb35f6cb15c242ef3bbe5f07 Mon Sep 17 00:00:00 2001 From: Tyson Smith Date: Tue, 4 Jun 2024 17:26:36 -0700 Subject: [PATCH] Enable type checking --- .pre-commit-config.yaml | 7 +++++++ pyproject.toml | 5 +++++ tox.ini | 7 +++++++ 3 files changed, 19 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index aceaf3b0..bc6d90a7 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -58,6 +58,13 @@ repos: - id: check-useless-excludes - repo: local hooks: + - id: mypy + name: mypy + entry: tox -e mypy -- + language: system + require_serial: true + exclude: (/conftest.py$|/test_.*\.py$) + types: [python] - id: pylint name: pylint entry: tox -e pylint -- diff --git a/pyproject.toml b/pyproject.toml index acd3991f..4ed985a3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -26,6 +26,11 @@ exclude_lines = [ known_first_party = "grizzly" profile = "black" +[tool.mypy] +ignore_missing_imports = true +strict = true +show_error_codes = true + [tool.pylint.format] max-line-length = 88 diff --git a/tox.ini b/tox.ini index 96c82285..021aee5e 100644 --- a/tox.ini +++ b/tox.ini @@ -37,6 +37,13 @@ deps = pre-commit skip_install = true +[testenv:mypy] +commands = + mypy --install-types --non-interactive {posargs} +deps = + mypy==v1.10.0 +usedevelop = true + [testenv:pylint] commands = pylint -j 0 {posargs}