From 1c2427c27ea00715e29376df65125b4ef60ac731 Mon Sep 17 00:00:00 2001 From: Fritz Obermeyer Date: Thu, 3 Jun 2021 10:43:17 -0600 Subject: [PATCH 1/2] Incorporate mypy into lint stage --- .travis.yml | 9 +-------- Makefile | 3 +++ examples/__init__.py | 0 examples/contrib/__init__.py | 0 examples/contrib/funsor/__init__.py | 0 examples/cvae/__init__.py | 0 examples/scanvi/__init__.py | 0 setup.cfg | 9 +-------- setup.py | 1 + 9 files changed, 6 insertions(+), 16 deletions(-) create mode 100644 examples/__init__.py create mode 100644 examples/contrib/__init__.py create mode 100644 examples/contrib/funsor/__init__.py create mode 100644 examples/cvae/__init__.py create mode 100644 examples/scanvi/__init__.py diff --git a/.travis.yml b/.travis.yml index 72a540edb3..c196b2e690 100644 --- a/.travis.yml +++ b/.travis.yml @@ -42,7 +42,7 @@ jobs: - stage: lint name: lint python: 3.6 - before_install: pip install flake8 isort>=5.0 nbstripout nbformat + before_install: pip install flake8 isort>=5.0 mypy nbstripout nbformat install: script: - make lint @@ -55,13 +55,6 @@ jobs: - pip install -r docs/requirements.txt - make docs - make doctest - - name: type_check - python: 3.6 - script: - - pip install mypy==0.812 - - pwd - - ls - - mypy pyro - name: perf python: 3.6 script: diff --git a/Makefile b/Makefile index 0d906e54e3..9500b5f833 100644 --- a/Makefile +++ b/Makefile @@ -21,6 +21,9 @@ lint: FORCE flake8 isort --check . python scripts/update_headers.py --check + mypy pyro + # mypy examples # FIXME + mypy scripts license: FORCE python scripts/update_headers.py diff --git a/examples/__init__.py b/examples/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/examples/contrib/__init__.py b/examples/contrib/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/examples/contrib/funsor/__init__.py b/examples/contrib/funsor/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/examples/cvae/__init__.py b/examples/cvae/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/examples/scanvi/__init__.py b/examples/scanvi/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/setup.cfg b/setup.cfg index 3dc45864e6..e598b64cd6 100644 --- a/setup.cfg +++ b/setup.cfg @@ -35,35 +35,30 @@ column_limit = 120 python_version = 3.6 warn_return_any = True warn_unused_configs = True +warn_incomplete_stub = True # Per-module options: [mypy-pyro._version.*] ignore_errors = True -warn_incomplete_stub = True [mypy-pyro.contrib.*] ignore_errors = True -warn_incomplete_stub = True [mypy-pyro.distributions.*] ignore_errors = True -warn_incomplete_stub = True warn_unused_ignores = True [mypy-pyro.generic.*] ignore_errors = True -warn_incomplete_stub = True warn_unused_ignores = True [mypy-pyro.infer.*] ignore_errors = True -warn_incomplete_stub = True warn_unused_ignores = True [mypy-pyro.nn.*] ignore_errors = True -warn_incomplete_stub = True warn_unused_ignores = True [mypy-pyro.ops.*] @@ -71,7 +66,6 @@ ignore_errors = True warn_unused_ignores = True [mypy-pyro.optm.*] -warn_incomplete_stub = True warn_unused_ignores = True [mypy-pyro.params.*] @@ -83,5 +77,4 @@ ignore_errors = True [mypy-pyro.util.*] ignore_errors = True -warn_incomplete_stub = True warn_unused_ignores = True diff --git a/setup.py b/setup.py index 0a6c2aef1d..9602f041ca 100644 --- a/setup.py +++ b/setup.py @@ -104,6 +104,7 @@ 'dev': EXTRAS_REQUIRE + [ 'flake8', 'isort>=5.0', + 'mypy>=0.812', 'nbformat', 'nbsphinx>=0.3.2', 'nbstripout', From f8ec67ac47962e17a2cd2fb18b75497d48b884c9 Mon Sep 17 00:00:00 2001 From: Fritz Obermeyer Date: Thu, 3 Jun 2021 13:33:17 -0600 Subject: [PATCH 2/2] Ignore missing imports --- setup.cfg | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.cfg b/setup.cfg index e598b64cd6..9785fe5387 100644 --- a/setup.cfg +++ b/setup.cfg @@ -36,6 +36,7 @@ python_version = 3.6 warn_return_any = True warn_unused_configs = True warn_incomplete_stub = True +ignore_missing_imports = True # Per-module options: