mypy

单行配置

<error code>  # type: ignore[assignment]  # 其他的注释

配置

[mypy]
plugins =
    mypy_django_plugin.main

exclude = (?x)(
    ^one\.py$    # files named "one.py"
    | two\.pyi$  # or files ending with "two.pyi"
    | ^three\.   # or files starting with "three."
  )

[mypy.plugins.django-stubs]
django_settings_module = "project.settings"
strict_settings = false
  • exclude 排除的时候还要再设置

[mypy-examples.*]
follow_imports = skip

stack overflow的问题