From 5f139b896c36af04ad3ed13668b68c9fbee97dba Mon Sep 17 00:00:00 2001 From: David Robertson Date: Mon, 2 May 2022 23:34:35 +0100 Subject: [PATCH 01/20] Make use of canonicaljson's type annotations Added by me in canonicaljson 1.6.1. --- mypy.ini | 3 --- poetry.lock | 7 ++++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/mypy.ini b/mypy.ini index ef28216418a5..2b46aa8df502 100644 --- a/mypy.ini +++ b/mypy.ini @@ -244,9 +244,6 @@ ignore_missing_imports = True [mypy-bcrypt] ignore_missing_imports = True -[mypy-canonicaljson] -ignore_missing_imports = True - [mypy-constantly] ignore_missing_imports = True diff --git a/poetry.lock b/poetry.lock index e27a44989cd4..c14182515aef 100644 --- a/poetry.lock +++ b/poetry.lock @@ -95,7 +95,7 @@ webencodings = "*" [[package]] name = "canonicaljson" -version = "1.6.0" +version = "1.6.1" description = "Canonical JSON" category = "main" optional = false @@ -103,6 +103,7 @@ python-versions = "~=3.7" [package.dependencies] simplejson = ">=3.14.0" +typing-extensions = {version = ">=4.0.0", markers = "python_version < \"3.8\""} [package.extras] frozendict = ["frozendict (>=1.0)"] @@ -1619,8 +1620,8 @@ bleach = [ {file = "bleach-4.1.0.tar.gz", hash = "sha256:0900d8b37eba61a802ee40ac0061f8c2b5dee29c1927dd1d233e075ebf5a71da"}, ] canonicaljson = [ - {file = "canonicaljson-1.6.0-py3-none-any.whl", hash = "sha256:7230c2a2a3db07874f622af84effe41a655e07bf23734830e18a454e65d5b998"}, - {file = "canonicaljson-1.6.0.tar.gz", hash = "sha256:8739d5fd91aca7281d425660ae65af7663808c8177778965f67e90b16a2b2427"}, + {file = "canonicaljson-1.6.1-py3-none-any.whl", hash = "sha256:9ccf1079a928b520b9b7dd8567f842ca44d1877d8b6540b83254b8a6ac6cfc11"}, + {file = "canonicaljson-1.6.1.tar.gz", hash = "sha256:a93664f698556dbd4bab9c3fc4fb35834cf2535da1ea00b6b7758d8fe2bbb824"}, ] certifi = [ {file = "certifi-2021.10.8-py2.py3-none-any.whl", hash = "sha256:d62a0163eb4c2344ac042ab2bdf75399a71a2d8c7d47eac2e2ee91b9d6339569"}, From 4241e29d97cf687c63cdcf1c23b9f67bfbaec3fd Mon Sep 17 00:00:00 2001 From: David Robertson Date: Mon, 2 May 2022 23:47:23 +0100 Subject: [PATCH 02/20] The locked version of bcrypt has annotations --- mypy.ini | 3 --- 1 file changed, 3 deletions(-) diff --git a/mypy.ini b/mypy.ini index 2b46aa8df502..f4f09a559944 100644 --- a/mypy.ini +++ b/mypy.ini @@ -241,9 +241,6 @@ disallow_untyped_defs = True [mypy-authlib.*] ignore_missing_imports = True -[mypy-bcrypt] -ignore_missing_imports = True - [mypy-constantly] ignore_missing_imports = True From 6162b2c3fdb1742c08bde3cc05343ff63c3129c5 Mon Sep 17 00:00:00 2001 From: David Robertson Date: Tue, 3 May 2022 00:03:05 +0100 Subject: [PATCH 03/20] We haven't used `daemonize` since #8011. --- mypy.ini | 3 --- 1 file changed, 3 deletions(-) diff --git a/mypy.ini b/mypy.ini index f4f09a559944..b0060aa9936e 100644 --- a/mypy.ini +++ b/mypy.ini @@ -244,9 +244,6 @@ ignore_missing_imports = True [mypy-constantly] ignore_missing_imports = True -[mypy-daemonize] -ignore_missing_imports = True - [mypy-h11] ignore_missing_imports = True From 14c4458280386650819657d737587e286f3d7417 Mon Sep 17 00:00:00 2001 From: David Robertson Date: Tue, 3 May 2022 00:03:50 +0100 Subject: [PATCH 04/20] Revert "Make use of canonicaljson's type annotations" This reverts commit 5f139b896c36af04ad3ed13668b68c9fbee97dba. --- mypy.ini | 3 +++ poetry.lock | 7 +++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/mypy.ini b/mypy.ini index b0060aa9936e..05d6ecdf2319 100644 --- a/mypy.ini +++ b/mypy.ini @@ -241,6 +241,9 @@ disallow_untyped_defs = True [mypy-authlib.*] ignore_missing_imports = True +[mypy-canonicaljson] +ignore_missing_imports = True + [mypy-constantly] ignore_missing_imports = True diff --git a/poetry.lock b/poetry.lock index c14182515aef..e27a44989cd4 100644 --- a/poetry.lock +++ b/poetry.lock @@ -95,7 +95,7 @@ webencodings = "*" [[package]] name = "canonicaljson" -version = "1.6.1" +version = "1.6.0" description = "Canonical JSON" category = "main" optional = false @@ -103,7 +103,6 @@ python-versions = "~=3.7" [package.dependencies] simplejson = ">=3.14.0" -typing-extensions = {version = ">=4.0.0", markers = "python_version < \"3.8\""} [package.extras] frozendict = ["frozendict (>=1.0)"] @@ -1620,8 +1619,8 @@ bleach = [ {file = "bleach-4.1.0.tar.gz", hash = "sha256:0900d8b37eba61a802ee40ac0061f8c2b5dee29c1927dd1d233e075ebf5a71da"}, ] canonicaljson = [ - {file = "canonicaljson-1.6.1-py3-none-any.whl", hash = "sha256:9ccf1079a928b520b9b7dd8567f842ca44d1877d8b6540b83254b8a6ac6cfc11"}, - {file = "canonicaljson-1.6.1.tar.gz", hash = "sha256:a93664f698556dbd4bab9c3fc4fb35834cf2535da1ea00b6b7758d8fe2bbb824"}, + {file = "canonicaljson-1.6.0-py3-none-any.whl", hash = "sha256:7230c2a2a3db07874f622af84effe41a655e07bf23734830e18a454e65d5b998"}, + {file = "canonicaljson-1.6.0.tar.gz", hash = "sha256:8739d5fd91aca7281d425660ae65af7663808c8177778965f67e90b16a2b2427"}, ] certifi = [ {file = "certifi-2021.10.8-py2.py3-none-any.whl", hash = "sha256:d62a0163eb4c2344ac042ab2bdf75399a71a2d8c7d47eac2e2ee91b9d6339569"}, From 9e94ff1d4a56c8cd8b1f10e19a42ecd328752032 Mon Sep 17 00:00:00 2001 From: David Robertson Date: Tue, 3 May 2022 00:10:23 +0100 Subject: [PATCH 05/20] We don't seem to use `h11` The ignore was added in #6023 (as was most of mypy.ini), but that change appears unrelated. I can't find anywhere that we've ever used `h11` in Synapse. --- mypy.ini | 3 --- 1 file changed, 3 deletions(-) diff --git a/mypy.ini b/mypy.ini index 05d6ecdf2319..d8446235ec46 100644 --- a/mypy.ini +++ b/mypy.ini @@ -247,9 +247,6 @@ ignore_missing_imports = True [mypy-constantly] ignore_missing_imports = True -[mypy-h11] -ignore_missing_imports = True - [mypy-hiredis] ignore_missing_imports = True From 87810fea604d113a1cdc002176a4cf8356cb5fb7 Mon Sep 17 00:00:00 2001 From: David Robertson Date: Tue, 3 May 2022 00:13:22 +0100 Subject: [PATCH 06/20] `hiredis` includes type stubs since v2.0.0 which is the version we have locked. --- mypy.ini | 3 --- 1 file changed, 3 deletions(-) diff --git a/mypy.ini b/mypy.ini index d8446235ec46..eb860e8e3755 100644 --- a/mypy.ini +++ b/mypy.ini @@ -247,9 +247,6 @@ ignore_missing_imports = True [mypy-constantly] ignore_missing_imports = True -[mypy-hiredis] -ignore_missing_imports = True - [mypy-hyperlink] ignore_missing_imports = True From 8d23186bb73077aa7169601db3cae4c65aa8a9f4 Mon Sep 17 00:00:00 2001 From: David Robertson Date: Tue, 3 May 2022 00:17:33 +0100 Subject: [PATCH 07/20] hyperlink has type annotations since 20.0.0 We have 21.0.0 in our lockfile. https://github.com/python-hyper/hyperlink/commit/63138666fb3d9ed0bb4258bd47756fb929e66236 --- mypy.ini | 3 --- 1 file changed, 3 deletions(-) diff --git a/mypy.ini b/mypy.ini index eb860e8e3755..758ed68efcfa 100644 --- a/mypy.ini +++ b/mypy.ini @@ -247,9 +247,6 @@ ignore_missing_imports = True [mypy-constantly] ignore_missing_imports = True -[mypy-hyperlink] -ignore_missing_imports = True - [mypy-ijson.*] ignore_missing_imports = True From a3152126c3fa7067947f2fd0f4c0e9a5202dad23 Mon Sep 17 00:00:00 2001 From: David Robertson Date: Tue, 3 May 2022 00:21:18 +0100 Subject: [PATCH 08/20] importlib-metadata has type annotations In #12326 I added this config to get the tox mypy job to pass. It failed on a630a0a5492f3491431678e011bded054b966b0b (see https://github.com/matrix-org/synapse/runs/5740930065?check_suite_focus=true) because tox hadn't installed importlib_metadata at all. Now that we're using the locked poetry environment, we don't have this problem any more. --- mypy.ini | 3 --- 1 file changed, 3 deletions(-) diff --git a/mypy.ini b/mypy.ini index 758ed68efcfa..fdc347d099b6 100644 --- a/mypy.ini +++ b/mypy.ini @@ -250,9 +250,6 @@ ignore_missing_imports = True [mypy-ijson.*] ignore_missing_imports = True -[mypy-importlib_metadata.*] -ignore_missing_imports = True - [mypy-jaeger_client.*] ignore_missing_imports = True From c72faf6ef9326db4079c0c76d0fc39112641f0c7 Mon Sep 17 00:00:00 2001 From: David Robertson Date: Tue, 3 May 2022 00:25:27 +0100 Subject: [PATCH 09/20] jaegar_client has type annotations or at least, has enough annotations for mypy to not complain about missing imports. --- mypy.ini | 3 --- 1 file changed, 3 deletions(-) diff --git a/mypy.ini b/mypy.ini index fdc347d099b6..822de8cb1564 100644 --- a/mypy.ini +++ b/mypy.ini @@ -250,9 +250,6 @@ ignore_missing_imports = True [mypy-ijson.*] ignore_missing_imports = True -[mypy-jaeger_client.*] -ignore_missing_imports = True - [mypy-josepy.*] ignore_missing_imports = True From 2ee88b0435050839de4432de238b50a029225723 Mon Sep 17 00:00:00 2001 From: David Robertson Date: Tue, 3 May 2022 00:29:12 +0100 Subject: [PATCH 10/20] We don't use joespy as of #10194 --- mypy.ini | 3 --- 1 file changed, 3 deletions(-) diff --git a/mypy.ini b/mypy.ini index 822de8cb1564..b4f9aecfb9b0 100644 --- a/mypy.ini +++ b/mypy.ini @@ -250,9 +250,6 @@ ignore_missing_imports = True [mypy-ijson.*] ignore_missing_imports = True -[mypy-josepy.*] -ignore_missing_imports = True - [mypy-jwt.*] ignore_missing_imports = True From 3e274d211c3c8a7bd1ecfd162b27e4fb96963efb Mon Sep 17 00:00:00 2001 From: David Robertson Date: Tue, 3 May 2022 00:30:51 +0100 Subject: [PATCH 11/20] jwt has annotations since 2.0.0 We lock 2.3.0. https://github.com/jpadilla/pyjwt/pull/535 --- mypy.ini | 3 --- 1 file changed, 3 deletions(-) diff --git a/mypy.ini b/mypy.ini index b4f9aecfb9b0..28eb5efb3d4f 100644 --- a/mypy.ini +++ b/mypy.ini @@ -250,9 +250,6 @@ ignore_missing_imports = True [mypy-ijson.*] ignore_missing_imports = True -[mypy-jwt.*] -ignore_missing_imports = True - [mypy-lxml] ignore_missing_imports = True From d3027732decb3919260498aedf38ecea5decc924 Mon Sep 17 00:00:00 2001 From: David Robertson Date: Tue, 3 May 2022 00:38:35 +0100 Subject: [PATCH 12/20] pynacl has type annotations as of 1.5.0 thanks to someone!! --- mypy.ini | 3 --- 1 file changed, 3 deletions(-) diff --git a/mypy.ini b/mypy.ini index 28eb5efb3d4f..0cf67c3332bd 100644 --- a/mypy.ini +++ b/mypy.ini @@ -256,9 +256,6 @@ ignore_missing_imports = True [mypy-msgpack] ignore_missing_imports = True -[mypy-nacl.*] -ignore_missing_imports = True - [mypy-netaddr] ignore_missing_imports = True From b42c205fb5eeef21390b7fe3586854a7d49e06e2 Mon Sep 17 00:00:00 2001 From: David Robertson Date: Tue, 3 May 2022 00:42:39 +0100 Subject: [PATCH 13/20] phonenumbers has annotations since 8.12.32 We lock 8.12.44. See https://github.com/daviddrysdale/python-phonenumbers/pull/207 --- mypy.ini | 3 --- 1 file changed, 3 deletions(-) diff --git a/mypy.ini b/mypy.ini index 0cf67c3332bd..2cf88eece60a 100644 --- a/mypy.ini +++ b/mypy.ini @@ -262,9 +262,6 @@ ignore_missing_imports = True [mypy-parameterized.*] ignore_missing_imports = True -[mypy-phonenumbers.*] -ignore_missing_imports = True - [mypy-prometheus_client.*] ignore_missing_imports = True From 400acd93f24a142919586c21d7dff438233b5a27 Mon Sep 17 00:00:00 2001 From: David Robertson Date: Tue, 3 May 2022 00:51:28 +0100 Subject: [PATCH 14/20] promethus_client is typed (enough) as of v0.13.0 https://github.com/prometheus/client_python/pull/705 we lock 0.14.0. --- mypy.ini | 3 --- 1 file changed, 3 deletions(-) diff --git a/mypy.ini b/mypy.ini index 2cf88eece60a..c454f2742cba 100644 --- a/mypy.ini +++ b/mypy.ini @@ -262,9 +262,6 @@ ignore_missing_imports = True [mypy-parameterized.*] ignore_missing_imports = True -[mypy-prometheus_client.*] -ignore_missing_imports = True - [mypy-pymacaroons.*] ignore_missing_imports = True From 68dd483983db995d0967bf5ef44db1c54ab016e0 Mon Sep 17 00:00:00 2001 From: David Robertson Date: Tue, 3 May 2022 00:55:14 +0100 Subject: [PATCH 15/20] Redbaron was removed from the release script See a54d9b0508c17a29f2f02c87054cd8990d476054 --- mypy.ini | 3 --- 1 file changed, 3 deletions(-) diff --git a/mypy.ini b/mypy.ini index c454f2742cba..cc4f6778ec23 100644 --- a/mypy.ini +++ b/mypy.ini @@ -268,9 +268,6 @@ ignore_missing_imports = True [mypy-pympler.*] ignore_missing_imports = True -[mypy-redbaron.*] -ignore_missing_imports = True - [mypy-rust_python_jaeger_reporter.*] ignore_missing_imports = True From 4c6c4164f3dd4e46b522551525c2ded5388fafe4 Mon Sep 17 00:00:00 2001 From: David Robertson Date: Tue, 3 May 2022 01:02:10 +0100 Subject: [PATCH 16/20] Recent signedjson has type annotations thanks to me --- mypy.ini | 3 --- 1 file changed, 3 deletions(-) diff --git a/mypy.ini b/mypy.ini index cc4f6778ec23..62c57c6f2ff1 100644 --- a/mypy.ini +++ b/mypy.ini @@ -280,9 +280,6 @@ ignore_missing_imports = True [mypy-service_identity.*] ignore_missing_imports = True -[mypy-signedjson.*] -ignore_missing_imports = True - [mypy-srvlookup.*] ignore_missing_imports = True From 98a506999d1023786444c7d88f8342ed029ca021 Mon Sep 17 00:00:00 2001 From: David Robertson Date: Tue, 3 May 2022 01:03:31 +0100 Subject: [PATCH 17/20] sentry_sdk seems to have py2-style type hints --- mypy.ini | 3 --- 1 file changed, 3 deletions(-) diff --git a/mypy.ini b/mypy.ini index 62c57c6f2ff1..1c4e9d385940 100644 --- a/mypy.ini +++ b/mypy.ini @@ -274,9 +274,6 @@ ignore_missing_imports = True [mypy-saml2.*] ignore_missing_imports = True -[mypy-sentry_sdk] -ignore_missing_imports = True - [mypy-service_identity.*] ignore_missing_imports = True From 9161adafbe0fdc87f526adfbcdf0fa4ee1c86b6e Mon Sep 17 00:00:00 2001 From: David Robertson Date: Tue, 3 May 2022 01:05:30 +0100 Subject: [PATCH 18/20] typechecker seems to work without twisted and zope presumably twisted is well-annotated enough now. Twisted has a py.typed marker since about two years ago: https://github.com/twisted/twisted/commit/b7a11028cf47c3f827a429b6518452c019de744a --- mypy.ini | 6 ------ 1 file changed, 6 deletions(-) diff --git a/mypy.ini b/mypy.ini index 1c4e9d385940..a17b41f4b945 100644 --- a/mypy.ini +++ b/mypy.ini @@ -283,11 +283,5 @@ ignore_missing_imports = True [mypy-treq.*] ignore_missing_imports = True -[mypy-twisted.*] -ignore_missing_imports = True - -[mypy-zope] -ignore_missing_imports = True - [mypy-incremental.*] ignore_missing_imports = True From d70493cdca632b735589a4d76b5e699503e2cc2a Mon Sep 17 00:00:00 2001 From: David Robertson Date: Tue, 3 May 2022 01:06:38 +0100 Subject: [PATCH 19/20] drive-by netaddr stub comment --- mypy.ini | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mypy.ini b/mypy.ini index a17b41f4b945..78699e318704 100644 --- a/mypy.ini +++ b/mypy.ini @@ -256,6 +256,8 @@ 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 From 611d14a051183a5e77ce347eb26822dc339e347d Mon Sep 17 00:00:00 2001 From: David Robertson Date: Tue, 3 May 2022 01:14:31 +0100 Subject: [PATCH 20/20] changelog --- changelog.d/12608.misc | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/12608.misc diff --git a/changelog.d/12608.misc b/changelog.d/12608.misc new file mode 100644 index 000000000000..38272118fbe8 --- /dev/null +++ b/changelog.d/12608.misc @@ -0,0 +1 @@ +Remove redundant lines of config from `mypy.ini`. \ No newline at end of file