mypy.ini 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. [mypy]
  2. namespace_packages = True
  3. plugins = pydantic.mypy, mypy_zope:plugin, scripts-dev/mypy_synapse_plugin.py
  4. follow_imports = normal
  5. show_error_codes = True
  6. show_traceback = True
  7. mypy_path = stubs
  8. warn_unreachable = True
  9. local_partial_types = True
  10. no_implicit_optional = True
  11. # Strict checks, see mypy --help
  12. warn_unused_configs = True
  13. # disallow_any_generics = True
  14. disallow_subclassing_any = True
  15. # disallow_untyped_calls = True
  16. disallow_untyped_defs = True
  17. disallow_incomplete_defs = True
  18. # check_untyped_defs = True
  19. # disallow_untyped_decorators = True
  20. warn_redundant_casts = True
  21. warn_unused_ignores = True
  22. # warn_return_any = True
  23. # no_implicit_reexport = True
  24. strict_equality = True
  25. # Run mypy type checking with the minimum supported Python version to catch new usage
  26. # that isn't backwards-compatible (types, overloads, etc).
  27. python_version = 3.8
  28. files =
  29. docker/,
  30. scripts-dev/,
  31. synapse/,
  32. tests/,
  33. build_rust.py
  34. [mypy-synapse.metrics._reactor_metrics]
  35. # This module imports select.epoll. That exists on Linux, but doesn't on macOS.
  36. # See https://github.com/matrix-org/synapse/pull/11771.
  37. warn_unused_ignores = False
  38. [mypy-synapse.util.caches.treecache]
  39. disallow_untyped_defs = False
  40. disallow_incomplete_defs = False
  41. [mypy-synapse.util.manhole]
  42. # This module imports something from Twisted which has a bad annotation in Twisted trunk,
  43. # but is unannotated in Twisted's latest release. We want to type-ignore the problem
  44. # in the twisted trunk job, even though it has no effect on normal mypy runs.
  45. warn_unused_ignores = False
  46. ;; Dependencies without annotations
  47. ;; Before ignoring a module, check to see if type stubs are available.
  48. ;; The `typeshed` project maintains stubs here:
  49. ;; https://github.com/python/typeshed/tree/master/stubs
  50. ;; and for each package `foo` there's a corresponding `types-foo` package on PyPI,
  51. ;; which we can pull in as a dev dependency by adding to `pyproject.toml`'s
  52. ;; `[tool.poetry.dev-dependencies]` list.
  53. # https://github.com/lepture/authlib/issues/460
  54. [mypy-authlib.*]
  55. ignore_missing_imports = True
  56. [mypy-ijson.*]
  57. ignore_missing_imports = True
  58. # https://github.com/msgpack/msgpack-python/issues/448
  59. [mypy-msgpack]
  60. ignore_missing_imports = True
  61. # https://github.com/wolever/parameterized/issues/143
  62. [mypy-parameterized.*]
  63. ignore_missing_imports = True
  64. [mypy-pymacaroons.*]
  65. ignore_missing_imports = True
  66. [mypy-pympler.*]
  67. ignore_missing_imports = True
  68. [mypy-rust_python_jaeger_reporter.*]
  69. ignore_missing_imports = True
  70. [mypy-saml2.*]
  71. ignore_missing_imports = True
  72. [mypy-srvlookup.*]
  73. ignore_missing_imports = True
  74. # https://github.com/twisted/treq/pull/366
  75. [mypy-treq.*]
  76. ignore_missing_imports = True