summary refs log tree commit diff
path: root/mypy.ini
blob: 468bfe588ccc52aab03872ed75a2b540a57b41c1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
[mypy]
namespace_packages = True
plugins = pydantic.mypy, mypy_zope:plugin, scripts-dev/mypy_synapse_plugin.py
follow_imports = normal
check_untyped_defs = True
show_error_codes = True
show_traceback = True
mypy_path = stubs
warn_unreachable = True
warn_unused_ignores = True
local_partial_types = True
no_implicit_optional = True
disallow_untyped_defs = True
strict_equality = True
warn_redundant_casts = True

files =
  docker/,
  scripts-dev/,
  synapse/,
  tests/,
  build_rust.py

# Note: Better exclusion syntax coming in mypy > 0.910
# https://github.com/python/mypy/pull/11329
#
# For now, set the (?x) flag enable "verbose" regexes
# https://docs.python.org/3/library/re.html#re.X
exclude = (?x)
  ^(
   |synapse/storage/databases/__init__.py
   |synapse/storage/databases/main/cache.py
   |synapse/storage/schema/

   |tests/api/test_auth.py
   |tests/api/test_ratelimiting.py
   |tests/app/test_openid_listener.py
   |tests/appservice/test_scheduler.py
   |tests/events/test_presence_router.py
   |tests/events/test_utils.py
   |tests/federation/test_federation_catch_up.py
   |tests/federation/test_federation_sender.py
   |tests/federation/transport/test_knocking.py
   |tests/handlers/test_typing.py
   |tests/http/federation/test_matrix_federation_agent.py
   |tests/http/federation/test_srv_resolver.py
   |tests/http/test_proxyagent.py
   |tests/logging/__init__.py
   |tests/logging/test_terse_json.py
   |tests/module_api/test_api.py
   |tests/rest/client/test_transactions.py
   |tests/rest/media/v1/test_media_storage.py
   |tests/server.py
   |tests/server_notices/test_resource_limits_server_notices.py
   |tests/test_state.py
   |tests/test_terms_auth.py
   )$

[mypy-synapse.federation.transport.client]
disallow_untyped_defs = False

[mypy-synapse.http.client]
disallow_untyped_defs = False

[mypy-synapse.http.matrixfederationclient]
disallow_untyped_defs = False

[mypy-synapse.metrics._reactor_metrics]
disallow_untyped_defs = False
# This module imports select.epoll. That exists on Linux, but doesn't on macOS.
# See https://github.com/matrix-org/synapse/pull/11771.
warn_unused_ignores = False

[mypy-synapse.util.caches.treecache]
disallow_untyped_defs = False

[mypy-synapse.server]
disallow_untyped_defs = False

[mypy-synapse.storage.database]
disallow_untyped_defs = False

[mypy-tests.*]
disallow_untyped_defs = False

[mypy-tests.config.*]
disallow_untyped_defs = True

[mypy-tests.crypto.*]
disallow_untyped_defs = True

[mypy-tests.federation.transport.test_client]
disallow_untyped_defs = True

[mypy-tests.handlers.*]
disallow_untyped_defs = True

[mypy-tests.metrics.*]
disallow_untyped_defs = True

[mypy-tests.push.*]
disallow_untyped_defs = True

[mypy-tests.rest.*]
disallow_untyped_defs = True

[mypy-tests.state.test_profile]
disallow_untyped_defs = True

[mypy-tests.storage.*]
disallow_untyped_defs = True

[mypy-tests.test_server]
disallow_untyped_defs = True

[mypy-tests.types.*]
disallow_untyped_defs = True

[mypy-tests.util.caches.*]
disallow_untyped_defs = True

[mypy-tests.util.caches.test_descriptors]
disallow_untyped_defs = False

[mypy-tests.util.*]
disallow_untyped_defs = True

[mypy-tests.utils]
disallow_untyped_defs = True

;; Dependencies without annotations
;; Before ignoring a module, check to see if type stubs are available.
;; The `typeshed` project maintains stubs here:
;;     https://github.com/python/typeshed/tree/master/stubs
;; and for each package `foo` there's a corresponding `types-foo` package on PyPI,
;; which we can pull in as a dev dependency by adding to `pyproject.toml`'s
;; `[tool.poetry.dev-dependencies]` list.

[mypy-authlib.*]
ignore_missing_imports = True

[mypy-canonicaljson]
ignore_missing_imports = True

[mypy-ijson.*]
ignore_missing_imports = True

[mypy-lxml]
ignore_missing_imports = True

[mypy-msgpack]
ignore_missing_imports = True

# Note: WIP stubs available at
# https://github.com/microsoft/python-type-stubs/tree/64934207f523ad6b611e6cfe039d85d7175d7d0d/netaddr
[mypy-netaddr]
ignore_missing_imports = True

[mypy-parameterized.*]
ignore_missing_imports = True

[mypy-pymacaroons.*]
ignore_missing_imports = True

[mypy-pympler.*]
ignore_missing_imports = True

[mypy-rust_python_jaeger_reporter.*]
ignore_missing_imports = True

[mypy-saml2.*]
ignore_missing_imports = True

[mypy-service_identity.*]
ignore_missing_imports = True

[mypy-srvlookup.*]
ignore_missing_imports = True

[mypy-treq.*]
ignore_missing_imports = True

[mypy-incremental.*]
ignore_missing_imports = True

[mypy-setuptools_rust.*]
ignore_missing_imports = True