Possibility to locally turn off `remove_redundent_aliases`
In general remove_redundent_aliases is a nice setting, and it makes sense to have it enabled across a large code base in general.
However, type checkers use redundant module or redundant symbol aliases (see second bullet point) to communicate information about whether a symbol should be considered private or public by the type checker. This feature is quite convenient, because it can avoid having to double-maintain the good old __all__ list.
This means that turning off remove_redundent_aliases is valuable for package-level __init__.py that deal with symbol forwarding to the outside. But turning of remove_redundent_aliases globally just for the usages in __init__.py's would allow truely redundant aliases to sneak in where they aren't meaningful. Alternatively, using # isort: off ... # isort: on wrapping fails to leverage isort for the its main purpose of sorting all the imports. So for a large __init__.py turning off isort entirely is also not ideal.
For these reasons it would be great if the redundant alias feature could be turned off locally via an action, e.g.:
# isort: remove-redundent-aliases-off
from . import PublicThingA as PublicThingA
from . import PublicThingB as PublicThingB
from . import PrivateThing
# isort: remove-redundent-aliases-on
I’m working on adding local action comments to preserve redundant aliases while keeping import sorting enabled, with regression tests and documentation.
__all__ is what the community has moved towards. I can understand why you'd want this, but considering the code necessary in https://github.com/PyCQA/isort/pull/2706/ I don't think this is worth the effort. Sorry!