Context - AvionCargo-UL/SkyAvionics GitHub Wiki

Application Context

Abstract class used to build and start the application. Derive this class in order to create custom context.

Methods

start_application

This method is responsible for launching the application after it has been initialized through the build_application method. This method orchestrates the startup process by ensuring that each class or module is launched in the correct order to guarantee the proper functioning of the application.

[!WARNING] Call this method after build_application.

build_application

This method is responsible for constructing the entire application. It ensures that all necessary services, classes, and dependencies are instantiated and properly configured before the application is started.

Instantiate class

The ApplicationContext class is responsible for instantiating, assembling, and starting the application, but it should not be directly responsible for knowing how to create specific services or classes.

To delegate the creation of these components, the ApplicationContext relies on abstract methods, which are provided using the abstractmethod decorator. These abstract methods allow subclasses to define how to create the necessary services, classes, and dependencies.

Development Context

This class is responsible for building the application in a development environment. It uses the dev-config.yaml file to inject the required configuration for development purposes. The class extends the base context and implements the abstractmethod to define how to create the necessary services, classes, and dependencies specific to the development setup.

Usage

development_context = DevelopementContext()
development_context.build_application()
development_context.start_application()