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

Manage ignore_missing_imports = true sections configs automatically #10044

Open
indigoviolet opened this issue Feb 7, 2021 · 0 comments
Open
Labels

Comments

@indigoviolet
Copy link

indigoviolet commented Feb 7, 2021

Feature

When I'm adding typing to an existing project, I encounter many libraries that don't have type hints. The easy solution to suppressing these errors is setting ignore_missing_imports = true, but this is not great. The recommended solution, assuming you don't want to write your own stubs, is to create separate sections for each such library. This can be cumbersome to create and manage.

I wrote myself a small tool that generates such configs: https://github.com/indigoviolet/mypy-missing-imports . I think it would be nice for mypy to include something like it, to make the "recommended" path easier to follow.

Pitch

I'm imagining something like

mypy --generate-missing-import-configs <optionally, /path/to/mypy.ini>

which would print out sections for each library identified as a [import] error like

[mypy-foo.*]
ignore_missing_imports = true

If passed a configuration file, it would update the corresponding sections in that file.

I'd be happy to try and add this to mypy if it is useful.

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

1 participant