Improved project file structure
This commit is contained in:
		| @@ -0,0 +1 @@ | ||||
| # imports:  | ||||
| @@ -0,0 +1,16 @@ | ||||
| from cpl_core.application import ApplicationABC | ||||
| from cpl_core.configuration import ConfigurationABC | ||||
| from cpl_core.console import Console | ||||
| from cpl_core.dependency_injection import ServiceProviderABC | ||||
|  | ||||
|  | ||||
| class Application(ApplicationABC): | ||||
|  | ||||
|     def __init__(self, config: ConfigurationABC, services: ServiceProviderABC): | ||||
|         ApplicationABC.__init__(self, config, services) | ||||
|  | ||||
|     def configure(self): | ||||
|         pass | ||||
|  | ||||
|     def main(self): | ||||
|         Console.write_line('Hello World') | ||||
| @@ -0,0 +1,14 @@ | ||||
| from cpl_core.application import ApplicationBuilder | ||||
|  | ||||
| from simple_startup_app.application import Application | ||||
| from simple_startup_app.startup import Startup | ||||
|  | ||||
|  | ||||
| def main(): | ||||
|     app_builder = ApplicationBuilder(Application) | ||||
|     app_builder.use_startup(Startup) | ||||
|     app_builder.build().run() | ||||
|  | ||||
|  | ||||
| if __name__ == '__main__': | ||||
|     main() | ||||
| @@ -0,0 +1,43 @@ | ||||
| { | ||||
|   "ProjectSettings": { | ||||
|     "Name": "simple-startup-app", | ||||
|     "Version": { | ||||
|       "Major": "0", | ||||
|       "Minor": "0", | ||||
|       "Micro": "0" | ||||
|     }, | ||||
|     "Author": "", | ||||
|     "AuthorEmail": "", | ||||
|     "Description": "", | ||||
|     "LongDescription": "", | ||||
|     "URL": "", | ||||
|     "CopyrightDate": "", | ||||
|     "CopyrightName": "", | ||||
|     "LicenseName": "", | ||||
|     "LicenseDescription": "", | ||||
|     "Dependencies": [ | ||||
|       "sh_cpl==2021.4.1rc2" | ||||
|     ], | ||||
|     "PythonVersion": ">=3.9.2", | ||||
|     "PythonPath": { | ||||
|       "linux": "" | ||||
|     }, | ||||
|     "Classifiers": [] | ||||
|   }, | ||||
|   "BuildSettings": { | ||||
|     "ProjectType": "console", | ||||
|     "SourcePath": "", | ||||
|     "OutputPath": "../../dist", | ||||
|     "Main": "simple_startup_app.main", | ||||
|     "EntryPoint": "simple-startup-app", | ||||
|     "IncludePackageData": false, | ||||
|     "Included": [], | ||||
|     "Excluded": [ | ||||
|       "*/__pycache__", | ||||
|       "*/logs", | ||||
|       "*/tests" | ||||
|     ], | ||||
|     "PackageData": {}, | ||||
|     "ProjectReferences": [] | ||||
|   } | ||||
| } | ||||
| @@ -0,0 +1,19 @@ | ||||
| from cpl_core.application import StartupABC | ||||
| from cpl_core.configuration import ConfigurationABC | ||||
| from cpl_core.dependency_injection import ServiceProviderABC, ServiceCollectionABC | ||||
|  | ||||
|  | ||||
| class Startup(StartupABC): | ||||
|  | ||||
|     def __init__(self, config: ConfigurationABC, services: ServiceCollectionABC): | ||||
|         StartupABC.__init__(self) | ||||
|  | ||||
|         self._configuration = config | ||||
|         self._environment = self._configuration.environment | ||||
|         self._services = services | ||||
|  | ||||
|     def configure_configuration(self) -> ConfigurationABC: | ||||
|         return self._configuration | ||||
|  | ||||
|     def configure_services(self) -> ServiceProviderABC: | ||||
|         return self._services.build_service_provider() | ||||
		Reference in New Issue
	
	Block a user