From f27839c1d391ae077456de15fc375d4dba3ed5c8 Mon Sep 17 00:00:00 2001 From: Jon Dufresne Date: Sun, 7 Feb 2021 09:47:00 -0800 Subject: [PATCH] Enable mypy option no_implicit_reexport This option is part of the set of "strict" mypy options, bringing the project closer to full strict checking. https://mypy.readthedocs.io/en/stable/command_line.html#cmdoption-mypy-no-implicit-reexport > By default, imported values to a module are treated as exported and > mypy allows other modules to import them. This flag changes the > behavior to not re-export unless the item is imported using from-as or > is included in `__all__`. A side benefit of using `__all__` is that it allows removing the flake8 exceptions from the code base. Now `__init__.py` files are checked too. Refs: #972 --- piptools/_compat/__init__.py | 3 ++- piptools/repositories/__init__.py | 3 ++- setup.cfg | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/piptools/_compat/__init__.py b/piptools/_compat/__init__.py index c715e19b3..657bc13c3 100644 --- a/piptools/_compat/__init__.py +++ b/piptools/_compat/__init__.py @@ -1,2 +1,3 @@ -# flake8: noqa from .pip_compat import PIP_VERSION, parse_requirements + +__all__ = ["PIP_VERSION", "parse_requirements"] diff --git a/piptools/repositories/__init__.py b/piptools/repositories/__init__.py index ce5142e8c..7caf5e4d5 100644 --- a/piptools/repositories/__init__.py +++ b/piptools/repositories/__init__.py @@ -1,3 +1,4 @@ -# flake8: noqa from .local import LocalRequirementsRepository from .pypi import PyPIRepository + +__all__ = ["LocalRequirementsRepository", "PyPIRepository"] diff --git a/setup.cfg b/setup.cfg index 5f30716e6..521c4215b 100644 --- a/setup.cfg +++ b/setup.cfg @@ -78,6 +78,7 @@ disallow_untyped_calls = true disallow_untyped_decorators = true ignore_missing_imports = true no_implicit_optional = true +no_implicit_reexport = true strict_equality = true warn_redundant_casts = true warn_return_any = true