Skip to content

Should mypy check existence of module attributes for unannotated modules? #17701

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

Closed
DeinAlptraum opened this issue Aug 21, 2024 · 1 comment
Closed
Labels

Comments

@DeinAlptraum
Copy link
Contributor

Feature

Report name-defined errors for unannotated modules.

Pitch

I believe it would be reasonable and very helpful, and I assume possible, to report name-defined errors for unannotated modules.

A simple example to motivate this:

import sympy
foo: sympy.expr = 3

The module sympy is not annotated and does not have an attribute expr (this is a typo, sympy.Exprexists) which is currently not detected by mypy. I assume missing names should be detectable even without type annotations for the module, so I would like this to produce
error: Name "sympy.expr" is not defined [name-defined]
when checked with mypy

@hauntsaninja
Copy link
Collaborator

This is a duplicate of #8545

@hauntsaninja hauntsaninja closed this as not planned Won't fix, can't repro, duplicate, stale Aug 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants