Skip to content

Commit

Permalink
Enable mypy option no_implicit_reexport
Browse files Browse the repository at this point in the history
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
  • Loading branch information
jdufresne committed Feb 8, 2021
1 parent a3515a0 commit f27839c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion piptools/_compat/__init__.py
@@ -1,2 +1,3 @@
# flake8: noqa
from .pip_compat import PIP_VERSION, parse_requirements

__all__ = ["PIP_VERSION", "parse_requirements"]
3 changes: 2 additions & 1 deletion piptools/repositories/__init__.py
@@ -1,3 +1,4 @@
# flake8: noqa
from .local import LocalRequirementsRepository
from .pypi import PyPIRepository

__all__ = ["LocalRequirementsRepository", "PyPIRepository"]
1 change: 1 addition & 0 deletions setup.cfg
Expand Up @@ -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
Expand Down

0 comments on commit f27839c

Please sign in to comment.