From 99fcd55023fdf5eb54aa64f1b9c532fb7b22104d Mon Sep 17 00:00:00 2001 From: Sylvain Fankhauser Date: Sat, 15 Jul 2023 10:58:35 +0200 Subject: [PATCH] Add entrypoint --- changelog.d/341.misc | 1 + pyproject.toml | 5 ++++- sygnal/sygnal.py | 6 +++++- 3 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 changelog.d/341.misc diff --git a/changelog.d/341.misc b/changelog.d/341.misc new file mode 100644 index 00000000..4d49db60 --- /dev/null +++ b/changelog.d/341.misc @@ -0,0 +1 @@ +Add entrypoint to allow running Sygnal by running the `sygnal` script. diff --git a/pyproject.toml b/pyproject.toml index 2ebd7ee1..7088a77e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -112,4 +112,7 @@ dev = [ homepage = "https://github.com/matrix-org/sygnal" documentation = "https://github.com/matrix-org/sygnal/tree/main/docs" repository = "https://github.com/matrix-org/sygnal.git" -changelog = "https://github.com/matrix-org/sygnal/blob/main/CHANGELOG.md" \ No newline at end of file +changelog = "https://github.com/matrix-org/sygnal/blob/main/CHANGELOG.md" + +[project.scripts] +sygnal = "sygnal.sygnal:main" diff --git a/sygnal/sygnal.py b/sygnal/sygnal.py index 6b5761b1..ce3ca5cf 100644 --- a/sygnal/sygnal.py +++ b/sygnal/sygnal.py @@ -337,7 +337,7 @@ def merge_left_with_defaults( return result -if __name__ == "__main__": +def main(): # TODO we don't want to have to install the reactor, when we can get away with # it asyncioreactor.install() @@ -356,3 +356,7 @@ def merge_left_with_defaults( custom_reactor = cast(SygnalReactor, asyncioreactor.AsyncioSelectorReactor()) sygnal = Sygnal(config, custom_reactor) sygnal.run() + + +if __name__ == "__main__": + main()