Manage `ignore_missing_imports = true` sections configs automatically
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 20.6k
- Forks
- 3.3k
- PR merge metrics
- PR metrics pending
Description
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with mypy's command-line handling and configuration processing, using the proposed mypy --generate-missing-import-configs command and optional mypy.ini input as entry points. Review the referenced mypy-missing-imports tool for the intended behavior. Done means generating or updating per-library sections such as [mypy-foo.*] with ignore_missing_imports = true.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100