orionis 0.151.0__tar.gz → 0.153.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {orionis-0.151.0/orionis.egg-info → orionis-0.153.0}/PKG-INFO +1 -1
- {orionis-0.151.0 → orionis-0.153.0}/orionis/framework.py +1 -1
- orionis-0.153.0/orionis/luminate/application.py +254 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/container/container.py +2 -22
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/container/container_integrity.py +2 -2
- orionis-0.153.0/orionis/luminate/container/resolve.py +74 -0
- orionis-0.153.0/orionis/luminate/contracts/application.py +41 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/contracts/foundation/providers/service_providers_bootstrapper.py +4 -3
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/facades/environment/environment_facade.py +0 -24
- orionis-0.153.0/orionis/luminate/foundation/exceptions/exception_providers.py +54 -0
- orionis-0.153.0/orionis/luminate/foundation/providers/service_providers_bootstrapper.py +106 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/providers/commands/reactor_commands_service_provider.py +3 -3
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/providers/commands/scheduler_provider.py +1 -10
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/providers/config/config_service_provider.py +1 -10
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/providers/environment/environment__service_provider.py +2 -4
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/providers/files/paths_provider.py +2 -4
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/providers/log/log_service_provider.py +2 -2
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/providers/service_provider.py +1 -4
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/services/commands/reactor_commands_service.py +5 -14
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/services/config/config_service.py +3 -3
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/services/environment/environment_service.py +24 -0
- {orionis-0.151.0 → orionis-0.153.0/orionis.egg-info}/PKG-INFO +1 -1
- {orionis-0.151.0 → orionis-0.153.0}/orionis.egg-info/SOURCES.txt +5 -1
- orionis-0.153.0/tests/tools/__init__.py +0 -0
- orionis-0.151.0/orionis/luminate/application.py +0 -404
- orionis-0.151.0/orionis/luminate/foundation/providers/service_providers_bootstrapper.py +0 -98
- {orionis-0.151.0 → orionis-0.153.0}/LICENCE +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/MANIFEST.in +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/README.md +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/__init__.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/cli_manager.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/installer/__init__.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/installer/contracts/__init__.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/installer/contracts/i_installer_manager.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/installer/contracts/i_installer_output.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/installer/contracts/i_installer_setup.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/installer/manager.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/installer/output/__init__.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/installer/output/output.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/installer/setup/__init__.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/installer/setup/setup.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/__init__.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/config/__init__.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/config/app.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/config/auth.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/config/cache.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/config/cors.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/config/database.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/config/filesystems.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/config/logging.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/config/mail.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/config/queue.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/config/session.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/console/__init__.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/console/base/__init__.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/console/base/command.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/console/command_filter.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/console/commands/__init__.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/console/commands/cache_clear.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/console/commands/help.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/console/commands/schedule_work.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/console/commands/tests.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/console/commands/version.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/console/exceptions/__init__.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/console/exceptions/cli_exception.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/console/kernel.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/console/output/__init__.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/console/output/console.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/console/output/executor.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/console/output/progress_bar.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/console/output/styles.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/console/parser.py +0 -0
- {orionis-0.151.0/orionis/luminate/contracts → orionis-0.153.0/orionis/luminate/container}/__init__.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/container/exception.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/container/lifetimes.py +0 -0
- {orionis-0.151.0/orionis/luminate/contracts/config → orionis-0.153.0/orionis/luminate/contracts}/__init__.py +0 -0
- {orionis-0.151.0/orionis/luminate/contracts/console → orionis-0.153.0/orionis/luminate/contracts/config}/__init__.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/contracts/config/i_config.py +0 -0
- {orionis-0.151.0/orionis/luminate/contracts/console/base → orionis-0.153.0/orionis/luminate/contracts/console}/__init__.py +0 -0
- {orionis-0.151.0/orionis/luminate/contracts/console/output → orionis-0.153.0/orionis/luminate/contracts/console/base}/__init__.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/contracts/console/base/command.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/contracts/console/command_filter.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/contracts/console/kernel.py +0 -0
- {orionis-0.151.0/orionis/luminate/contracts/facades → orionis-0.153.0/orionis/luminate/contracts/console/output}/__init__.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/contracts/console/output/console.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/contracts/console/output/executor.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/contracts/console/output/progress_bar.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/contracts/console/parser.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/contracts/console/task_manager.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/contracts/container/container.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/contracts/container/container_integrity.py +0 -0
- {orionis-0.151.0/orionis/luminate/contracts/facades/commands → orionis-0.153.0/orionis/luminate/contracts/facades}/__init__.py +0 -0
- {orionis-0.151.0/orionis/luminate/contracts/facades/config → orionis-0.153.0/orionis/luminate/contracts/facades/commands}/__init__.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/contracts/facades/commands/commands_facade.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/contracts/facades/commands/scheduler_facade.py +0 -0
- {orionis-0.151.0/orionis/luminate/contracts/facades/environment → orionis-0.153.0/orionis/luminate/contracts/facades/config}/__init__.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/contracts/facades/config/config_facade.py +0 -0
- {orionis-0.151.0/orionis/luminate/contracts/facades/files → orionis-0.153.0/orionis/luminate/contracts/facades/environment}/__init__.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/contracts/facades/environment/environment_facade.py +0 -0
- {orionis-0.151.0/orionis/luminate/contracts/facades/log → orionis-0.153.0/orionis/luminate/contracts/facades/files}/__init__.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/contracts/facades/files/path_facade.py +0 -0
- {orionis-0.151.0/orionis/luminate/contracts/facades/tests → orionis-0.153.0/orionis/luminate/contracts/facades/log}/__init__.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/contracts/facades/log/log_facade.py +0 -0
- {orionis-0.151.0/orionis/luminate/contracts/foundation → orionis-0.153.0/orionis/luminate/contracts/facades/tests}/__init__.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/contracts/facades/tests/tests_facade.py +0 -0
- {orionis-0.151.0/orionis/luminate/contracts/foundation/config → orionis-0.153.0/orionis/luminate/contracts/foundation}/__init__.py +0 -0
- /orionis-0.151.0/orionis/luminate/contracts/foundation/i_bootstraper.py → /orionis-0.153.0/orionis/luminate/contracts/foundation/bootstraper.py +0 -0
- {orionis-0.151.0/orionis/luminate/contracts/foundation/console → orionis-0.153.0/orionis/luminate/contracts/foundation/config}/__init__.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/contracts/foundation/config/config_bootstrapper.py +0 -0
- {orionis-0.151.0/orionis/luminate/contracts/foundation/environment → orionis-0.153.0/orionis/luminate/contracts/foundation/console}/__init__.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/contracts/foundation/console/command_bootstrapper.py +0 -0
- {orionis-0.151.0/orionis/luminate/contracts/foundation/providers → orionis-0.153.0/orionis/luminate/contracts/foundation/environment}/__init__.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/contracts/foundation/environment/environment_bootstrapper.py +0 -0
- {orionis-0.151.0/orionis/luminate/contracts → orionis-0.153.0/orionis/luminate/contracts/foundation}/providers/__init__.py +0 -0
- {orionis-0.151.0/orionis/luminate/contracts/services → orionis-0.153.0/orionis/luminate/contracts/providers}/__init__.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/contracts/providers/service_provider.py +0 -0
- {orionis-0.151.0/orionis/luminate/contracts/services/commands → orionis-0.153.0/orionis/luminate/contracts/services}/__init__.py +0 -0
- {orionis-0.151.0/orionis/luminate/contracts/services/config → orionis-0.153.0/orionis/luminate/contracts/services/commands}/__init__.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/contracts/services/commands/reactor_commands_service.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/contracts/services/commands/schedule_service.py +0 -0
- {orionis-0.151.0/orionis/luminate/contracts/services/environment → orionis-0.153.0/orionis/luminate/contracts/services/config}/__init__.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/contracts/services/config/config_service.py +0 -0
- {orionis-0.151.0/orionis/luminate/contracts/services/files → orionis-0.153.0/orionis/luminate/contracts/services/environment}/__init__.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/contracts/services/environment/environment_service.py +0 -0
- {orionis-0.151.0/orionis/luminate/contracts/services/log → orionis-0.153.0/orionis/luminate/contracts/services/files}/__init__.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/contracts/services/files/path_resolver_service.py +0 -0
- {orionis-0.151.0/orionis/luminate/facades → orionis-0.153.0/orionis/luminate/contracts/services/log}/__init__.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/contracts/services/log/log_service.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/contracts/support/exception_to_dict.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/contracts/support/reflection.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/contracts/support/std.py +0 -0
- {orionis-0.151.0/orionis/luminate/facades/commands → orionis-0.153.0/orionis/luminate/facades}/__init__.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/facades/app_facade.py +0 -0
- {orionis-0.151.0/orionis/luminate/facades/config → orionis-0.153.0/orionis/luminate/facades/commands}/__init__.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/facades/commands/commands_facade.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/facades/commands/scheduler_facade.py +0 -0
- {orionis-0.151.0/orionis/luminate/facades/environment → orionis-0.153.0/orionis/luminate/facades/config}/__init__.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/facades/config/config_facade.py +0 -0
- {orionis-0.151.0/orionis/luminate/facades/files → orionis-0.153.0/orionis/luminate/facades/environment}/__init__.py +0 -0
- {orionis-0.151.0/orionis/luminate/facades/log → orionis-0.153.0/orionis/luminate/facades/files}/__init__.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/facades/files/path_facade.py +0 -0
- {orionis-0.151.0/orionis/luminate/facades/tests → orionis-0.153.0/orionis/luminate/facades/log}/__init__.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/facades/log/log_facade.py +0 -0
- {orionis-0.151.0/orionis/luminate/foundation → orionis-0.153.0/orionis/luminate/facades/tests}/__init__.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/facades/tests/tests_facade.py +0 -0
- {orionis-0.151.0/orionis/luminate/foundation/config → orionis-0.153.0/orionis/luminate/foundation}/__init__.py +0 -0
- {orionis-0.151.0/orionis/luminate/foundation/console → orionis-0.153.0/orionis/luminate/foundation/config}/__init__.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/foundation/config/config_bootstrapper.py +0 -0
- {orionis-0.151.0/orionis/luminate/foundation/environment → orionis-0.153.0/orionis/luminate/foundation/console}/__init__.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/foundation/console/command_bootstrapper.py +0 -0
- {orionis-0.151.0/orionis/luminate/foundation/exceptions → orionis-0.153.0/orionis/luminate/foundation/environment}/__init__.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/foundation/environment/environment_bootstrapper.py +0 -0
- {orionis-0.151.0/orionis/luminate/foundation/providers → orionis-0.153.0/orionis/luminate/foundation/exceptions}/__init__.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/foundation/exceptions/exception_bootstrapper.py +0 -0
- {orionis-0.151.0/orionis/luminate/patterns → orionis-0.153.0/orionis/luminate/foundation/providers}/__init__.py +0 -0
- {orionis-0.151.0/orionis/luminate/providers → orionis-0.153.0/orionis/luminate/patterns}/__init__.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/patterns/singleton.py +0 -0
- {orionis-0.151.0/orionis/luminate/providers/commands → orionis-0.153.0/orionis/luminate/providers}/__init__.py +0 -0
- {orionis-0.151.0/orionis/luminate/providers/config → orionis-0.153.0/orionis/luminate/providers/commands}/__init__.py +0 -0
- {orionis-0.151.0/orionis/luminate/providers/environment → orionis-0.153.0/orionis/luminate/providers/config}/__init__.py +0 -0
- {orionis-0.151.0/orionis/luminate/providers/files → orionis-0.153.0/orionis/luminate/providers/environment}/__init__.py +0 -0
- {orionis-0.151.0/orionis/luminate/providers/log → orionis-0.153.0/orionis/luminate/providers/files}/__init__.py +0 -0
- {orionis-0.151.0/orionis/luminate/services → orionis-0.153.0/orionis/luminate/providers/log}/__init__.py +0 -0
- {orionis-0.151.0/orionis/luminate/services/commands → orionis-0.153.0/orionis/luminate/services}/__init__.py +0 -0
- {orionis-0.151.0/orionis/luminate/services/config → orionis-0.153.0/orionis/luminate/services/commands}/__init__.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/services/commands/scheduler_service.py +0 -0
- {orionis-0.151.0/orionis/luminate/services/environment → orionis-0.153.0/orionis/luminate/services/config}/__init__.py +0 -0
- {orionis-0.151.0/orionis/luminate/services/files → orionis-0.153.0/orionis/luminate/services/environment}/__init__.py +0 -0
- {orionis-0.151.0/orionis/luminate/services/log → orionis-0.153.0/orionis/luminate/services/files}/__init__.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/services/files/path_resolver_service.py +0 -0
- {orionis-0.151.0/orionis/luminate/test → orionis-0.153.0/orionis/luminate/services/log}/__init__.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/services/log/log_service.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/support/dot_dict.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/support/exception_to_dict.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/support/reflection.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/support/std.py +0 -0
- {orionis-0.151.0/tests → orionis-0.153.0/orionis/luminate/test}/__init__.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/test/exception.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/test/unit_test.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/static/ascii/icon.ascii +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/static/ascii/info.ascii +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/static/bg/galaxy.jpg +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/static/favicon/OrionisFrameworkFavicon.png +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/static/logos/OrionisFramework.jpg +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/static/logos/OrionisFramework.png +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/static/logos/OrionisFramework.psd +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/static/logos/OrionisFramework2.png +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis/static/logos/OrionisFramework3.png +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis.egg-info/dependency_links.txt +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis.egg-info/entry_points.txt +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis.egg-info/requires.txt +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/orionis.egg-info/top_level.txt +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/setup.cfg +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/setup.py +0 -0
- {orionis-0.151.0/tests/tools → orionis-0.153.0/tests}/__init__.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/tests/tools/class_example.py +0 -0
- {orionis-0.151.0 → orionis-0.153.0}/tests/tools/test_reflection.py +0 -0
@@ -0,0 +1,254 @@
|
|
1
|
+
import asyncio
|
2
|
+
import inspect
|
3
|
+
from typing import Dict, List, Type
|
4
|
+
from contextlib import contextmanager
|
5
|
+
from orionis.luminate.contracts.application import IApplication
|
6
|
+
from orionis.luminate.contracts.container.container import IContainer
|
7
|
+
from orionis.luminate.contracts.foundation.bootstraper import IBootstrapper
|
8
|
+
from orionis.luminate.container.container import Container
|
9
|
+
from orionis.luminate.contracts.providers.service_provider import IServiceProvider
|
10
|
+
from orionis.luminate.foundation.config.config_bootstrapper import ConfigBootstrapper
|
11
|
+
from orionis.luminate.foundation.console.command_bootstrapper import CommandsBootstrapper
|
12
|
+
from orionis.luminate.foundation.environment.environment_bootstrapper import EnvironmentBootstrapper
|
13
|
+
from orionis.luminate.foundation.exceptions.exception_bootstrapper import BootstrapRuntimeError
|
14
|
+
from orionis.luminate.foundation.providers.service_providers_bootstrapper import ServiceProvidersBootstrapper
|
15
|
+
from orionis.luminate.patterns.singleton import SingletonMeta
|
16
|
+
|
17
|
+
class Application(metaclass=SingletonMeta):
|
18
|
+
"""
|
19
|
+
Main application class that follows the Singleton pattern.
|
20
|
+
|
21
|
+
This class manages service providers, environment variables, configurations,
|
22
|
+
and commands for the application lifecycle.
|
23
|
+
|
24
|
+
Attributes
|
25
|
+
----------
|
26
|
+
_booted : bool
|
27
|
+
Indicates whether the application has been booted.
|
28
|
+
_custom_providers : List[Type[ServiceProvider]]
|
29
|
+
Custom service providers defined by the developer.
|
30
|
+
_service_providers : List[Type[ServiceProvider]]
|
31
|
+
Core application service providers.
|
32
|
+
_config : dict
|
33
|
+
Configuration settings of the application.
|
34
|
+
_commands : dict
|
35
|
+
Registered console commands.
|
36
|
+
_env : dict
|
37
|
+
Environment variables.
|
38
|
+
_container : IContainer
|
39
|
+
The service container instance.
|
40
|
+
"""
|
41
|
+
|
42
|
+
_booted: bool = False
|
43
|
+
|
44
|
+
def __init__(self):
|
45
|
+
"""
|
46
|
+
Initializes the application by setting up service providers, environment variables,
|
47
|
+
configuration, and the service container.
|
48
|
+
"""
|
49
|
+
self._custom_providers: List[Type[IServiceProvider]] = []
|
50
|
+
self._service_providers: List[Type[IServiceProvider]] = []
|
51
|
+
self._config: Dict = {}
|
52
|
+
self._commands: Dict = {}
|
53
|
+
self._env: Dict = {}
|
54
|
+
self._container: IContainer = Container()
|
55
|
+
|
56
|
+
# Register the application instance in the service container
|
57
|
+
self._container.instance(IApplication, self)
|
58
|
+
|
59
|
+
@classmethod
|
60
|
+
def boot(cls) -> None:
|
61
|
+
"""
|
62
|
+
Marks the application as booted.
|
63
|
+
"""
|
64
|
+
cls._booted = True
|
65
|
+
|
66
|
+
@classmethod
|
67
|
+
def isRunning(cls) -> bool:
|
68
|
+
"""
|
69
|
+
Checks if the application has been booted.
|
70
|
+
|
71
|
+
Returns
|
72
|
+
-------
|
73
|
+
bool
|
74
|
+
True if the application is running, otherwise False.
|
75
|
+
"""
|
76
|
+
return cls._booted
|
77
|
+
|
78
|
+
@classmethod
|
79
|
+
def getInstance(cls) -> "Application":
|
80
|
+
"""
|
81
|
+
Retrieves the singleton instance of the Application.
|
82
|
+
|
83
|
+
Returns
|
84
|
+
-------
|
85
|
+
Application
|
86
|
+
The current application instance.
|
87
|
+
|
88
|
+
Raises
|
89
|
+
------
|
90
|
+
RuntimeError
|
91
|
+
If the application has not been initialized yet.
|
92
|
+
"""
|
93
|
+
if cls not in SingletonMeta._instances:
|
94
|
+
raise RuntimeError("Application has not been initialized yet. Please create an instance first.")
|
95
|
+
return SingletonMeta._instances[cls]
|
96
|
+
|
97
|
+
@classmethod
|
98
|
+
def destroy(cls) -> None:
|
99
|
+
"""
|
100
|
+
Destroys the singleton instance of the Application.
|
101
|
+
"""
|
102
|
+
if cls in SingletonMeta._instances:
|
103
|
+
del SingletonMeta._instances[cls]
|
104
|
+
|
105
|
+
def withProviders(self, providers: List[Type[IServiceProvider]] = None) -> None:
|
106
|
+
"""
|
107
|
+
Sets custom service providers.
|
108
|
+
|
109
|
+
Parameters
|
110
|
+
----------
|
111
|
+
providers : List[Type[IServiceProvider]], optional
|
112
|
+
List of service providers, by default None.
|
113
|
+
"""
|
114
|
+
self._custom_providers = providers or []
|
115
|
+
|
116
|
+
def container(self) -> IContainer:
|
117
|
+
"""
|
118
|
+
Returns the service container instance.
|
119
|
+
|
120
|
+
Returns
|
121
|
+
-------
|
122
|
+
IContainer
|
123
|
+
The service container.
|
124
|
+
"""
|
125
|
+
return self._container
|
126
|
+
|
127
|
+
def create(self) -> None:
|
128
|
+
"""
|
129
|
+
Initializes and boots the application, including loading commands
|
130
|
+
and service providers.
|
131
|
+
"""
|
132
|
+
|
133
|
+
# Boot the application
|
134
|
+
self._bootstrapping()
|
135
|
+
|
136
|
+
# Load commands and service providers
|
137
|
+
self._loadCommands()
|
138
|
+
|
139
|
+
# Boot service providers
|
140
|
+
asyncio.run(self._bootServiceProviders())
|
141
|
+
|
142
|
+
# Change the application status to booted
|
143
|
+
Application.boot()
|
144
|
+
|
145
|
+
async def _bootServiceProviders(self) -> None:
|
146
|
+
"""
|
147
|
+
Boots all registered service providers.
|
148
|
+
"""
|
149
|
+
for service in self._service_providers:
|
150
|
+
provider: IServiceProvider = service(app=self._container)
|
151
|
+
provider.register()
|
152
|
+
|
153
|
+
# If the provider has a boot method, execute it (sync or async)
|
154
|
+
if hasattr(provider, 'boot') and callable(provider.boot):
|
155
|
+
if inspect.iscoroutinefunction(provider.boot):
|
156
|
+
await provider.boot()
|
157
|
+
else:
|
158
|
+
provider.boot()
|
159
|
+
|
160
|
+
def _bootstrapping(self) -> None:
|
161
|
+
"""
|
162
|
+
Loads essential components such as environment variables,
|
163
|
+
configurations, commands, and service providers.
|
164
|
+
"""
|
165
|
+
bootstrappers = [
|
166
|
+
{'property': self._env, 'instance': EnvironmentBootstrapper()},
|
167
|
+
{'property': self._config, 'instance': ConfigBootstrapper()},
|
168
|
+
{'property': self._commands, 'instance': CommandsBootstrapper()},
|
169
|
+
{'property': self._service_providers, 'instance': ServiceProvidersBootstrapper(self._custom_providers)},
|
170
|
+
]
|
171
|
+
|
172
|
+
for bootstrapper in bootstrappers:
|
173
|
+
try:
|
174
|
+
property_ref: Dict = bootstrapper["property"]
|
175
|
+
bootstrapper_instance: IBootstrapper = bootstrapper["instance"]
|
176
|
+
property_ref.update(bootstrapper_instance.get())
|
177
|
+
except Exception as e:
|
178
|
+
raise BootstrapRuntimeError(f"Error bootstrapping {type(bootstrapper_instance).__name__}: {str(e)}") from e
|
179
|
+
|
180
|
+
def _loadCommands(self) -> None:
|
181
|
+
"""
|
182
|
+
Registers application commands in the service container.
|
183
|
+
"""
|
184
|
+
for command, data_command in self._commands.items():
|
185
|
+
self._container.transient(data_command.get('signature'), data_command.get('concrete'))
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
|
194
|
+
|
195
|
+
|
196
|
+
# @contextmanager
|
197
|
+
# def app_context():
|
198
|
+
# """
|
199
|
+
# Context manager for creating an instance of the Orionis application.
|
200
|
+
|
201
|
+
# This function initializes the Orionis application with a new container,
|
202
|
+
# ensuring that the application is properly set up before use.
|
203
|
+
|
204
|
+
# Yields
|
205
|
+
# ------
|
206
|
+
# Application
|
207
|
+
# The initialized Orionis application instance.
|
208
|
+
|
209
|
+
# Raises
|
210
|
+
# ------
|
211
|
+
# RuntimeError
|
212
|
+
# If the application has not been properly initialized.
|
213
|
+
# """
|
214
|
+
# try:
|
215
|
+
|
216
|
+
# # Check if the application has been booted
|
217
|
+
# if not Application.booted:
|
218
|
+
# app = Application(Container()).boot()
|
219
|
+
# else:
|
220
|
+
# app = Application.getCurrentInstance()
|
221
|
+
|
222
|
+
# # Yield the application instance
|
223
|
+
# yield app
|
224
|
+
|
225
|
+
# finally:
|
226
|
+
|
227
|
+
# # Close Context Manager
|
228
|
+
# pass
|
229
|
+
|
230
|
+
# def app_booted():
|
231
|
+
# """
|
232
|
+
# Check if the application has been booted.
|
233
|
+
|
234
|
+
# Returns:
|
235
|
+
# bool: True if the application has been booted, False otherwise.
|
236
|
+
# """
|
237
|
+
# return Application.booted
|
238
|
+
|
239
|
+
# def orionis():
|
240
|
+
# """
|
241
|
+
# Creates a new instance of the Orionis application.
|
242
|
+
|
243
|
+
# Ensures that any existing singleton instance of `Application` is removed before
|
244
|
+
# creating a fresh instance. It resets the singleton instances stored in `SingletonMeta`
|
245
|
+
# and `Container`.
|
246
|
+
|
247
|
+
# Returns
|
248
|
+
# -------
|
249
|
+
# Application
|
250
|
+
# A new instance of the Orionis application.
|
251
|
+
# """
|
252
|
+
# Application.reset()
|
253
|
+
|
254
|
+
# return Application()
|
@@ -21,30 +21,9 @@ class Container(IContainer):
|
|
21
21
|
@classmethod
|
22
22
|
def destroy(cls):
|
23
23
|
"""
|
24
|
-
Destroys the
|
25
|
-
|
26
|
-
This method resets the singleton instance, effectively clearing all registered
|
27
|
-
services and instances.
|
28
|
-
|
29
|
-
Examples
|
30
|
-
--------
|
31
|
-
>>> Container.destroy()
|
32
|
-
"""
|
33
|
-
cls._instance = None
|
34
|
-
|
35
|
-
@classmethod
|
36
|
-
def reset(cls):
|
37
|
-
"""
|
38
|
-
Resets the container to its initial state.
|
39
|
-
|
40
|
-
This method destroys the current instance and immediately creates a new one.
|
41
|
-
|
42
|
-
Examples
|
43
|
-
--------
|
44
|
-
>>> Container.reset()
|
24
|
+
Destroys the container instance.
|
45
25
|
"""
|
46
26
|
cls._instance = None
|
47
|
-
super().__new__(cls)
|
48
27
|
|
49
28
|
def __new__(cls):
|
50
29
|
"""
|
@@ -61,6 +40,7 @@ class Container(IContainer):
|
|
61
40
|
cls._instance._scoped_services = {}
|
62
41
|
cls._instance._singleton_services = {}
|
63
42
|
cls._instance._aliases_services = {}
|
43
|
+
cls._instance.instance(IContainer, cls._instance)
|
64
44
|
return cls._instance
|
65
45
|
|
66
46
|
def bind(self, abstract: Callable[..., Any], concrete: Callable[..., Any], lifetime: str = Lifetime.TRANSIENT.value) -> None:
|
@@ -130,8 +130,8 @@ class ContainerIntegrity(IContainerIntegrity):
|
|
130
130
|
if not isinstance(name, str):
|
131
131
|
raise OrionisContainerValueError(f"The alias '{name}' must be a string.")
|
132
132
|
|
133
|
-
if not re.match(r'^[a-zA-Z0-
|
134
|
-
raise OrionisContainerValueError(f"The alias '{name}' can only contain letters and
|
133
|
+
if not re.match(r'^[a-zA-Z0-9_]+$', name):
|
134
|
+
raise OrionisContainerValueError(f"The alias '{name}' can only contain letters, numbers, and underscores, without spaces or other special characters.")
|
135
135
|
|
136
136
|
if name in {
|
137
137
|
int, "int",
|
@@ -0,0 +1,74 @@
|
|
1
|
+
import asyncio
|
2
|
+
from typing import Any, Callable
|
3
|
+
from orionis.luminate.container.container import Container
|
4
|
+
from orionis.luminate.container.exception import OrionisContainerValueError
|
5
|
+
|
6
|
+
class Resolve:
|
7
|
+
"""
|
8
|
+
A class to resolve dependencies from the dependency injection container.
|
9
|
+
|
10
|
+
This class ensures that a given abstract class or alias exists in the container
|
11
|
+
and resolves the associated service when an instance is created.
|
12
|
+
|
13
|
+
Parameters
|
14
|
+
----------
|
15
|
+
abstract_or_alias : Callable[..., Any] or str
|
16
|
+
The abstract class, alias, or callable to resolve from the container.
|
17
|
+
|
18
|
+
Returns
|
19
|
+
-------
|
20
|
+
Any
|
21
|
+
The service associated with the abstract class or alias.
|
22
|
+
|
23
|
+
Raises
|
24
|
+
------
|
25
|
+
OrionisContainerValueError
|
26
|
+
If the abstract class or alias is not found in the container.
|
27
|
+
|
28
|
+
Examples
|
29
|
+
--------
|
30
|
+
>>> container = Container()
|
31
|
+
>>> container.bind("my_service", MyService)
|
32
|
+
>>> container.alias("my_alias", "my_service")
|
33
|
+
>>> service = Resolve("my_alias") # Returns the service associated with "my_alias"
|
34
|
+
>>> service = Resolve(MyService) # Returns the service associated with MyService
|
35
|
+
"""
|
36
|
+
|
37
|
+
def __new__(cls, abstract_or_alias: Callable[..., Any] | str):
|
38
|
+
"""
|
39
|
+
Create an instance of Resolve and return the resolved service.
|
40
|
+
|
41
|
+
Parameters
|
42
|
+
----------
|
43
|
+
abstract_or_alias : Callable[..., Any] or str
|
44
|
+
The abstract class, alias, or callable to resolve from the container.
|
45
|
+
|
46
|
+
Returns
|
47
|
+
-------
|
48
|
+
Any
|
49
|
+
The service associated with the abstract class or alias.
|
50
|
+
|
51
|
+
Raises
|
52
|
+
------
|
53
|
+
OrionisContainerValueError
|
54
|
+
If the abstract class or alias is not found in the container.
|
55
|
+
"""
|
56
|
+
container = Container()
|
57
|
+
|
58
|
+
# Validate that the abstract or alias exists in the container
|
59
|
+
if not container.bound(abstract_or_alias):
|
60
|
+
raise OrionisContainerValueError(
|
61
|
+
f"Service or alias '{abstract_or_alias}' not found in the container."
|
62
|
+
)
|
63
|
+
|
64
|
+
# Resolve and return the service associated with the abstract or alias
|
65
|
+
try:
|
66
|
+
# Try to get the running event loop
|
67
|
+
loop = asyncio.get_running_loop()
|
68
|
+
# If there is a running event loop, resolve the service asynchronously
|
69
|
+
return loop.run_until_complete(container.make(abstract_or_alias))
|
70
|
+
except RuntimeError:
|
71
|
+
# If no event loop is running, create a new one and resolve the service
|
72
|
+
loop = asyncio.new_event_loop()
|
73
|
+
asyncio.set_event_loop(loop)
|
74
|
+
return loop.run_until_complete(container.make(abstract_or_alias))
|
@@ -0,0 +1,41 @@
|
|
1
|
+
from abc import ABC, abstractmethod
|
2
|
+
from typing import List, Type
|
3
|
+
from orionis.luminate.contracts.container.container import IContainer
|
4
|
+
from orionis.luminate.contracts.providers.service_provider import IServiceProvider
|
5
|
+
|
6
|
+
class IApplication(ABC):
|
7
|
+
"""
|
8
|
+
Abstract base class for the Application.
|
9
|
+
"""
|
10
|
+
|
11
|
+
@abstractmethod
|
12
|
+
def withProviders(self, providers: List[Type["IServiceProvider"]]) -> None:
|
13
|
+
"""
|
14
|
+
Sets custom service providers.
|
15
|
+
|
16
|
+
Parameters
|
17
|
+
----------
|
18
|
+
providers : List[Type[ServiceProvider]]
|
19
|
+
List of service providers.
|
20
|
+
"""
|
21
|
+
pass
|
22
|
+
|
23
|
+
@abstractmethod
|
24
|
+
def container(self) -> "IContainer":
|
25
|
+
"""
|
26
|
+
Returns the service container instance.
|
27
|
+
|
28
|
+
Returns
|
29
|
+
-------
|
30
|
+
IContainer
|
31
|
+
The service container.
|
32
|
+
"""
|
33
|
+
pass
|
34
|
+
|
35
|
+
@abstractmethod
|
36
|
+
def create(self) -> None:
|
37
|
+
"""
|
38
|
+
Initializes and boots the application, including loading commands
|
39
|
+
and service providers.
|
40
|
+
"""
|
41
|
+
pass
|
@@ -1,4 +1,5 @@
|
|
1
1
|
from abc import ABC, abstractmethod
|
2
|
+
from typing import List, Type
|
2
3
|
from orionis.luminate.providers.service_provider import ServiceProvider
|
3
4
|
|
4
5
|
class IServiceProvidersBootstrapper(ABC):
|
@@ -19,7 +20,7 @@ class IServiceProvidersBootstrapper(ABC):
|
|
19
20
|
pass
|
20
21
|
|
21
22
|
@abstractmethod
|
22
|
-
def _register(self, concrete: ServiceProvider) -> None:
|
23
|
+
def _register(self, concrete: Type[ServiceProvider]) -> None:
|
23
24
|
"""
|
24
25
|
Validates and registers a service provider class.
|
25
26
|
|
@@ -35,7 +36,7 @@ class IServiceProvidersBootstrapper(ABC):
|
|
35
36
|
pass
|
36
37
|
|
37
38
|
@abstractmethod
|
38
|
-
def getBeforeServiceProviders(self) ->
|
39
|
+
def getBeforeServiceProviders(self) -> List[Type[ServiceProvider]]:
|
39
40
|
"""
|
40
41
|
Retrieve the registered service providers.
|
41
42
|
|
@@ -47,7 +48,7 @@ class IServiceProvidersBootstrapper(ABC):
|
|
47
48
|
pass
|
48
49
|
|
49
50
|
@abstractmethod
|
50
|
-
def getAfterServiceProviders(self) ->
|
51
|
+
def getAfterServiceProviders(self) -> List[Type[ServiceProvider]]:
|
51
52
|
"""
|
52
53
|
Retrieve the registered service providers.
|
53
54
|
|
{orionis-0.151.0 → orionis-0.153.0}/orionis/luminate/facades/environment/environment_facade.py
RENAMED
@@ -2,30 +2,6 @@ from orionis.luminate.contracts.facades.environment.environment_facade import IE
|
|
2
2
|
from orionis.luminate.facades.app_facade import app
|
3
3
|
from orionis.luminate.services.environment.environment_service import EnvironmentService
|
4
4
|
|
5
|
-
def env(key: str, default=None) -> str:
|
6
|
-
"""
|
7
|
-
Retrieves the value of an environment variable.
|
8
|
-
|
9
|
-
This function provides a convenient way to access environment variables
|
10
|
-
stored in the application context. If the variable does not exist, it
|
11
|
-
returns the specified default value.
|
12
|
-
|
13
|
-
Parameters
|
14
|
-
----------
|
15
|
-
key : str
|
16
|
-
The name of the environment variable to retrieve.
|
17
|
-
default : Any, optional
|
18
|
-
The default value to return if the environment variable does not exist.
|
19
|
-
Defaults to None.
|
20
|
-
|
21
|
-
Returns
|
22
|
-
-------
|
23
|
-
str
|
24
|
-
The value of the environment variable, or the default value if the variable
|
25
|
-
does not exist.
|
26
|
-
"""
|
27
|
-
return Env.get(key, default)
|
28
|
-
|
29
5
|
class Env(IEnv):
|
30
6
|
|
31
7
|
@staticmethod
|
@@ -0,0 +1,54 @@
|
|
1
|
+
class ProvidersException(Exception):
|
2
|
+
"""
|
3
|
+
Exception related to the providers module.
|
4
|
+
|
5
|
+
Parameters
|
6
|
+
----------
|
7
|
+
message : str
|
8
|
+
The error message describing the issue.
|
9
|
+
|
10
|
+
Attributes
|
11
|
+
----------
|
12
|
+
message : str
|
13
|
+
The stored error message.
|
14
|
+
|
15
|
+
Methods
|
16
|
+
-------
|
17
|
+
__str__()
|
18
|
+
Returns a user-friendly string representation of the exception.
|
19
|
+
__repr__()
|
20
|
+
Returns a detailed representation for debugging purposes.
|
21
|
+
"""
|
22
|
+
|
23
|
+
def __init__(self, message: str):
|
24
|
+
"""
|
25
|
+
Initialize the exception with a message.
|
26
|
+
|
27
|
+
Parameters
|
28
|
+
----------
|
29
|
+
message : str
|
30
|
+
The error message describing the issue.
|
31
|
+
"""
|
32
|
+
super().__init__(f"[ProvidersException]: {message}")
|
33
|
+
|
34
|
+
def __str__(self) -> str:
|
35
|
+
"""
|
36
|
+
Returns a user-friendly string representation.
|
37
|
+
|
38
|
+
Returns
|
39
|
+
-------
|
40
|
+
str
|
41
|
+
A formatted error message.
|
42
|
+
"""
|
43
|
+
return self.args[0]
|
44
|
+
|
45
|
+
def __repr__(self) -> str:
|
46
|
+
"""
|
47
|
+
Returns a detailed representation for debugging.
|
48
|
+
|
49
|
+
Returns
|
50
|
+
-------
|
51
|
+
str
|
52
|
+
A detailed string representation including the exception name.
|
53
|
+
"""
|
54
|
+
return f"{self.__class__.__name__}({self.args[0]!r})"
|
@@ -0,0 +1,106 @@
|
|
1
|
+
import importlib
|
2
|
+
import inspect
|
3
|
+
import pathlib
|
4
|
+
from typing import List, Type
|
5
|
+
from orionis.luminate.contracts.foundation.providers.service_providers_bootstrapper import IServiceProvidersBootstrapper
|
6
|
+
from orionis.luminate.foundation.exceptions.exception_bootstrapper import BootstrapRuntimeError
|
7
|
+
from orionis.luminate.providers.service_provider import ServiceProvider
|
8
|
+
|
9
|
+
class ServiceProvidersBootstrapper(IServiceProvidersBootstrapper):
|
10
|
+
"""
|
11
|
+
Bootstrapper for loading and managing service providers.
|
12
|
+
|
13
|
+
This class is responsible for scanning directories, loading service provider classes,
|
14
|
+
and registering them in the container.
|
15
|
+
"""
|
16
|
+
|
17
|
+
def __init__(self, custom_providers: List[Type[ServiceProvider]] = None) -> None:
|
18
|
+
"""
|
19
|
+
Initializes the ServiceProvidersBootstrapper.
|
20
|
+
|
21
|
+
Args:
|
22
|
+
providers (List[Type[ServiceProvider]]): A list of service provider classes to register manually.
|
23
|
+
"""
|
24
|
+
self._service_providers: List[Type[ServiceProvider]] = []
|
25
|
+
self._custom_providers = custom_providers or []
|
26
|
+
self._autoload()
|
27
|
+
|
28
|
+
def _autoload(self) -> None:
|
29
|
+
"""
|
30
|
+
Scans the provider directories and loads provider classes.
|
31
|
+
|
32
|
+
This method searches for Python files in the specified directories, imports them,
|
33
|
+
and registers any class that inherits from `ServiceProvider`.
|
34
|
+
|
35
|
+
Raises:
|
36
|
+
BootstrapRuntimeError: If there is an error loading a module.
|
37
|
+
"""
|
38
|
+
# Base path for the project
|
39
|
+
base_path = pathlib.Path.cwd()
|
40
|
+
|
41
|
+
# Directories to scan for provider classes (Core Providers)
|
42
|
+
provider_dirs = [
|
43
|
+
pathlib.Path(__file__).resolve().parent.parent.parent / "providers"
|
44
|
+
]
|
45
|
+
|
46
|
+
# Scan directories for provider classes
|
47
|
+
for provider_dir in provider_dirs:
|
48
|
+
if not provider_dir.is_dir():
|
49
|
+
continue
|
50
|
+
|
51
|
+
for file_path in provider_dir.rglob("*.py"):
|
52
|
+
if file_path.name == "__init__.py":
|
53
|
+
continue
|
54
|
+
|
55
|
+
# Convert file path to module path
|
56
|
+
module_path = ".".join(file_path.relative_to(base_path).with_suffix("").parts)
|
57
|
+
|
58
|
+
# Remove 'site-packages.' prefix if present
|
59
|
+
if 'site-packages.' in module_path:
|
60
|
+
module_path = module_path.split('site-packages.')[1]
|
61
|
+
|
62
|
+
try:
|
63
|
+
# Import the module
|
64
|
+
module = importlib.import_module(module_path.strip())
|
65
|
+
|
66
|
+
# Find and register provider classes
|
67
|
+
for _, concrete in inspect.getmembers(module, inspect.isclass):
|
68
|
+
if issubclass(concrete, ServiceProvider) and concrete is not ServiceProvider:
|
69
|
+
self._register(concrete)
|
70
|
+
except Exception as e:
|
71
|
+
raise BootstrapRuntimeError(f"Error loading module {module_path}: {str(e)}") from e
|
72
|
+
|
73
|
+
# Register manually provided service providers
|
74
|
+
try:
|
75
|
+
for concrete in self._custom_providers:
|
76
|
+
if issubclass(concrete, ServiceProvider) and concrete is not ServiceProvider:
|
77
|
+
self._register(concrete)
|
78
|
+
except Exception as e:
|
79
|
+
raise BootstrapRuntimeError(f"Error loading provider classes: {str(e)}") from e
|
80
|
+
|
81
|
+
def _register(self, concrete: Type[ServiceProvider]) -> None:
|
82
|
+
"""
|
83
|
+
Validates and registers a service provider class.
|
84
|
+
|
85
|
+
This method ensures that the provided class is valid (inherits from `ServiceProvider`,
|
86
|
+
has a `register` and `boot` method) and registers it in the appropriate list.
|
87
|
+
|
88
|
+
Args:
|
89
|
+
concrete (Type[ServiceProvider]): The service provider class to register.
|
90
|
+
|
91
|
+
Raises:
|
92
|
+
BootstrapRuntimeError: If the provider class is invalid.
|
93
|
+
"""
|
94
|
+
if not hasattr(concrete, "register") or not callable(concrete.register):
|
95
|
+
raise BootstrapRuntimeError(f"Service provider {concrete.__name__} must implement a 'register' method.")
|
96
|
+
|
97
|
+
self._service_providers.append(concrete)
|
98
|
+
|
99
|
+
def get(self) -> List[Type[ServiceProvider]]:
|
100
|
+
"""
|
101
|
+
Retrieve the registered service providers that should run before bootstrapping.
|
102
|
+
|
103
|
+
Returns:
|
104
|
+
List[Type[ServiceProvider]]: A list of service providers to run before bootstrapping.
|
105
|
+
"""
|
106
|
+
return self._service_providers
|
@@ -8,13 +8,13 @@ class ReactorCommandsServiceProvider(ServiceProvider):
|
|
8
8
|
"""
|
9
9
|
Registers services or bindings into the given container.
|
10
10
|
"""
|
11
|
-
self.
|
11
|
+
self.app.singleton(IReactorCommandsService, ReactorCommandsService)
|
12
12
|
|
13
|
-
def boot(self
|
13
|
+
def boot(self) -> None:
|
14
14
|
"""
|
15
15
|
Boot the service provider.
|
16
16
|
|
17
17
|
This method is intended to be overridden by subclasses to perform
|
18
18
|
any necessary bootstrapping or initialization tasks.
|
19
19
|
"""
|
20
|
-
self.app.make(
|
20
|
+
self.app.make(IReactorCommandsService)
|