orionis 0.139.0__py3-none-any.whl → 0.152.0__py3-none-any.whl
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/framework.py +1 -1
- orionis/luminate/application.py +159 -309
- orionis/luminate/console/base/command.py +6 -3
- orionis/luminate/console/command_filter.py +1 -1
- orionis/luminate/console/commands/cache_clear.py +4 -3
- orionis/luminate/console/commands/schedule_work.py +1 -1
- orionis/luminate/console/kernel.py +1 -2
- orionis/luminate/console/output/console.py +1 -1
- orionis/luminate/console/output/executor.py +1 -1
- orionis/luminate/console/output/progress_bar.py +1 -1
- orionis/luminate/console/parser.py +1 -1
- orionis/luminate/container/container.py +361 -272
- orionis/luminate/container/container_integrity.py +235 -0
- orionis/luminate/container/lifetimes.py +13 -0
- orionis/luminate/container/resolve.py +74 -0
- orionis/luminate/contracts/application.py +41 -0
- orionis/luminate/contracts/console/{i_parser.py → parser.py} +0 -1
- orionis/luminate/contracts/container/container.py +346 -0
- orionis/luminate/contracts/container/container_integrity.py +168 -0
- orionis/luminate/contracts/foundation/providers/{i_service_providers_bootstrapper.py → service_providers_bootstrapper.py} +4 -3
- orionis/luminate/facades/commands/commands_facade.py +1 -1
- orionis/luminate/facades/commands/scheduler_facade.py +1 -1
- orionis/luminate/facades/config/config_facade.py +1 -1
- orionis/luminate/facades/environment/environment_facade.py +1 -26
- orionis/luminate/facades/files/path_facade.py +1 -1
- orionis/luminate/facades/log/log_facade.py +1 -1
- orionis/luminate/facades/tests/tests_facade.py +1 -1
- orionis/luminate/foundation/config/config_bootstrapper.py +1 -1
- orionis/luminate/foundation/console/command_bootstrapper.py +1 -1
- orionis/luminate/foundation/environment/environment_bootstrapper.py +1 -1
- orionis/luminate/foundation/exceptions/exception_providers.py +54 -0
- orionis/luminate/foundation/providers/service_providers_bootstrapper.py +53 -45
- orionis/luminate/providers/commands/reactor_commands_service_provider.py +4 -3
- orionis/luminate/providers/commands/scheduler_provider.py +2 -10
- orionis/luminate/providers/config/config_service_provider.py +2 -10
- orionis/luminate/providers/environment/environment__service_provider.py +3 -4
- orionis/luminate/providers/files/paths_provider.py +3 -4
- orionis/luminate/providers/log/log_service_provider.py +3 -2
- orionis/luminate/providers/service_provider.py +2 -6
- orionis/luminate/services/commands/reactor_commands_service.py +6 -16
- orionis/luminate/services/commands/scheduler_service.py +1 -2
- orionis/luminate/services/config/config_service.py +4 -5
- orionis/luminate/services/environment/environment_service.py +25 -2
- orionis/luminate/services/files/path_resolver_service.py +1 -2
- orionis/luminate/services/log/log_service.py +1 -2
- orionis/luminate/support/exception_to_dict.py +1 -1
- orionis/luminate/support/reflection.py +1 -1
- orionis/luminate/support/std.py +1 -1
- {orionis-0.139.0.dist-info → orionis-0.152.0.dist-info}/METADATA +1 -1
- {orionis-0.139.0.dist-info → orionis-0.152.0.dist-info}/RECORD +82 -78
- orionis/luminate/container/types.py +0 -51
- orionis/luminate/contracts/container/i_container.py +0 -239
- orionis/luminate/contracts/container/i_types.py +0 -16
- /orionis/luminate/contracts/console/base/{i_command.py → command.py} +0 -0
- /orionis/luminate/contracts/console/{i_command_filter.py → command_filter.py} +0 -0
- /orionis/luminate/contracts/console/{i_kernel.py → kernel.py} +0 -0
- /orionis/luminate/contracts/console/output/{i_console.py → console.py} +0 -0
- /orionis/luminate/contracts/console/output/{i_executor.py → executor.py} +0 -0
- /orionis/luminate/contracts/console/output/{i_progress_bar.py → progress_bar.py} +0 -0
- /orionis/luminate/contracts/console/{i_task_manager.py → task_manager.py} +0 -0
- /orionis/luminate/contracts/facades/commands/{i_commands_facade.py → commands_facade.py} +0 -0
- /orionis/luminate/contracts/facades/commands/{i_scheduler_facade.py → scheduler_facade.py} +0 -0
- /orionis/luminate/contracts/facades/config/{i_config_facade.py → config_facade.py} +0 -0
- /orionis/luminate/contracts/facades/environment/{i_environment_facade.py → environment_facade.py} +0 -0
- /orionis/luminate/contracts/facades/files/{i_path_facade.py → path_facade.py} +0 -0
- /orionis/luminate/contracts/facades/log/{i_log_facade.py → log_facade.py} +0 -0
- /orionis/luminate/contracts/facades/tests/{i_tests_facade.py → tests_facade.py} +0 -0
- /orionis/luminate/contracts/foundation/{i_bootstraper.py → bootstraper.py} +0 -0
- /orionis/luminate/contracts/foundation/config/{i_config_bootstrapper.py → config_bootstrapper.py} +0 -0
- /orionis/luminate/contracts/foundation/console/{i_command_bootstrapper.py → command_bootstrapper.py} +0 -0
- /orionis/luminate/contracts/foundation/environment/{i_environment_bootstrapper.py → environment_bootstrapper.py} +0 -0
- /orionis/luminate/contracts/providers/{i_service_provider.py → service_provider.py} +0 -0
- /orionis/luminate/contracts/services/commands/{i_reactor_commands_service.py → reactor_commands_service.py} +0 -0
- /orionis/luminate/contracts/services/commands/{i_schedule_service.py → schedule_service.py} +0 -0
- /orionis/luminate/contracts/services/config/{i_config_service.py → config_service.py} +0 -0
- /orionis/luminate/contracts/services/environment/{i_environment_service.py → environment_service.py} +0 -0
- /orionis/luminate/contracts/services/files/{i_path_resolver_service.py → path_resolver_service.py} +0 -0
- /orionis/luminate/contracts/services/log/{i_log_service.py → log_service.py} +0 -0
- /orionis/luminate/contracts/support/{i_exception_to_dict.py → exception_to_dict.py} +0 -0
- /orionis/luminate/contracts/support/{i_reflection.py → reflection.py} +0 -0
- /orionis/luminate/contracts/support/{i_std.py → std.py} +0 -0
- {orionis-0.139.0.dist-info → orionis-0.152.0.dist-info}/LICENCE +0 -0
- {orionis-0.139.0.dist-info → orionis-0.152.0.dist-info}/WHEEL +0 -0
- {orionis-0.139.0.dist-info → orionis-0.152.0.dist-info}/entry_points.txt +0 -0
- {orionis-0.139.0.dist-info → orionis-0.152.0.dist-info}/top_level.txt +0 -0
@@ -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})"
|
@@ -1,17 +1,28 @@
|
|
1
1
|
import importlib
|
2
2
|
import inspect
|
3
3
|
import pathlib
|
4
|
-
from
|
5
|
-
from orionis.luminate.
|
4
|
+
from typing import List, Type
|
5
|
+
from orionis.luminate.contracts.foundation.providers.service_providers_bootstrapper import IServiceProvidersBootstrapper
|
6
6
|
from orionis.luminate.foundation.exceptions.exception_bootstrapper import BootstrapRuntimeError
|
7
7
|
from orionis.luminate.providers.service_provider import ServiceProvider
|
8
8
|
|
9
9
|
class ServiceProvidersBootstrapper(IServiceProvidersBootstrapper):
|
10
|
+
"""
|
11
|
+
Bootstrapper for loading and managing service providers.
|
10
12
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
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 []
|
15
26
|
self._autoload()
|
16
27
|
|
17
28
|
def _autoload(self) -> None:
|
@@ -21,26 +32,27 @@ class ServiceProvidersBootstrapper(IServiceProvidersBootstrapper):
|
|
21
32
|
This method searches for Python files in the specified directories, imports them,
|
22
33
|
and registers any class that inherits from `ServiceProvider`.
|
23
34
|
|
24
|
-
Raises
|
25
|
-
|
26
|
-
BootstrapRuntimeError
|
27
|
-
If there is an error loading a module.
|
35
|
+
Raises:
|
36
|
+
BootstrapRuntimeError: If there is an error loading a module.
|
28
37
|
"""
|
29
|
-
|
38
|
+
# Base path for the project
|
30
39
|
base_path = pathlib.Path.cwd()
|
31
40
|
|
32
|
-
|
41
|
+
# Directories to scan for provider classes (Core Providers)
|
42
|
+
provider_dirs = [
|
33
43
|
pathlib.Path(__file__).resolve().parent.parent.parent / "providers"
|
34
44
|
]
|
35
45
|
|
36
|
-
for
|
37
|
-
|
46
|
+
# Scan directories for provider classes
|
47
|
+
for provider_dir in provider_dirs:
|
48
|
+
if not provider_dir.is_dir():
|
38
49
|
continue
|
39
50
|
|
40
|
-
for file_path in
|
51
|
+
for file_path in provider_dir.rglob("*.py"):
|
41
52
|
if file_path.name == "__init__.py":
|
42
53
|
continue
|
43
54
|
|
55
|
+
# Convert file path to module path
|
44
56
|
module_path = ".".join(file_path.relative_to(base_path).with_suffix("").parts)
|
45
57
|
|
46
58
|
# Remove 'site-packages.' prefix if present
|
@@ -48,51 +60,47 @@ class ServiceProvidersBootstrapper(IServiceProvidersBootstrapper):
|
|
48
60
|
module_path = module_path.split('site-packages.')[1]
|
49
61
|
|
50
62
|
try:
|
63
|
+
# Import the module
|
51
64
|
module = importlib.import_module(module_path.strip())
|
52
65
|
|
53
|
-
# Find and register
|
54
|
-
for
|
66
|
+
# Find and register provider classes
|
67
|
+
for _, concrete in inspect.getmembers(module, inspect.isclass):
|
55
68
|
if issubclass(concrete, ServiceProvider) and concrete is not ServiceProvider:
|
56
69
|
self._register(concrete)
|
57
70
|
except Exception as e:
|
58
|
-
raise BootstrapRuntimeError(f"Error loading {module_path}") from 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
|
59
80
|
|
60
|
-
def _register(self, concrete: ServiceProvider) -> None:
|
81
|
+
def _register(self, concrete: Type[ServiceProvider]) -> None:
|
61
82
|
"""
|
62
83
|
Validates and registers a service provider class.
|
63
84
|
|
64
85
|
This method ensures that the provided class is valid (inherits from `ServiceProvider`,
|
65
|
-
has a `register` and `boot` method) and registers it in the
|
66
|
-
`_service_providers` dictionary.
|
86
|
+
has a `register` and `boot` method) and registers it in the appropriate list.
|
67
87
|
|
68
|
-
|
69
|
-
|
70
|
-
concrete : ServiceProvider
|
71
|
-
The service provider class to register
|
72
|
-
"""
|
73
|
-
if concrete.beferoBootstrapping:
|
74
|
-
self._before_providers.append(concrete)
|
75
|
-
else:
|
76
|
-
self._after_providers.append(concrete)
|
88
|
+
Args:
|
89
|
+
concrete (Type[ServiceProvider]): The service provider class to register.
|
77
90
|
|
78
|
-
|
91
|
+
Raises:
|
92
|
+
BootstrapRuntimeError: If the provider class is invalid.
|
79
93
|
"""
|
80
|
-
|
94
|
+
if not hasattr(concrete, "register") or not callable(concrete.register):
|
95
|
+
raise BootstrapRuntimeError(f"Service provider {concrete.__name__} must implement a 'register' method.")
|
81
96
|
|
82
|
-
|
83
|
-
-------
|
84
|
-
list
|
85
|
-
A list of registered service providers
|
86
|
-
"""
|
87
|
-
return self._before_providers
|
97
|
+
self._service_providers.append(concrete)
|
88
98
|
|
89
|
-
def
|
99
|
+
def get(self) -> List[Type[ServiceProvider]]:
|
90
100
|
"""
|
91
|
-
Retrieve the registered service providers.
|
101
|
+
Retrieve the registered service providers that should run before bootstrapping.
|
92
102
|
|
93
|
-
Returns
|
94
|
-
|
95
|
-
list
|
96
|
-
A list of registered service providers
|
103
|
+
Returns:
|
104
|
+
List[Type[ServiceProvider]]: A list of service providers to run before bootstrapping.
|
97
105
|
"""
|
98
|
-
return self.
|
106
|
+
return self._service_providers
|
@@ -1,3 +1,4 @@
|
|
1
|
+
from orionis.luminate.contracts.services.commands.reactor_commands_service import IReactorCommandsService
|
1
2
|
from orionis.luminate.providers.service_provider import ServiceProvider
|
2
3
|
from orionis.luminate.services.commands.reactor_commands_service import ReactorCommandsService
|
3
4
|
|
@@ -7,13 +8,13 @@ class ReactorCommandsServiceProvider(ServiceProvider):
|
|
7
8
|
"""
|
8
9
|
Registers services or bindings into the given container.
|
9
10
|
"""
|
10
|
-
self.
|
11
|
+
self.app.singleton(IReactorCommandsService, ReactorCommandsService)
|
11
12
|
|
12
|
-
def boot(self
|
13
|
+
def boot(self) -> None:
|
13
14
|
"""
|
14
15
|
Boot the service provider.
|
15
16
|
|
16
17
|
This method is intended to be overridden by subclasses to perform
|
17
18
|
any necessary bootstrapping or initialization tasks.
|
18
19
|
"""
|
19
|
-
self.app.make(
|
20
|
+
self.app.make(IReactorCommandsService)
|
@@ -1,3 +1,4 @@
|
|
1
|
+
from orionis.luminate.contracts.services.commands.schedule_service import IScheduleService
|
1
2
|
from orionis.luminate.providers.service_provider import ServiceProvider
|
2
3
|
from orionis.luminate.services.commands.scheduler_service import ScheduleService
|
3
4
|
|
@@ -7,13 +8,4 @@ class ScheduleServiceProvider(ServiceProvider):
|
|
7
8
|
"""
|
8
9
|
Registers services or bindings into the given container.
|
9
10
|
"""
|
10
|
-
self.
|
11
|
-
|
12
|
-
def boot(self,) -> None:
|
13
|
-
"""
|
14
|
-
Boot the service provider.
|
15
|
-
|
16
|
-
This method is intended to be overridden by subclasses to perform
|
17
|
-
any necessary bootstrapping or initialization tasks.
|
18
|
-
"""
|
19
|
-
self.app.make(self._container_id)
|
11
|
+
self.app.scoped(IScheduleService, ScheduleService)
|
@@ -1,3 +1,4 @@
|
|
1
|
+
from orionis.luminate.contracts.services.config.config_service import IConfigService
|
1
2
|
from orionis.luminate.providers.service_provider import ServiceProvider
|
2
3
|
from orionis.luminate.services.config.config_service import ConfigService
|
3
4
|
|
@@ -7,13 +8,4 @@ class ConfigServiceProvider(ServiceProvider):
|
|
7
8
|
"""
|
8
9
|
Registers services or bindings into the given container.
|
9
10
|
"""
|
10
|
-
self.
|
11
|
-
|
12
|
-
def boot(self,) -> None:
|
13
|
-
"""
|
14
|
-
Boot the service provider.
|
15
|
-
|
16
|
-
This method is intended to be overridden by subclasses to perform
|
17
|
-
any necessary bootstrapping or initialization tasks.
|
18
|
-
"""
|
19
|
-
self.app.make(self._container_id)
|
11
|
+
self.app.scoped(IConfigService, ConfigService)
|
@@ -1,16 +1,15 @@
|
|
1
|
+
from orionis.luminate.contracts.services.environment.environment_service import IEnvironmentService
|
1
2
|
from orionis.luminate.providers.service_provider import ServiceProvider
|
2
3
|
from orionis.luminate.services.environment.environment_service import EnvironmentService
|
3
4
|
from orionis.luminate.services.files.path_resolver_service import PathResolverService
|
4
5
|
|
5
6
|
class EnvironmentServiceProvider(ServiceProvider):
|
6
7
|
|
7
|
-
beferoBootstrapping = True
|
8
|
-
|
9
8
|
def register(self) -> None:
|
10
9
|
"""
|
11
10
|
Registers services or bindings into the given container.
|
12
11
|
"""
|
13
|
-
self.
|
12
|
+
self.app.singleton(IEnvironmentService, EnvironmentService)
|
14
13
|
|
15
14
|
def boot(self) -> None:
|
16
15
|
"""
|
@@ -19,4 +18,4 @@ class EnvironmentServiceProvider(ServiceProvider):
|
|
19
18
|
This method is intended to be overridden by subclasses to perform
|
20
19
|
any necessary bootstrapping or initialization tasks.
|
21
20
|
"""
|
22
|
-
self.app.make(
|
21
|
+
self.app.make(IEnvironmentService)
|
@@ -1,15 +1,14 @@
|
|
1
|
+
from orionis.luminate.contracts.services.files.path_resolver_service import IPathResolverService
|
1
2
|
from orionis.luminate.providers.service_provider import ServiceProvider
|
2
3
|
from orionis.luminate.services.files.path_resolver_service import PathResolverService
|
3
4
|
|
4
5
|
class PathResolverProvider(ServiceProvider):
|
5
6
|
|
6
|
-
beferoBootstrapping = True
|
7
|
-
|
8
7
|
def register(self) -> None:
|
9
8
|
"""
|
10
9
|
Registers services or bindings into the given container.
|
11
10
|
"""
|
12
|
-
self.
|
11
|
+
self.app.singleton(IPathResolverService, PathResolverService)
|
13
12
|
|
14
13
|
def boot(self) -> None:
|
15
14
|
"""
|
@@ -18,4 +17,4 @@ class PathResolverProvider(ServiceProvider):
|
|
18
17
|
This method is intended to be overridden by subclasses to perform
|
19
18
|
any necessary bootstrapping or initialization tasks.
|
20
19
|
"""
|
21
|
-
self.app.make(
|
20
|
+
self.app.make(IPathResolverService)
|
@@ -1,3 +1,4 @@
|
|
1
|
+
from orionis.luminate.contracts.services.log.log_service import ILogguerService
|
1
2
|
from orionis.luminate.providers.service_provider import ServiceProvider
|
2
3
|
from orionis.luminate.services.log.log_service import LogguerService
|
3
4
|
|
@@ -7,7 +8,7 @@ class LogServiceProvider(ServiceProvider):
|
|
7
8
|
"""
|
8
9
|
Registers services or bindings into the given container.
|
9
10
|
"""
|
10
|
-
self.
|
11
|
+
self.app.singleton(ILogguerService, LogguerService)
|
11
12
|
|
12
13
|
def boot(self) -> None:
|
13
14
|
"""
|
@@ -16,4 +17,4 @@ class LogServiceProvider(ServiceProvider):
|
|
16
17
|
This method is intended to be overridden by subclasses to perform
|
17
18
|
any necessary bootstrapping or initialization tasks.
|
18
19
|
"""
|
19
|
-
self.app.make(
|
20
|
+
self.app.make(ILogguerService)
|
@@ -1,4 +1,4 @@
|
|
1
|
-
from orionis.luminate.contracts.providers.
|
1
|
+
from orionis.luminate.contracts.providers.service_provider import IServiceProvider
|
2
2
|
from orionis.luminate.container.container import Container
|
3
3
|
|
4
4
|
class ServiceProvider(IServiceProvider):
|
@@ -11,10 +11,6 @@ class ServiceProvider(IServiceProvider):
|
|
11
11
|
The container instance to be used by the service provider.
|
12
12
|
"""
|
13
13
|
|
14
|
-
# Indicates whether the service provider is a bootstrapper.
|
15
|
-
beferoBootstrapping = False
|
16
|
-
|
17
|
-
|
18
14
|
def __init__(self, app : Container) -> None:
|
19
15
|
"""
|
20
16
|
Initialize the service provider with the given container.
|
@@ -52,4 +48,4 @@ class ServiceProvider(IServiceProvider):
|
|
52
48
|
container : Container
|
53
49
|
The container instance where services will be booted.
|
54
50
|
"""
|
55
|
-
|
51
|
+
pass
|
@@ -1,7 +1,6 @@
|
|
1
1
|
import time
|
2
2
|
from typing import Any, Dict, Optional
|
3
|
-
from orionis.luminate.
|
4
|
-
from orionis.luminate.foundation.console.command_bootstrapper import CommandsBootstrapper
|
3
|
+
from orionis.luminate.container.resolve import Resolve
|
5
4
|
from orionis.luminate.console.base.command import BaseCommand
|
6
5
|
from orionis.luminate.console.command_filter import CommandFilter
|
7
6
|
from orionis.luminate.console.exceptions.cli_exception import CLIOrionisException
|
@@ -11,7 +10,7 @@ from orionis.luminate.console.parser import Parser
|
|
11
10
|
from orionis.luminate.facades.app_facade import app
|
12
11
|
from orionis.luminate.facades.log.log_facade import Log
|
13
12
|
|
14
|
-
class ReactorCommandsService
|
13
|
+
class ReactorCommandsService:
|
15
14
|
"""
|
16
15
|
Service responsible for executing and managing CLI commands in Orionis.
|
17
16
|
|
@@ -21,29 +20,20 @@ class ReactorCommandsService(IReactorCommandsService):
|
|
21
20
|
- Managing execution timing and error handling.
|
22
21
|
"""
|
23
22
|
|
24
|
-
def __init__(
|
25
|
-
self,
|
26
|
-
commands_bootstrapper: CommandsBootstrapper,
|
27
|
-
command_filter: CommandFilter,
|
28
|
-
log: Log,
|
29
|
-
executor: Executor,
|
30
|
-
console: Console,
|
31
|
-
):
|
23
|
+
def __init__(self, command_filter: CommandFilter, log: Log, executor: Executor, console: Console, app = Resolve('__orionis__')) -> None:
|
32
24
|
"""
|
33
25
|
Initializes the ReactorCommandsService instance.
|
34
26
|
|
35
27
|
Assigns provided services to internal attributes for later use in command
|
36
28
|
execution, filtering, and logging.
|
37
29
|
"""
|
38
|
-
self.
|
30
|
+
self.commands = app._commands if hasattr(app, '_commands') else {}
|
39
31
|
self.command_filter = command_filter
|
40
32
|
self.log = log
|
41
33
|
self.console_executor = executor
|
42
34
|
self.console_output = console
|
43
35
|
|
44
|
-
def _parse_arguments(
|
45
|
-
self, arguments, vars: Optional[Dict[str, Any]] = None, *args, **kwargs
|
46
|
-
):
|
36
|
+
def _parse_arguments(self, arguments, vars: Optional[Dict[str, Any]] = None, *args, **kwargs):
|
47
37
|
"""
|
48
38
|
Parses command-line arguments using the Orionis argument parser.
|
49
39
|
|
@@ -119,7 +109,7 @@ class ReactorCommandsService(IReactorCommandsService):
|
|
119
109
|
self.console_executor.running(program=signature)
|
120
110
|
|
121
111
|
# Retrieve command from bootstrapper
|
122
|
-
command = self.
|
112
|
+
command = self.commands.get(signature)
|
123
113
|
|
124
114
|
# Parse command arguments dynamically based on execution context
|
125
115
|
args_dict = self._parse_arguments(command.get('arguments', []), vars, *args, **kwargs)
|
@@ -7,11 +7,10 @@ from typing import Any
|
|
7
7
|
from apscheduler.schedulers.background import BackgroundScheduler
|
8
8
|
from apscheduler.triggers.cron import CronTrigger
|
9
9
|
from apscheduler.triggers.interval import IntervalTrigger
|
10
|
-
from orionis.luminate.contracts.services.commands.i_schedule_service import IScheduleService
|
11
10
|
from orionis.luminate.console.exceptions.cli_exception import CLIOrionisScheduleException
|
12
11
|
from orionis.luminate.facades.commands.commands_facade import Command
|
13
12
|
|
14
|
-
class ScheduleService
|
13
|
+
class ScheduleService:
|
15
14
|
"""
|
16
15
|
A class that manages the scheduling of tasks using the APScheduler.
|
17
16
|
|
@@ -1,18 +1,17 @@
|
|
1
1
|
import copy
|
2
2
|
from typing import Any, Optional
|
3
|
-
from orionis.luminate.
|
4
|
-
from orionis.luminate.foundation.config.config_bootstrapper import ConfigBootstrapper
|
3
|
+
from orionis.luminate.container.resolve import Resolve
|
5
4
|
|
6
|
-
class ConfigService
|
5
|
+
class ConfigService:
|
7
6
|
|
8
|
-
def __init__(self,
|
7
|
+
def __init__(self, app = Resolve('__orionis__')) -> None:
|
9
8
|
"""
|
10
9
|
Initializes the ConfigService with the provided configuration.
|
11
10
|
|
12
11
|
Args:
|
13
12
|
config (dict): A dictionary containing configuration settings.
|
14
13
|
"""
|
15
|
-
real_config : dict =
|
14
|
+
real_config : dict = app._config if hasattr(app, '_config') else {}
|
16
15
|
self._config = copy.deepcopy(real_config)
|
17
16
|
|
18
17
|
def set(self, key: str, value: Any) -> None:
|
@@ -3,9 +3,32 @@ import os
|
|
3
3
|
from pathlib import Path
|
4
4
|
from typing import Any
|
5
5
|
from dotenv import set_key, unset_key, dotenv_values
|
6
|
-
from orionis.luminate.contracts.services.environment.i_environment_service import IEnvironmentService
|
7
6
|
|
8
|
-
|
7
|
+
def env(key: str, default=None) -> Any:
|
8
|
+
"""
|
9
|
+
Retrieves the value of an environment variable.
|
10
|
+
|
11
|
+
This function provides a convenient way to access environment variables
|
12
|
+
stored in the application context. If the variable does not exist, it
|
13
|
+
returns the specified default value.
|
14
|
+
|
15
|
+
Parameters
|
16
|
+
----------
|
17
|
+
key : str
|
18
|
+
The name of the environment variable to retrieve.
|
19
|
+
default : Any, optional
|
20
|
+
The default value to return if the environment variable does not exist.
|
21
|
+
Defaults to None.
|
22
|
+
|
23
|
+
Returns
|
24
|
+
-------
|
25
|
+
Any
|
26
|
+
The value of the environment variable, or the default value if the variable
|
27
|
+
does not exist.
|
28
|
+
"""
|
29
|
+
return EnvironmentService().get(key, default)
|
30
|
+
|
31
|
+
class EnvironmentService:
|
9
32
|
|
10
33
|
def __init__(self, path: str = None):
|
11
34
|
|
@@ -4,10 +4,9 @@ from pathlib import Path
|
|
4
4
|
import re
|
5
5
|
from datetime import datetime
|
6
6
|
from logging.handlers import RotatingFileHandler, TimedRotatingFileHandler
|
7
|
-
from orionis.luminate.contracts.services.log.i_log_service import ILogguerService
|
8
7
|
from orionis.luminate.services.config.config_service import ConfigService
|
9
8
|
|
10
|
-
class LogguerService
|
9
|
+
class LogguerService:
|
11
10
|
"""
|
12
11
|
A service class for logging messages with different severity levels.
|
13
12
|
|
@@ -3,7 +3,7 @@ import inspect
|
|
3
3
|
import importlib
|
4
4
|
from enum import Enum
|
5
5
|
from typing import Any, List, Optional
|
6
|
-
from orionis.luminate.contracts.support.
|
6
|
+
from orionis.luminate.contracts.support.reflection import IReflection
|
7
7
|
|
8
8
|
class Reflection(IReflection):
|
9
9
|
"""
|
orionis/luminate/support/std.py
CHANGED