mypy.ini 5.1 KB

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