mypy.ini 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. [mypy]
  2. namespace_packages = True
  3. plugins = pydantic.mypy, mypy_zope:plugin, scripts-dev/mypy_synapse_plugin.py
  4. follow_imports = normal
  5. check_untyped_defs = True
  6. show_error_codes = True
  7. show_traceback = True
  8. mypy_path = stubs
  9. warn_unreachable = True
  10. warn_unused_ignores = True
  11. local_partial_types = True
  12. no_implicit_optional = True
  13. disallow_untyped_defs = True
  14. strict_equality = True
  15. warn_redundant_casts = True
  16. files =
  17. docker/,
  18. scripts-dev/,
  19. synapse/,
  20. tests/,
  21. build_rust.py
  22. # Note: Better exclusion syntax coming in mypy > 0.910
  23. # https://github.com/python/mypy/pull/11329
  24. #
  25. # For now, set the (?x) flag enable "verbose" regexes
  26. # https://docs.python.org/3/library/re.html#re.X
  27. exclude = (?x)
  28. ^(
  29. |synapse/storage/databases/__init__.py
  30. |synapse/storage/databases/main/cache.py
  31. |synapse/storage/schema/
  32. |tests/federation/test_federation_catch_up.py
  33. |tests/federation/test_federation_sender.py
  34. |tests/http/federation/test_matrix_federation_agent.py
  35. |tests/http/federation/test_srv_resolver.py
  36. |tests/http/test_proxyagent.py
  37. |tests/module_api/test_api.py
  38. |tests/rest/media/v1/test_media_storage.py
  39. |tests/server.py
  40. |tests/test_state.py
  41. |tests/test_terms_auth.py
  42. )$
  43. [mypy-synapse.federation.transport.client]
  44. disallow_untyped_defs = False
  45. [mypy-synapse.http.client]
  46. disallow_untyped_defs = False
  47. [mypy-synapse.http.matrixfederationclient]
  48. disallow_untyped_defs = False
  49. [mypy-synapse.metrics._reactor_metrics]
  50. disallow_untyped_defs = False
  51. # This module imports select.epoll. That exists on Linux, but doesn't on macOS.
  52. # See https://github.com/matrix-org/synapse/pull/11771.
  53. warn_unused_ignores = False
  54. [mypy-synapse.util.caches.treecache]
  55. disallow_untyped_defs = False
  56. [mypy-synapse.server]
  57. disallow_untyped_defs = False
  58. [mypy-synapse.storage.database]
  59. disallow_untyped_defs = False
  60. [mypy-tests.*]
  61. disallow_untyped_defs = False
  62. [mypy-tests.api.*]
  63. disallow_untyped_defs = True
  64. [mypy-tests.app.*]
  65. disallow_untyped_defs = True
  66. [mypy-tests.appservice.*]
  67. disallow_untyped_defs = True
  68. [mypy-tests.config.*]
  69. disallow_untyped_defs = True
  70. [mypy-tests.crypto.*]
  71. disallow_untyped_defs = True
  72. [mypy-tests.events.*]
  73. disallow_untyped_defs = True
  74. [mypy-tests.federation.transport.test_client]
  75. disallow_untyped_defs = True
  76. [mypy-tests.handlers.*]
  77. disallow_untyped_defs = True
  78. [mypy-tests.logging.*]
  79. disallow_untyped_defs = True
  80. [mypy-tests.metrics.*]
  81. disallow_untyped_defs = True
  82. [mypy-tests.push.*]
  83. disallow_untyped_defs = True
  84. [mypy-tests.rest.*]
  85. disallow_untyped_defs = True
  86. [mypy-tests.state.test_profile]
  87. disallow_untyped_defs = True
  88. [mypy-tests.storage.*]
  89. disallow_untyped_defs = True
  90. [mypy-tests.test_server]
  91. disallow_untyped_defs = True
  92. [mypy-tests.types.*]
  93. disallow_untyped_defs = True
  94. [mypy-tests.util.caches.*]
  95. disallow_untyped_defs = True
  96. [mypy-tests.util.caches.test_descriptors]
  97. disallow_untyped_defs = False
  98. [mypy-tests.util.*]
  99. disallow_untyped_defs = True
  100. [mypy-tests.utils]
  101. disallow_untyped_defs = True
  102. ;; Dependencies without annotations
  103. ;; Before ignoring a module, check to see if type stubs are available.
  104. ;; The `typeshed` project maintains stubs here:
  105. ;; https://github.com/python/typeshed/tree/master/stubs
  106. ;; and for each package `foo` there's a corresponding `types-foo` package on PyPI,
  107. ;; which we can pull in as a dev dependency by adding to `pyproject.toml`'s
  108. ;; `[tool.poetry.dev-dependencies]` list.
  109. [mypy-authlib.*]
  110. ignore_missing_imports = True
  111. [mypy-ijson.*]
  112. ignore_missing_imports = True
  113. [mypy-lxml]
  114. ignore_missing_imports = True
  115. [mypy-msgpack]
  116. ignore_missing_imports = True
  117. # Note: WIP stubs available at
  118. # https://github.com/microsoft/python-type-stubs/tree/64934207f523ad6b611e6cfe039d85d7175d7d0d/netaddr
  119. [mypy-netaddr]
  120. ignore_missing_imports = True
  121. [mypy-parameterized.*]
  122. ignore_missing_imports = True
  123. [mypy-pymacaroons.*]
  124. ignore_missing_imports = True
  125. [mypy-pympler.*]
  126. ignore_missing_imports = True
  127. [mypy-rust_python_jaeger_reporter.*]
  128. ignore_missing_imports = True
  129. [mypy-saml2.*]
  130. ignore_missing_imports = True
  131. [mypy-service_identity.*]
  132. ignore_missing_imports = True
  133. [mypy-srvlookup.*]
  134. ignore_missing_imports = True
  135. [mypy-treq.*]
  136. ignore_missing_imports = True
  137. [mypy-incremental.*]
  138. ignore_missing_imports = True
  139. [mypy-setuptools_rust.*]
  140. ignore_missing_imports = True