mypy.ini 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  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/app/test_openid_listener.py
  34. |tests/appservice/test_scheduler.py
  35. |tests/events/test_presence_router.py
  36. |tests/events/test_utils.py
  37. |tests/federation/test_federation_catch_up.py
  38. |tests/federation/test_federation_sender.py
  39. |tests/federation/transport/test_knocking.py
  40. |tests/handlers/test_typing.py
  41. |tests/http/federation/test_matrix_federation_agent.py
  42. |tests/http/federation/test_srv_resolver.py
  43. |tests/http/test_proxyagent.py
  44. |tests/logging/__init__.py
  45. |tests/logging/test_terse_json.py
  46. |tests/module_api/test_api.py
  47. |tests/rest/client/test_transactions.py
  48. |tests/rest/media/v1/test_media_storage.py
  49. |tests/server.py
  50. |tests/test_state.py
  51. |tests/test_terms_auth.py
  52. )$
  53. [mypy-synapse.federation.transport.client]
  54. disallow_untyped_defs = False
  55. [mypy-synapse.http.client]
  56. disallow_untyped_defs = False
  57. [mypy-synapse.http.matrixfederationclient]
  58. disallow_untyped_defs = False
  59. [mypy-synapse.metrics._reactor_metrics]
  60. disallow_untyped_defs = False
  61. # This module imports select.epoll. That exists on Linux, but doesn't on macOS.
  62. # See https://github.com/matrix-org/synapse/pull/11771.
  63. warn_unused_ignores = False
  64. [mypy-synapse.util.caches.treecache]
  65. disallow_untyped_defs = False
  66. [mypy-synapse.server]
  67. disallow_untyped_defs = False
  68. [mypy-synapse.storage.database]
  69. disallow_untyped_defs = False
  70. [mypy-tests.*]
  71. disallow_untyped_defs = False
  72. [mypy-tests.config.*]
  73. disallow_untyped_defs = True
  74. [mypy-tests.crypto.*]
  75. disallow_untyped_defs = True
  76. [mypy-tests.federation.transport.test_client]
  77. disallow_untyped_defs = True
  78. [mypy-tests.handlers.*]
  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-canonicaljson]
  112. ignore_missing_imports = True
  113. [mypy-ijson.*]
  114. ignore_missing_imports = True
  115. [mypy-lxml]
  116. ignore_missing_imports = True
  117. [mypy-msgpack]
  118. ignore_missing_imports = True
  119. # Note: WIP stubs available at
  120. # https://github.com/microsoft/python-type-stubs/tree/64934207f523ad6b611e6cfe039d85d7175d7d0d/netaddr
  121. [mypy-netaddr]
  122. ignore_missing_imports = True
  123. [mypy-parameterized.*]
  124. ignore_missing_imports = True
  125. [mypy-pymacaroons.*]
  126. ignore_missing_imports = True
  127. [mypy-pympler.*]
  128. ignore_missing_imports = True
  129. [mypy-rust_python_jaeger_reporter.*]
  130. ignore_missing_imports = True
  131. [mypy-saml2.*]
  132. ignore_missing_imports = True
  133. [mypy-service_identity.*]
  134. ignore_missing_imports = True
  135. [mypy-srvlookup.*]
  136. ignore_missing_imports = True
  137. [mypy-treq.*]
  138. ignore_missing_imports = True
  139. [mypy-incremental.*]
  140. ignore_missing_imports = True
  141. [mypy-setuptools_rust.*]
  142. ignore_missing_imports = True