diff --git a/.gitignore b/.gitignore index f124186a..185099d9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,39 +1,40 @@ *.pyc *.sw? *~ \#* .\#* /.coverage /.coverage.* .eggs/ resources/test/ __pycache__ version.txt swh.web.egg-info docs/build/ docs/uri-scheme.md docs/dev-info.md *.sqlite3 .vscode/ .directory node_modules/ swh/web/static/*.* swh/web/static/js/ swh/web/static/css/ swh/web/static/fonts/ swh/web/static/jssources/ swh/web/static/img/thirdParty/ .cache-loader/ build/ dist/ .hypothesis .cache .pytest_cache .tox/ +.mypy_cache/ debian/ package-lock.json yarn-error.log cypress/mochawesome/ .nyc_output/ cypress/coverage/ cypress/fixtures/source*.json diff --git a/MANIFEST.in b/MANIFEST.in index 1f4d4094..aef7206e 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,15 +1,16 @@ include Makefile include pytest.ini include README.md include requirements.txt include requirements-swh.txt include requirements-test.txt include tox.ini include version.txt +recursive-include swh py.typed recursive-include swh/web/assets * recursive-include swh/web/static * recursive-include swh/web/templates * recursive-include swh/web/tests/resources * include package.json include yarn.lock diff --git a/mypy.ini b/mypy.ini new file mode 100644 index 00000000..517639ab --- /dev/null +++ b/mypy.ini @@ -0,0 +1,52 @@ +[mypy] +namespace_packages = True +warn_unused_ignores = True + + +# # support for django magic: https://github.com/typeddjango/django-stubs +# plugins = mypy_django_plugin.main + +# [mypy.plugins.django-stubs] +# django_settings_module = swh.web.settings.tests + + +# 3rd party libraries without stubs (yet) + +[mypy-bs4.*] +ignore_missing_imports = True + +[mypy-django_js_reverse.*] +ignore_missing_imports = True + +[mypy-htmlmin.*] +ignore_missing_imports = True + +[mypy-magic.*] +ignore_missing_imports = True + +[mypy-pkg_resources.*] +ignore_missing_imports = True + +[mypy-pygments.*] +ignore_missing_imports = True + +[mypy-pypandoc.*] +ignore_missing_imports = True + +[mypy-pytest.*] +ignore_missing_imports = True + +[mypy-rest_framework.*] +ignore_missing_imports = True + +[mypy-requests_mock.*] +ignore_missing_imports = True + +[mypy-sphinx.*] +ignore_missing_imports = True + +[mypy-sphinxcontrib.*] +ignore_missing_imports = True + +[mypy-swh.docs.*] +ignore_missing_imports = True diff --git a/requirements-test.txt b/requirements-test.txt index 489af9b0..576fe193 100644 --- a/requirements-test.txt +++ b/requirements-test.txt @@ -1,7 +1,8 @@ hypothesis pytest pytest-django pytest-mock +django-stubs requests-mock swh.core[http] >= 0.0.61 swh.loader.git >= 0.0.47 diff --git a/swh/__init__.py b/swh/__init__.py index 69e3be50..f14e1965 100644 --- a/swh/__init__.py +++ b/swh/__init__.py @@ -1 +1,4 @@ -__path__ = __import__('pkgutil').extend_path(__path__, __name__) +from pkgutil import extend_path +from typing import Iterable + +__path__ = extend_path(__path__, __name__) # type: Iterable[str] diff --git a/swh/web/py.typed b/swh/web/py.typed new file mode 100644 index 00000000..1242d432 --- /dev/null +++ b/swh/web/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561.