1[mypy]
2namespace_packages = True
3plugins = mypy_zope:plugin, scripts-dev/mypy_synapse_plugin.py
4follow_imports = normal
5check_untyped_defs = True
6show_error_codes = True
7show_traceback = True
8mypy_path = stubs
9warn_unreachable = True
10local_partial_types = True
11no_implicit_optional = True
12
13files =
14  scripts-dev/sign_json,
15  setup.py,
16  synapse/,
17  tests/
18
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
24exclude = (?x)
25  ^(
26   |synapse/storage/databases/__init__.py
27   |synapse/storage/databases/main/__init__.py
28   |synapse/storage/databases/main/cache.py
29   |synapse/storage/databases/main/devices.py
30   |synapse/storage/databases/main/event_federation.py
31   |synapse/storage/databases/main/group_server.py
32   |synapse/storage/databases/main/metrics.py
33   |synapse/storage/databases/main/monthly_active_users.py
34   |synapse/storage/databases/main/presence.py
35   |synapse/storage/databases/main/purge_events.py
36   |synapse/storage/databases/main/push_rule.py
37   |synapse/storage/databases/main/receipts.py
38   |synapse/storage/databases/main/roommember.py
39   |synapse/storage/databases/main/search.py
40   |synapse/storage/databases/main/state.py
41   |synapse/storage/databases/main/user_directory.py
42   |synapse/storage/schema/
43
44   |tests/api/test_auth.py
45   |tests/api/test_ratelimiting.py
46   |tests/app/test_openid_listener.py
47   |tests/appservice/test_scheduler.py
48   |tests/config/test_cache.py
49   |tests/config/test_tls.py
50   |tests/crypto/test_keyring.py
51   |tests/events/test_presence_router.py
52   |tests/events/test_utils.py
53   |tests/federation/test_federation_catch_up.py
54   |tests/federation/test_federation_sender.py
55   |tests/federation/test_federation_server.py
56   |tests/federation/transport/test_knocking.py
57   |tests/federation/transport/test_server.py
58   |tests/handlers/test_cas.py
59   |tests/handlers/test_directory.py
60   |tests/handlers/test_e2e_keys.py
61   |tests/handlers/test_federation.py
62   |tests/handlers/test_oidc.py
63   |tests/handlers/test_presence.py
64   |tests/handlers/test_profile.py
65   |tests/handlers/test_saml.py
66   |tests/handlers/test_typing.py
67   |tests/http/federation/test_matrix_federation_agent.py
68   |tests/http/federation/test_srv_resolver.py
69   |tests/http/test_fedclient.py
70   |tests/http/test_proxyagent.py
71   |tests/http/test_servlet.py
72   |tests/http/test_site.py
73   |tests/logging/__init__.py
74   |tests/logging/test_terse_json.py
75   |tests/module_api/test_api.py
76   |tests/push/test_email.py
77   |tests/push/test_http.py
78   |tests/push/test_presentable_names.py
79   |tests/push/test_push_rule_evaluator.py
80   |tests/rest/admin/test_admin.py
81   |tests/rest/admin/test_user.py
82   |tests/rest/admin/test_username_available.py
83   |tests/rest/client/test_account.py
84   |tests/rest/client/test_events.py
85   |tests/rest/client/test_filter.py
86   |tests/rest/client/test_groups.py
87   |tests/rest/client/test_register.py
88   |tests/rest/client/test_report_event.py
89   |tests/rest/client/test_rooms.py
90   |tests/rest/client/test_third_party_rules.py
91   |tests/rest/client/test_transactions.py
92   |tests/rest/client/test_typing.py
93   |tests/rest/client/utils.py
94   |tests/rest/key/v2/test_remote_key_resource.py
95   |tests/rest/media/v1/test_base.py
96   |tests/rest/media/v1/test_media_storage.py
97   |tests/rest/media/v1/test_url_preview.py
98   |tests/scripts/test_new_matrix_user.py
99   |tests/server.py
100   |tests/server_notices/test_resource_limits_server_notices.py
101   |tests/state/test_v2.py
102   |tests/storage/test_background_update.py
103   |tests/storage/test_base.py
104   |tests/storage/test_client_ips.py
105   |tests/storage/test_database.py
106   |tests/storage/test_event_federation.py
107   |tests/storage/test_id_generators.py
108   |tests/storage/test_roommember.py
109   |tests/test_metrics.py
110   |tests/test_phone_home.py
111   |tests/test_server.py
112   |tests/test_state.py
113   |tests/test_terms_auth.py
114   |tests/unittest.py
115   |tests/util/caches/test_cached_call.py
116   |tests/util/caches/test_deferred_cache.py
117   |tests/util/caches/test_descriptors.py
118   |tests/util/caches/test_response_cache.py
119   |tests/util/caches/test_ttlcache.py
120   |tests/util/test_async_helpers.py
121   |tests/util/test_batching_queue.py
122   |tests/util/test_dict_cache.py
123   |tests/util/test_expiring_cache.py
124   |tests/util/test_file_consumer.py
125   |tests/util/test_linearizer.py
126   |tests/util/test_logcontext.py
127   |tests/util/test_lrucache.py
128   |tests/util/test_rwlock.py
129   |tests/util/test_wheel_timer.py
130   |tests/utils.py
131   )$
132
133[mypy-synapse.api.*]
134disallow_untyped_defs = True
135
136[mypy-synapse.app.*]
137disallow_untyped_defs = True
138
139[mypy-synapse.appservice.*]
140disallow_untyped_defs = True
141
142[mypy-synapse.config._base]
143disallow_untyped_defs = True
144
145[mypy-synapse.crypto.*]
146disallow_untyped_defs = True
147
148[mypy-synapse.events.*]
149disallow_untyped_defs = True
150
151[mypy-synapse.federation.*]
152disallow_untyped_defs = True
153
154[mypy-synapse.federation.transport.client]
155disallow_untyped_defs = False
156
157[mypy-synapse.handlers.*]
158disallow_untyped_defs = True
159
160[mypy-synapse.http.server]
161disallow_untyped_defs = True
162
163[mypy-synapse.logging.context]
164disallow_untyped_defs = True
165
166[mypy-synapse.metrics.*]
167disallow_untyped_defs = True
168
169[mypy-synapse.module_api.*]
170disallow_untyped_defs = True
171
172[mypy-synapse.push.*]
173disallow_untyped_defs = True
174
175[mypy-synapse.rest.*]
176disallow_untyped_defs = True
177
178[mypy-synapse.server_notices.*]
179disallow_untyped_defs = True
180
181[mypy-synapse.state.*]
182disallow_untyped_defs = True
183
184[mypy-synapse.storage.databases.main.account_data]
185disallow_untyped_defs = True
186
187[mypy-synapse.storage.databases.main.client_ips]
188disallow_untyped_defs = True
189
190[mypy-synapse.storage.databases.main.directory]
191disallow_untyped_defs = True
192
193[mypy-synapse.storage.databases.main.e2e_room_keys]
194disallow_untyped_defs = True
195
196[mypy-synapse.storage.databases.main.end_to_end_keys]
197disallow_untyped_defs = True
198
199[mypy-synapse.storage.databases.main.event_push_actions]
200disallow_untyped_defs = True
201
202[mypy-synapse.storage.databases.main.events_bg_updates]
203disallow_untyped_defs = True
204
205[mypy-synapse.storage.databases.main.events_worker]
206disallow_untyped_defs = True
207
208[mypy-synapse.storage.databases.main.room]
209disallow_untyped_defs = True
210
211[mypy-synapse.storage.databases.main.room_batch]
212disallow_untyped_defs = True
213
214[mypy-synapse.storage.databases.main.profile]
215disallow_untyped_defs = True
216
217[mypy-synapse.storage.databases.main.stats]
218disallow_untyped_defs = True
219
220[mypy-synapse.storage.databases.main.state_deltas]
221disallow_untyped_defs = True
222
223[mypy-synapse.storage.databases.main.transactions]
224disallow_untyped_defs = True
225
226[mypy-synapse.storage.databases.main.user_erasure_store]
227disallow_untyped_defs = True
228
229[mypy-synapse.storage.util.*]
230disallow_untyped_defs = True
231
232[mypy-synapse.streams.*]
233disallow_untyped_defs = True
234
235[mypy-synapse.util.*]
236disallow_untyped_defs = True
237
238[mypy-synapse.util.caches.treecache]
239disallow_untyped_defs = False
240
241[mypy-tests.handlers.test_user_directory]
242disallow_untyped_defs = True
243
244[mypy-tests.storage.test_profile]
245disallow_untyped_defs = True
246
247[mypy-tests.storage.test_user_directory]
248disallow_untyped_defs = True
249
250[mypy-tests.rest.admin.*]
251disallow_untyped_defs = True
252
253[mypy-tests.rest.client.test_directory]
254disallow_untyped_defs = True
255
256[mypy-tests.federation.transport.test_client]
257disallow_untyped_defs = True
258
259
260;; Dependencies without annotations
261;; Before ignoring a module, check to see if type stubs are available.
262;; The `typeshed` project maintains stubs here:
263;;     https://github.com/python/typeshed/tree/master/stubs
264;; and for each package `foo` there's a corresponding `types-foo` package on PyPI,
265;; which we can pull in as a dev dependency by adding to `setup.py`'s
266;; `CONDITIONAL_REQUIREMENTS["mypy"]` list.
267
268[mypy-authlib.*]
269ignore_missing_imports = True
270
271[mypy-bcrypt]
272ignore_missing_imports = True
273
274[mypy-canonicaljson]
275ignore_missing_imports = True
276
277[mypy-constantly]
278ignore_missing_imports = True
279
280[mypy-daemonize]
281ignore_missing_imports = True
282
283[mypy-h11]
284ignore_missing_imports = True
285
286[mypy-hiredis]
287ignore_missing_imports = True
288
289[mypy-hyperlink]
290ignore_missing_imports = True
291
292[mypy-ijson.*]
293ignore_missing_imports = True
294
295[mypy-jaeger_client.*]
296ignore_missing_imports = True
297
298[mypy-josepy.*]
299ignore_missing_imports = True
300
301[mypy-jwt.*]
302ignore_missing_imports = True
303
304[mypy-lxml]
305ignore_missing_imports = True
306
307[mypy-msgpack]
308ignore_missing_imports = True
309
310[mypy-nacl.*]
311ignore_missing_imports = True
312
313[mypy-netaddr]
314ignore_missing_imports = True
315
316[mypy-parameterized.*]
317ignore_missing_imports = True
318
319[mypy-phonenumbers.*]
320ignore_missing_imports = True
321
322[mypy-prometheus_client.*]
323ignore_missing_imports = True
324
325[mypy-pymacaroons.*]
326ignore_missing_imports = True
327
328[mypy-pympler.*]
329ignore_missing_imports = True
330
331[mypy-rust_python_jaeger_reporter.*]
332ignore_missing_imports = True
333
334[mypy-saml2.*]
335ignore_missing_imports = True
336
337[mypy-sentry_sdk]
338ignore_missing_imports = True
339
340[mypy-service_identity.*]
341ignore_missing_imports = True
342
343[mypy-signedjson.*]
344ignore_missing_imports = True
345
346[mypy-treq.*]
347ignore_missing_imports = True
348
349[mypy-twisted.*]
350ignore_missing_imports = True
351
352[mypy-zope]
353ignore_missing_imports = True
354