mypy.ini 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  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/api/test_auth.py
  33. |tests/api/test_ratelimiting.py
  34. |tests/app/test_openid_listener.py
  35. |tests/appservice/test_scheduler.py
  36. |tests/events/test_presence_router.py
  37. |tests/events/test_utils.py
  38. |tests/federation/test_federation_catch_up.py
  39. |tests/federation/test_federation_sender.py
  40. |tests/federation/transport/test_knocking.py
  41. |tests/handlers/test_typing.py
  42. |tests/http/federation/test_matrix_federation_agent.py
  43. |tests/http/federation/test_srv_resolver.py
  44. |tests/http/test_proxyagent.py
  45. |tests/logging/__init__.py
  46. |tests/logging/test_terse_json.py
  47. |tests/module_api/test_api.py
  48. |tests/push/test_email.py
  49. |tests/push/test_presentable_names.py
  50. |tests/push/test_push_rule_evaluator.py
  51. |tests/rest/client/test_transactions.py
  52. |tests/rest/media/v1/test_media_storage.py
  53. |tests/server.py
  54. |tests/server_notices/test_resource_limits_server_notices.py
  55. |tests/test_state.py
  56. |tests/test_terms_auth.py
  57. )$
  58. [mypy-synapse.federation.transport.client]
  59. disallow_untyped_defs = False
  60. [mypy-synapse.http.client]
  61. disallow_untyped_defs = False
  62. [mypy-synapse.http.matrixfederationclient]
  63. disallow_untyped_defs = False
  64. [mypy-synapse.metrics._reactor_metrics]
  65. disallow_untyped_defs = False
  66. # This module imports select.epoll. That exists on Linux, but doesn't on macOS.
  67. # See https://github.com/matrix-org/synapse/pull/11771.
  68. warn_unused_ignores = False
  69. [mypy-synapse.util.caches.treecache]
  70. disallow_untyped_defs = False
  71. [mypy-synapse.server]
  72. disallow_untyped_defs = False
  73. [mypy-synapse.storage.database]
  74. disallow_untyped_defs = False
  75. [mypy-tests.*]
  76. disallow_untyped_defs = False
  77. [mypy-tests.config.*]
  78. disallow_untyped_defs = True
  79. [mypy-tests.crypto.*]
  80. disallow_untyped_defs = True
  81. [mypy-tests.federation.transport.test_client]
  82. disallow_untyped_defs = True
  83. [mypy-tests.handlers.*]
  84. disallow_untyped_defs = True
  85. [mypy-tests.metrics.*]
  86. disallow_untyped_defs = True
  87. [mypy-tests.push.test_bulk_push_rule_evaluator]
  88. disallow_untyped_defs = True
  89. [mypy-tests.rest.*]
  90. disallow_untyped_defs = True
  91. [mypy-tests.state.test_profile]
  92. disallow_untyped_defs = True
  93. [mypy-tests.storage.*]
  94. disallow_untyped_defs = True
  95. [mypy-tests.test_server]
  96. disallow_untyped_defs = True
  97. [mypy-tests.types.*]
  98. disallow_untyped_defs = True
  99. [mypy-tests.util.caches.*]
  100. disallow_untyped_defs = True
  101. [mypy-tests.util.caches.test_descriptors]
  102. disallow_untyped_defs = False
  103. [mypy-tests.util.*]
  104. disallow_untyped_defs = True
  105. [mypy-tests.utils]
  106. disallow_untyped_defs = True
  107. ;; Dependencies without annotations
  108. ;; Before ignoring a module, check to see if type stubs are available.
  109. ;; The `typeshed` project maintains stubs here:
  110. ;; https://github.com/python/typeshed/tree/master/stubs
  111. ;; and for each package `foo` there's a corresponding `types-foo` package on PyPI,
  112. ;; which we can pull in as a dev dependency by adding to `pyproject.toml`'s
  113. ;; `[tool.poetry.dev-dependencies]` list.
  114. [mypy-authlib.*]
  115. ignore_missing_imports = True
  116. [mypy-canonicaljson]
  117. ignore_missing_imports = True
  118. [mypy-ijson.*]
  119. ignore_missing_imports = True
  120. [mypy-lxml]
  121. ignore_missing_imports = True
  122. [mypy-msgpack]
  123. ignore_missing_imports = True
  124. # Note: WIP stubs available at
  125. # https://github.com/microsoft/python-type-stubs/tree/64934207f523ad6b611e6cfe039d85d7175d7d0d/netaddr
  126. [mypy-netaddr]
  127. ignore_missing_imports = True
  128. [mypy-parameterized.*]
  129. ignore_missing_imports = True
  130. [mypy-pymacaroons.*]
  131. ignore_missing_imports = True
  132. [mypy-pympler.*]
  133. ignore_missing_imports = True
  134. [mypy-rust_python_jaeger_reporter.*]
  135. ignore_missing_imports = True
  136. [mypy-saml2.*]
  137. ignore_missing_imports = True
  138. [mypy-service_identity.*]
  139. ignore_missing_imports = True
  140. [mypy-srvlookup.*]
  141. ignore_missing_imports = True
  142. [mypy-treq.*]
  143. ignore_missing_imports = True
  144. [mypy-incremental.*]
  145. ignore_missing_imports = True
  146. [mypy-setuptools_rust.*]
  147. ignore_missing_imports = True