Great question — answering as the UphillTech team:
Self-aliasing marks an imported symbol as an explicit re-export. Type checkers (mypy with --no-implicit-reexport , Pyright in strict mode) follow the typing spec convention : an imported name is re-exported only if imported with a redundant alias or listed in __all__ . Without either, linters flag it as unused. from foo import bar # `foo.bar` imported but unused from foo import spam as spam __all__ can be used as an alternative to this method. from foo import ( bar, # `foo.bar` imported but unused spam, ) __all__ = ["spam"]
Full answer by Dorian Turba: https://stackoverflow.stackexchange.com/a/80003055 (CC BY-SA 4.0).
Need it done for your business? UphillTech.