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

Implement flag to allow typechecking of untyped modules #17712

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

DeinAlptraum
Copy link

Add a flag and config ini options "enable_installed_packages". Setting it to True instructs mypy to typecheck also modules that do not have stubs or a py.typed marker.

Fixes #8545

This comment has been minimized.

This comment has been minimized.

@DeinAlptraum
Copy link
Author

@hauntsaninja can you tell me by any chance if there's anything I'm missing/I should do to get a review here?

@DeinAlptraum
Copy link
Author

Ping. Can someone review this? @JelleZijlstra can you help me with this?

@DeinAlptraum
Copy link
Author

Ping. @hauntsaninja @JelleZijlstra can you tell me what I need to do to get a review here?

@DeinAlptraum
Copy link
Author

Ping @hauntsaninja @JelleZijlstra @JukkaL

@JelleZijlstra
Copy link
Member

Mypy development is unfortunately under-resourced and personally I don't have much time available to review PRs. I'd advise you to wait and hopefully a committer will come along and review this.

@Xiddoc
Copy link

Xiddoc commented Nov 22, 2024

I feel like this feature is crucial and affects way too many people for it to be ignored. Using type: ignore or manually adding a py.typed file to every used third-party module is incredibly impractical.

Could this at least get a CR, if improvements are needed then the community can follow up on issues for the PR. ❤️
@JukkaL @hauntsaninja

@JukkaL
Copy link
Collaborator

JukkaL commented Nov 22, 2024

I can try to review this -- possibly next week. It would help if the merge conflict was fixed.

@DeinAlptraum
Copy link
Author

Thanks for the comment, didn't notice the merge conflict. I wish there were notifications for this... anyway, fixed.

This comment has been minimized.

Copy link
Collaborator

@hauntsaninja hauntsaninja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I think the per-module handling isn't quite right, in particular, I'm not sure it handles globs correctly. I'd also vote for a slightly more specific name, maybe something like --follow-untyped-imports. This matches the untyped-import error code the current implementation will silence.

@DeinAlptraum
Copy link
Author

@hauntsaninja thanks for the feedback! You're right, this wasn't handling globs properly. In the process of fixing that, I also noticed that my solution was more complicated than necessary and simplified it a bit...

Regarding the name: it seems there was quite a lot of discussion about how the config option should be called on the original issue, so I wasn't sure what to pick. Yours definitely sounds better though, so changed it to that for now.

Copy link
Contributor

According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow/disallow pep561 packages
5 participants