Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pytype fails to import attrs.AttrsInstance #1487

Open
bbenne10 opened this issue Aug 10, 2023 · 1 comment
Open

pytype fails to import attrs.AttrsInstance #1487

bbenne10 opened this issue Aug 10, 2023 · 1 comment
Labels
bug cat: stubs and 3p type stubs and third-party types

Comments

@bbenne10
Copy link

In attempting to use AttrsInstance to type a (admittedly very general) interface to a new library, I find that I cannot get pytype to find the type without also importing define.

Reproduction case (Note this is the ONLY thing in the file):

from attrs import AttrsInstance

Oddly, this does not reproduce the problem:

from attrs import define, AttrsInstance

I honestly have no idea why this is happening. Insights welcome :)

@rchen152 rchen152 added bug cat: stubs and 3p type stubs and third-party types labels Aug 23, 2023
@gmacon
Copy link

gmacon commented Feb 14, 2024

I don't think define is related to this issue, it's simply that #1571 was hiding the bug when define was also imported.

$ cat repro.py
from attrs import AttrsInstance, define
$ pytype-single repro.py
File "repro.py", line 1, in <module>: Can't find module 'attrs.AttrsInstance'. [import-error]

For more details, see https://google.github.io/pytype/errors.html#import-error
$ python repro.py
$

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug cat: stubs and 3p type stubs and third-party types
Projects
None yet
Development

No branches or pull requests

3 participants