Skip to content
New issue

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

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

Already on GitHub? # to your account

[FYI] mypy_primer #9490

Closed
hauntsaninja opened this issue Sep 26, 2020 · 4 comments
Closed

[FYI] mypy_primer #9490

hauntsaninja opened this issue Sep 26, 2020 · 4 comments

Comments

@hauntsaninja
Copy link
Collaborator

hauntsaninja commented Sep 26, 2020

With apologies to black_primer, I jotted down a script that lets us run mypy over a large amount of open source Python code. Hopefully this helps democratise the process of identifying issues and regressions and evaluating risky changes.

This has informed:
python/typeshed#4579
python/typeshed#4574
python/typeshed#4582
python/typeshed#4583
And you can see it in action at:
#9275
#9290 (comment)

More details at: https://github.com/hauntsaninja/mypy_primer

Feel free to close or otherwise discuss!

@TH3CHARLie
Copy link
Collaborator

Very interesting(and of course powerful) utility!

@obi1kenobi
Copy link

This seems pretty cool, nicely done!

Does it support mypy settings other than the defaults? Asking because in #9493 I ran into an issue where seemingly relaxing mypy's settings from their default values caused a crash when analyzing xarray as a dependency of another project, and I noticed that one of the issues you found and helped fix was discovered by analyzing xarray.

@hauntsaninja
Copy link
Collaborator Author

hauntsaninja commented Sep 27, 2020

Not quite, it's meant to try to invoke mypy the way the projects are invoking mypy. So each project has a hardcoded mypy command that I stole (usually from their CI) / it picks up the projects' mypy configuration files.
I do agree that using mypy_primer is a good approach to explore / test flags and it should be fairly easy to change the script to do this sort of thing.

PS: Thanks for sharing and writing typing_copilot, seems useful! I've seen a number of projects setting ignore_errors = True in their config files as a way of ratcheting (e.g scipy). Incorporating stricter settings for subpackages like that into typing_copilot could be a interesting (but potentially complex) addition.

@hauntsaninja
Copy link
Collaborator Author

Closing, since mypy_primer is now in mypy CI.

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

No branches or pull requests

3 participants