diff --git a/platypush/__init__.py b/platypush/__init__.py index 0d569d8d1a..8fd3c81a9f 100644 --- a/platypush/__init__.py +++ b/platypush/__init__.py @@ -5,7 +5,7 @@ Platypush .. license: MIT """ -from .app import Application +from .app import Application, app from .config import Config from .context import Variable, get_backend, get_bus, get_plugin from .cron import cron @@ -31,6 +31,7 @@ __all__ = [ 'Event', 'Request', 'Response', + 'app', 'cron', 'get_backend', 'get_bus', diff --git a/platypush/app/__init__.py b/platypush/app/__init__.py index 4bd528318e..f08bd5cb7e 100644 --- a/platypush/app/__init__.py +++ b/platypush/app/__init__.py @@ -1,4 +1,4 @@ -from ._app import Application, main +from ._app import Application, app, main -__all__ = ["Application", "main"] +__all__ = ["Application", "app", "main"] diff --git a/platypush/app/_app.py b/platypush/app/_app.py index cf74bbdf62..aa79f4b489 100644 --- a/platypush/app/_app.py +++ b/platypush/app/_app.py @@ -464,10 +464,15 @@ class Application: self._run() +app: Optional[Application] = None + + def main(*args: str): """ Application entry point. """ + global app + app = Application.from_cmdline(args) try: