From 2a2b189130c6ad040d00548d3dfc7030a9618a57 Mon Sep 17 00:00:00 2001 From: reivilibre Date: Wed, 13 Oct 2021 08:42:41 +0100 Subject: [PATCH] Mark Module API error imports as re-exported and mark Synapse as containing type annotations (#11054) --- MANIFEST.in | 1 + changelog.d/11054.misc | 1 + synapse/module_api/errors.py | 11 +++++++++-- synapse/py.typed | 0 4 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 changelog.d/11054.misc create mode 100644 synapse/py.typed diff --git a/MANIFEST.in b/MANIFEST.in index 44d5cc7618..c24786c3b3 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -8,6 +8,7 @@ include demo/demo.tls.dh include demo/*.py include demo/*.sh +include synapse/py.typed recursive-include synapse/storage *.sql recursive-include synapse/storage *.sql.postgres recursive-include synapse/storage *.sql.sqlite diff --git a/changelog.d/11054.misc b/changelog.d/11054.misc new file mode 100644 index 0000000000..1103368fec --- /dev/null +++ b/changelog.d/11054.misc @@ -0,0 +1 @@ +Mark the Synapse package as containing type annotations and fix export declarations so that Synapse pluggable modules may be type checked against Synapse. diff --git a/synapse/module_api/errors.py b/synapse/module_api/errors.py index 98ea911a81..1db900e41f 100644 --- a/synapse/module_api/errors.py +++ b/synapse/module_api/errors.py @@ -14,9 +14,16 @@ """Exception types which are exposed as part of the stable module API""" -from synapse.api.errors import ( # noqa: F401 +from synapse.api.errors import ( InvalidClientCredentialsError, RedirectException, SynapseError, ) -from synapse.config._base import ConfigError # noqa: F401 +from synapse.config._base import ConfigError + +__all__ = [ + "InvalidClientCredentialsError", + "RedirectException", + "SynapseError", + "ConfigError", +] diff --git a/synapse/py.typed b/synapse/py.typed new file mode 100644 index 0000000000..e69de29bb2