Is there a way to totally ignore all of the MyPy errors in specific project packages?

Sal*_*ley 12 python type-hinting mypy

Is there a way to ignore all of the errors in certain packages within my project?

Some of the code in my project is compiled Protocol Buffers code which doesn't pass a MyPy check. It all lives within a directory /myproj/generated/proto.

Here's what I have in my mypy config file:

[mypy-myproject.generated]
ignore_missing_imports = True
ignore_errors = True
Run Code Online (Sandbox Code Playgroud)

What can I add to this to make it ignore all error messages generated from an analysis of anything that's inside of myproject.generated?

This is a duplicate of a question on GitHub.

小智 10

您可以使用 glob。

[mypy-myproject.generated.*]
ignore_errors = True
Run Code Online (Sandbox Code Playgroud)

但你必须确保你__init__.py/generated