-
Notifications
You must be signed in to change notification settings - Fork 21
Open
Labels
Description
Mypy will prevent users from doing implicit re-exports. So if in module a
you do from b import obj
, and attempt to do from a import obj
elsewhere, that will error. See https://mypy.readthedocs.io/en/stable/command_line.html#cmdoption-mypy-no-implicit-reexport for more context.
There are two ways in which you can explicitly re-export. They are:
- When you import and set the
__all__
attribute in an__init__.py
.pycln
as far as I remember has no problem with this. - When you use the explicit re-export syntax that is supported by Mypy, which is
from b import obj as obj
. This signals to Mypy that you are intentionally, deliberately re-exporting this, and are permitting imports ofobj
through modulea
.
It appears that 2 is not respected by pycln
. It will remove these re-exports, because they are unused. So the feature request here is that pycln
respects this convention and does not remove these. I understand that these are easily silenced through the comment directives, but the ask here is to make that superfluous.
Avasam