You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
no-implicit-reexport resolves implicit re-exports as Any #12749
# baz.pyfrombarimportFoo# Module "bar" does not explicitly export attribute "Foo"; implicit reexport disabled [attr-defined]reveal_type(Foo) # Revealed type is "Any"
mypy should still resolve the import like it does when no-implicit-reexport is disabled.
in my case, i'm trying to use a library that imports its own classes using implicit re-exports, which results in pretty much everything being treated as Any in my project
Just to be clear - are you expecting mypy to give the error (... does not explicitly export attribute ...) but then still treat it as being exported?
Also, in your examples the files are all .py files - are there stubs for the external libraries? If so, can you change the stubs to have explicit re-exports?
Just to be clear - are you expecting mypy to give the error (... does not explicitly export attribute ...) but then still treat it as being exported?
yes
Also, in your examples the files are all .py files - are there stubs for the external libraries? If so, can you change the stubs to have explicit re-exports?
the library i'm using has types defined in its .py files, but i'm pretty sure it would behave the same if they were stubs. i also can't really fix them without making stubs for the entire thing which would be a waste of time because they're already typed
Activity
KotlinIsland commentedon May 8, 2022
As a workaround you could apply an override to the mypy config:
Zeckie commentedon May 21, 2022
Just to be clear - are you expecting mypy to give the error (
... does not explicitly export attribute ...) but then still treat it as being exported?Also, in your examples the files are all .py files - are there stubs for the external libraries? If so, can you change the stubs to have explicit re-exports?
DetachHead commentedon May 22, 2022
yes
the library i'm using has types defined in its
.pyfiles, but i'm pretty sure it would behave the same if they were stubs. i also can't really fix them without making stubs for the entire thing which would be a waste of time because they're already typedPreserve (some) implicitly exported types (#13967)
whai-kung commentedon Mar 15, 2023
using
__all__ = ["Foo"]mypy will know about it.