mypy.ini 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  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. files =
  16. docker/,
  17. scripts-dev/,
  18. synapse/,
  19. tests/,
  20. build_rust.py
  21. # Note: Better exclusion syntax coming in mypy > 0.910
  22. # https://github.com/python/mypy/pull/11329
  23. #
  24. # For now, set the (?x) flag enable "verbose" regexes
  25. # https://docs.python.org/3/library/re.html#re.X
  26. exclude = (?x)
  27. ^(
  28. |synapse/storage/databases/__init__.py
  29. |synapse/storage/databases/main/cache.py
  30. |synapse/storage/schema/
  31. |tests/api/test_auth.py
  32. |tests/api/test_ratelimiting.py
  33. |tests/app/test_openid_listener.py
  34. |tests/appservice/test_scheduler.py
  35. |tests/config/test_cache.py
  36. |tests/config/test_tls.py
  37. |tests/crypto/test_keyring.py
  38. |tests/events/test_presence_router.py
  39. |tests/events/test_utils.py
  40. |tests/federation/test_federation_catch_up.py
  41. |tests/federation/test_federation_sender.py
  42. |tests/federation/transport/test_knocking.py
  43. |tests/handlers/test_typing.py
  44. |tests/http/federation/test_matrix_federation_agent.py
  45. |tests/http/federation/test_srv_resolver.py
  46. |tests/http/test_proxyagent.py
  47. |tests/logging/__init__.py
  48. |tests/logging/test_terse_json.py
  49. |tests/module_api/test_api.py
  50. |tests/push/test_email.py
  51. |tests/push/test_presentable_names.py
  52. |tests/push/test_push_rule_evaluator.py
  53. |tests/rest/client/test_transactions.py
  54. |tests/rest/media/v1/test_media_storage.py
  55. |tests/server.py
  56. |tests/server_notices/test_resource_limits_server_notices.py
  57. |tests/test_state.py
  58. |tests/test_terms_auth.py
  59. |tests/util/caches/test_cached_call.py
  60. |tests/util/caches/test_deferred_cache.py
  61. |tests/util/caches/test_descriptors.py
  62. |tests/util/caches/test_response_cache.py
  63. |tests/util/caches/test_ttlcache.py
  64. |tests/util/test_async_helpers.py
  65. |tests/util/test_batching_queue.py
  66. |tests/util/test_dict_cache.py
  67. |tests/util/test_expiring_cache.py
  68. |tests/util/test_file_consumer.py
  69. |tests/util/test_linearizer.py
  70. |tests/util/test_logcontext.py
  71. |tests/util/test_lrucache.py
  72. |tests/util/test_rwlock.py
  73. |tests/util/test_wheel_timer.py
  74. )$
  75. [mypy-synapse.federation.transport.client]
  76. disallow_untyped_defs = False
  77. [mypy-synapse.http.client]
  78. disallow_untyped_defs = False
  79. [mypy-synapse.http.matrixfederationclient]
  80. disallow_untyped_defs = False
  81. [mypy-synapse.metrics._reactor_metrics]
  82. disallow_untyped_defs = False
  83. # This module imports select.epoll. That exists on Linux, but doesn't on macOS.
  84. # See https://github.com/matrix-org/synapse/pull/11771.
  85. warn_unused_ignores = False
  86. [mypy-synapse.util.caches.treecache]
  87. disallow_untyped_defs = False
  88. [mypy-synapse.server]
  89. disallow_untyped_defs = False
  90. [mypy-synapse.storage.database]
  91. disallow_untyped_defs = False
  92. [mypy-tests.*]
  93. disallow_untyped_defs = False
  94. [mypy-tests.handlers.test_user_directory]
  95. disallow_untyped_defs = True
  96. [mypy-tests.metrics.test_background_process_metrics]
  97. disallow_untyped_defs = True
  98. [mypy-tests.push.test_bulk_push_rule_evaluator]
  99. disallow_untyped_defs = True
  100. [mypy-tests.test_server]
  101. disallow_untyped_defs = True
  102. [mypy-tests.state.test_profile]
  103. disallow_untyped_defs = True
  104. [mypy-tests.storage.test_id_generators]
  105. disallow_untyped_defs = True
  106. [mypy-tests.storage.test_profile]
  107. disallow_untyped_defs = True
  108. [mypy-tests.storage.test_user_directory]
  109. disallow_untyped_defs = True
  110. [mypy-tests.rest.*]
  111. disallow_untyped_defs = True
  112. [mypy-tests.federation.transport.test_client]
  113. disallow_untyped_defs = True
  114. [mypy-tests.utils]
  115. disallow_untyped_defs = True
  116. ;; Dependencies without annotations
  117. ;; Before ignoring a module, check to see if type stubs are available.
  118. ;; The `typeshed` project maintains stubs here:
  119. ;; https://github.com/python/typeshed/tree/master/stubs
  120. ;; and for each package `foo` there's a corresponding `types-foo` package on PyPI,
  121. ;; which we can pull in as a dev dependency by adding to `pyproject.toml`'s
  122. ;; `[tool.poetry.dev-dependencies]` list.
  123. [mypy-authlib.*]
  124. ignore_missing_imports = True
  125. [mypy-canonicaljson]
  126. ignore_missing_imports = True
  127. [mypy-ijson.*]
  128. ignore_missing_imports = True
  129. [mypy-lxml]
  130. ignore_missing_imports = True
  131. [mypy-msgpack]
  132. ignore_missing_imports = True
  133. # Note: WIP stubs available at
  134. # https://github.com/microsoft/python-type-stubs/tree/64934207f523ad6b611e6cfe039d85d7175d7d0d/netaddr
  135. [mypy-netaddr]
  136. ignore_missing_imports = True
  137. [mypy-parameterized.*]
  138. ignore_missing_imports = True
  139. [mypy-pymacaroons.*]
  140. ignore_missing_imports = True
  141. [mypy-pympler.*]
  142. ignore_missing_imports = True
  143. [mypy-saml2.*]
  144. ignore_missing_imports = True
  145. [mypy-service_identity.*]
  146. ignore_missing_imports = True
  147. [mypy-srvlookup.*]
  148. ignore_missing_imports = True
  149. [mypy-treq.*]
  150. ignore_missing_imports = True
  151. [mypy-incremental.*]
  152. ignore_missing_imports = True
  153. [mypy-setuptools_rust.*]
  154. ignore_missing_imports = True