diff --git a/.gitignore b/.gitignore index b0e734a..3c564c7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,11 +1,12 @@ *.pyc *.sw? *~ .coverage .eggs/ __pycache__ *.egg-info/ build/ dist/ version.txt .tox +.mypy_cache/ diff --git a/mypy.ini b/mypy.ini new file mode 100644 index 0000000..632d9a8 --- /dev/null +++ b/mypy.ini @@ -0,0 +1,12 @@ +[mypy] +namespace_packages = True +warn_unused_ignores = True + + +# 3rd party libraries without stubs (yet) + +[mypy-pkg_resources.*] +ignore_missing_imports = True + +[mypy-pytest.*] +ignore_missing_imports = True diff --git a/swh/__init__.py b/swh/__init__.py index 69e3be5..de9df06 100644 --- a/swh/__init__.py +++ b/swh/__init__.py @@ -1 +1,4 @@ -__path__ = __import__('pkgutil').extend_path(__path__, __name__) +from typing import Iterable + +__path__ = __import__('pkgutil').extend_path(__path__, + __name__) # type: Iterable[str] diff --git a/swh/graph/py.typed b/swh/graph/py.typed new file mode 100644 index 0000000..1242d43 --- /dev/null +++ b/swh/graph/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. diff --git a/tox.ini b/tox.ini index 0fb07c6..a33e8ce 100644 --- a/tox.ini +++ b/tox.ini @@ -1,16 +1,24 @@ [tox] -envlist=flake8,py3 +envlist=flake8,py3,mypy [testenv:py3] deps = .[testing] pytest-cov commands = pytest --cov=swh --cov-branch {posargs} [testenv:flake8] skip_install = true deps = flake8 commands = {envpython} -m flake8 + +[testenv:mypy] +skip_install = true +deps = + .[testing] + mypy +commands = + mypy swh