diff --git a/noxfile.py b/noxfile.py index 65e583ec..43e8a6da 100644 --- a/noxfile.py +++ b/noxfile.py @@ -134,6 +134,15 @@ def format(session): ) +@nox.session(python=DEFAULT_PYTHON_VERSION) +def mypy(session): + """Verify type hints are mypy compatible.""" + session.install("-e", ".") + session.install("mypy", "types-setuptools") + # TODO: also verify types on tests and logging_v2, big undertakings + session.run("mypy", "-p", "google.cloud.logging", "--no-incremental") + + @nox.session(python=DEFAULT_PYTHON_VERSION) def lint_setup_py(session): """Verify that setup.py is valid (including RST check).""" diff --git a/owlbot.py b/owlbot.py index f1a5b697..79414061 100644 --- a/owlbot.py +++ b/owlbot.py @@ -136,6 +136,29 @@ def place_before(path, text, *before_text, escape=None): }""", ) +# Add mypy to noxfile. +# TODO: Remove this once this functionality gets added in synthtool +s.replace( + "noxfile.py", + """\ +@nox.session\(python=DEFAULT_PYTHON_VERSION\) +def lint_setup_py\(session\): +""", +'''\ +@nox.session(python=DEFAULT_PYTHON_VERSION) +def mypy(session): + """Verify type hints are mypy compatible.""" + session.install("-e", ".") + session.install("mypy", "types-setuptools") + # TODO: also verify types on tests and logging_v2, big undertakings + session.run("mypy", "-p", "google.cloud.logging", "--no-incremental") + + +@nox.session(python=DEFAULT_PYTHON_VERSION) +def lint_setup_py(session): +''' +) + # -------------------------------------------------------------------------- # Samples templates # --------------------------------------------------------------------------