Skip to content

Manage ignore_missing_imports = true sections configs automatically #10044

Open

Description

@indigoviolet

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions