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()