orionis 0.103.0__py3-none-any.whl → 0.110.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/contracts/foundation/__init__.py +0 -0
- orionis/contracts/foundation/config/__init__.py +0 -0
- orionis/contracts/foundation/console/__init__.py +0 -0
- orionis/contracts/foundation/environment/__init__.py +0 -0
- orionis/contracts/foundation/i_bootstraper.py +41 -0
- orionis/contracts/foundation/providers/__init__.py +0 -0
- orionis/contracts/foundation/providers/i_service_providers_bootstrapper.py +59 -0
- orionis/framework.py +1 -1
- orionis/luminate/app.py +105 -85
- orionis/luminate/container/container.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/providers/service_providers_bootstrapper.py +90 -2
- orionis/luminate/providers/environment/environment__service_provider.py +2 -5
- orionis/luminate/providers/files/paths_provider.py +2 -1
- orionis/luminate/providers/service_provider.py +4 -1
- orionis/luminate/services/log/log_service.py +7 -2
- {orionis-0.103.0.dist-info → orionis-0.110.0.dist-info}/METADATA +1 -1
- {orionis-0.103.0.dist-info → orionis-0.110.0.dist-info}/RECORD +27 -20
- /orionis/contracts/{bootstrap → foundation/config}/i_config_bootstrapper.py +0 -0
- /orionis/contracts/{bootstrap → foundation/console}/i_command_bootstrapper.py +0 -0
- /orionis/contracts/{bootstrap → foundation/environment}/i_environment_bootstrapper.py +0 -0
- {orionis-0.103.0.dist-info → orionis-0.110.0.dist-info}/LICENCE +0 -0
- {orionis-0.103.0.dist-info → orionis-0.110.0.dist-info}/WHEEL +0 -0
- {orionis-0.103.0.dist-info → orionis-0.110.0.dist-info}/entry_points.txt +0 -0
- {orionis-0.103.0.dist-info → orionis-0.110.0.dist-info}/top_level.txt +0 -0
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,41 @@
|
|
1
|
+
from abc import ABC, abstractmethod
|
2
|
+
from typing import Any
|
3
|
+
|
4
|
+
class IBootstrapper(ABC):
|
5
|
+
|
6
|
+
@abstractmethod
|
7
|
+
def _autoload(self) -> None:
|
8
|
+
"""
|
9
|
+
Loads environment variables from the `.env` file or creates the file if it does not exist.
|
10
|
+
|
11
|
+
This method checks if the `.env` file exists in the current working directory.
|
12
|
+
If the file does not exist, it creates an empty `.env` file. If the file exists,
|
13
|
+
it loads the environment variables into the `_environment_vars` dictionary.
|
14
|
+
|
15
|
+
Raises
|
16
|
+
------
|
17
|
+
PermissionError
|
18
|
+
If the `.env` file cannot be created or read due to insufficient permissions.
|
19
|
+
"""
|
20
|
+
pass
|
21
|
+
|
22
|
+
def get(self, *args, **kwargs) -> Any:
|
23
|
+
"""
|
24
|
+
Retrieves the value of an environment variable.
|
25
|
+
|
26
|
+
Parameters
|
27
|
+
----------
|
28
|
+
key : str
|
29
|
+
The name of the environment variable.
|
30
|
+
|
31
|
+
Returns
|
32
|
+
-------
|
33
|
+
str
|
34
|
+
The value of the environment variable.
|
35
|
+
|
36
|
+
Raises
|
37
|
+
------
|
38
|
+
KeyError
|
39
|
+
If the environment variable does not exist.
|
40
|
+
"""
|
41
|
+
pass
|
File without changes
|
@@ -0,0 +1,59 @@
|
|
1
|
+
from abc import ABC, abstractmethod
|
2
|
+
from orionis.luminate.providers.service_provider import ServiceProvider
|
3
|
+
|
4
|
+
class IServiceProvidersBootstrapper(ABC):
|
5
|
+
|
6
|
+
@abstractmethod
|
7
|
+
def _autoload(self) -> None:
|
8
|
+
"""
|
9
|
+
Scans the provider directories and loads provider classes.
|
10
|
+
|
11
|
+
This method searches for Python files in the specified directories, imports them,
|
12
|
+
and registers any class that inherits from `ServiceProvider`.
|
13
|
+
|
14
|
+
Raises
|
15
|
+
------
|
16
|
+
BootstrapRuntimeError
|
17
|
+
If there is an error loading a module.
|
18
|
+
"""
|
19
|
+
pass
|
20
|
+
|
21
|
+
@abstractmethod
|
22
|
+
def _register(self, concrete: ServiceProvider) -> None:
|
23
|
+
"""
|
24
|
+
Validates and registers a service provider class.
|
25
|
+
|
26
|
+
This method ensures that the provided class is valid (inherits from `ServiceProvider`,
|
27
|
+
has a `register` and `boot` method) and registers it in the
|
28
|
+
`_service_providers` dictionary.
|
29
|
+
|
30
|
+
Parameters
|
31
|
+
----------
|
32
|
+
concrete : ServiceProvider
|
33
|
+
The service provider class to register
|
34
|
+
"""
|
35
|
+
pass
|
36
|
+
|
37
|
+
@abstractmethod
|
38
|
+
def getBeforeServiceProviders(self) -> list:
|
39
|
+
"""
|
40
|
+
Retrieve the registered service providers.
|
41
|
+
|
42
|
+
Returns
|
43
|
+
-------
|
44
|
+
list
|
45
|
+
A list of registered service providers
|
46
|
+
"""
|
47
|
+
pass
|
48
|
+
|
49
|
+
@abstractmethod
|
50
|
+
def getAfterServiceProviders(self) -> list:
|
51
|
+
"""
|
52
|
+
Retrieve the registered service providers.
|
53
|
+
|
54
|
+
Returns
|
55
|
+
-------
|
56
|
+
list
|
57
|
+
A list of registered service providers
|
58
|
+
"""
|
59
|
+
pass
|
orionis/framework.py
CHANGED
orionis/luminate/app.py
CHANGED
@@ -1,15 +1,13 @@
|
|
1
1
|
from typing import Any, Callable
|
2
|
+
from orionis.contracts.foundation.i_bootstraper import IBootstrapper
|
3
|
+
from orionis.luminate.console.output.console import Console
|
2
4
|
from orionis.luminate.container.container import Container
|
3
5
|
from orionis.luminate.foundation.config.config_bootstrapper import ConfigBootstrapper
|
4
6
|
from orionis.luminate.foundation.console.command_bootstrapper import CommandsBootstrapper
|
5
7
|
from orionis.luminate.foundation.environment.environment_bootstrapper import EnvironmentBootstrapper
|
8
|
+
from orionis.luminate.foundation.providers.service_providers_bootstrapper import ServiceProvidersBootstrapper
|
6
9
|
from orionis.luminate.patterns.singleton import SingletonMeta
|
7
|
-
from orionis.luminate.providers.
|
8
|
-
from orionis.luminate.providers.commands.scheduler_provider import ScheduleServiceProvider
|
9
|
-
from orionis.luminate.providers.environment.environment__service_provider import EnvironmentServiceProvider
|
10
|
-
from orionis.luminate.providers.config.config_service_provider import ConfigServiceProvider
|
11
|
-
from orionis.luminate.providers.files.paths_provider import PathResolverProvider
|
12
|
-
from orionis.luminate.providers.log.log_service_provider import LogServiceProvider
|
10
|
+
from orionis.luminate.providers.service_provider import ServiceProvider
|
13
11
|
|
14
12
|
class Application(metaclass=SingletonMeta):
|
15
13
|
"""
|
@@ -50,6 +48,8 @@ class Application(metaclass=SingletonMeta):
|
|
50
48
|
The dependency injection container for the application.
|
51
49
|
"""
|
52
50
|
# Class attributes
|
51
|
+
self._before_boot_service_providers: list = []
|
52
|
+
self._after_boot_service_providers: list = []
|
53
53
|
self._config: dict = {}
|
54
54
|
self._commands: dict = {}
|
55
55
|
self._environment_vars: dict = {}
|
@@ -58,7 +58,10 @@ class Application(metaclass=SingletonMeta):
|
|
58
58
|
# Initialize the application container
|
59
59
|
self.container = container
|
60
60
|
self.container.instance(container)
|
61
|
-
|
61
|
+
try:
|
62
|
+
self._boot()
|
63
|
+
except Exception as e:
|
64
|
+
Console.exception(e)
|
62
65
|
|
63
66
|
def isBooted(self) -> bool:
|
64
67
|
"""
|
@@ -186,101 +189,118 @@ class Application(metaclass=SingletonMeta):
|
|
186
189
|
"""
|
187
190
|
return self.container.forgetScopedInstances()
|
188
191
|
|
189
|
-
def
|
192
|
+
def _boot(self):
|
190
193
|
"""
|
191
|
-
Bootstraps the application.
|
192
|
-
|
193
|
-
|
194
|
-
|
194
|
+
Bootstraps the application by loading environment configuration and core providers.
|
195
|
+
Notes
|
196
|
+
-----
|
197
|
+
The bootstrapping process involves several steps:
|
198
|
+
1. Loading essential services.
|
199
|
+
2. Executing pre-bootstrap provider hooks.
|
200
|
+
3. Initializing core components.
|
201
|
+
4. Executing post-bootstrap provider hooks.
|
202
|
+
5. Loading command-line interface commands.
|
203
|
+
After these steps, the application is marked as booted.
|
195
204
|
"""
|
196
|
-
|
205
|
+
self._bootServices()
|
197
206
|
self._beforeBootstrapProviders()
|
198
|
-
|
199
|
-
# Dynamically load application configuration
|
200
207
|
self._bootstraping()
|
201
|
-
|
202
|
-
# Load core providers
|
203
208
|
self._afterBootstrapProviders()
|
204
|
-
|
205
|
-
# Set the booted flag to True
|
209
|
+
self._loadCommands()
|
206
210
|
self._booted = True
|
207
211
|
|
208
|
-
def
|
212
|
+
def _bootServices(self):
|
209
213
|
"""
|
210
|
-
|
214
|
+
Bootstraps the application services.
|
215
|
+
|
216
|
+
This method is responsible for loading the application's services. It reads all the
|
217
|
+
ServiceProviders from the Core and those defined by the developer. Then, it stores
|
218
|
+
in class dictionaries the services that need to be loaded before and after the Bootstrap.
|
219
|
+
|
220
|
+
Parameters
|
221
|
+
----------
|
222
|
+
None
|
211
223
|
|
212
|
-
|
213
|
-
|
224
|
+
Returns
|
225
|
+
-------
|
226
|
+
None
|
214
227
|
"""
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
_path_provider.boot()
|
228
|
+
services_bootstrapper_key = self.singleton(ServiceProvidersBootstrapper)
|
229
|
+
services_bootstrapper: ServiceProvidersBootstrapper = self.make(services_bootstrapper_key)
|
230
|
+
self._before_boot_service_providers = services_bootstrapper.getBeforeServiceProviders()
|
231
|
+
self._after_boot_service_providers = services_bootstrapper.getAfterServiceProviders()
|
220
232
|
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
233
|
+
def _beforeBootstrapProviders(self):
|
234
|
+
"""
|
235
|
+
Loads and registers essential services before bootstrapping.
|
236
|
+
|
237
|
+
This method is responsible for loading and registering the services that are
|
238
|
+
required before the main bootstrapping process. It iterates through the list
|
239
|
+
of service providers that need to be initialized early, registers them, and
|
240
|
+
then boots them to make sure they are ready for use.
|
241
|
+
"""
|
242
|
+
for service in self._before_boot_service_providers:
|
243
|
+
_environment_provider : ServiceProvider = service(app=self.container)
|
244
|
+
_environment_provider.register()
|
245
|
+
_environment_provider.boot()
|
227
246
|
|
228
247
|
def _bootstraping(self):
|
229
248
|
"""
|
230
|
-
Loads
|
249
|
+
Loads configuration, commands, environment variables, and other bootstrappers.
|
231
250
|
|
232
|
-
This method initializes the
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
251
|
+
This method initializes and updates the class dictionaries with the results
|
252
|
+
from various bootstrappers. It ensures that the application has the necessary
|
253
|
+
configuration, commands, and environment variables loaded before proceeding
|
254
|
+
with the rest of the bootstrapping process.
|
255
|
+
"""
|
256
|
+
singletons_bootstrappers = [
|
257
|
+
(self._config, ConfigBootstrapper),
|
258
|
+
(self._commands, CommandsBootstrapper),
|
259
|
+
(self._environment_vars, EnvironmentBootstrapper)
|
260
|
+
]
|
261
|
+
for bootstrapper in singletons_bootstrappers:
|
262
|
+
property_cls, bootstrapper_class = bootstrapper
|
263
|
+
bootstrapper_key = self.singleton(bootstrapper_class)
|
264
|
+
bootstrapper_instance : IBootstrapper = self.make(bootstrapper_key)
|
265
|
+
property_cls.update(bootstrapper_instance.get())
|
266
|
+
|
267
|
+
def _loadCommands(self):
|
268
|
+
"""
|
269
|
+
Loads CLI commands, including both core system commands and those defined by the developer.
|
270
|
+
|
271
|
+
This method iterates over the commands stored in the `_commands` attribute, binds each command
|
272
|
+
to its corresponding concrete implementation, and registers the command alias.
|
250
273
|
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
274
|
+
Parameters
|
275
|
+
----------
|
276
|
+
None
|
277
|
+
|
278
|
+
Returns
|
279
|
+
-------
|
280
|
+
None
|
281
|
+
"""
|
282
|
+
for command in self._commands.keys():
|
283
|
+
data_command:dict = self._commands[command]
|
284
|
+
id_container_concrete = self.bind(data_command.get('concrete'))
|
285
|
+
self.alias(alias=command, concrete=id_container_concrete)
|
256
286
|
|
257
287
|
def _afterBootstrapProviders(self):
|
258
288
|
"""
|
259
|
-
|
289
|
+
Loads services into the container that depend on the Bootstrap process being completed.
|
290
|
+
|
291
|
+
This method iterates over the list of service providers that need to be loaded after the
|
292
|
+
Bootstrap process. For each service provider, it creates an instance, registers it, and
|
293
|
+
then boots it.
|
260
294
|
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
_log_provider.register()
|
274
|
-
_log_provider.boot()
|
275
|
-
|
276
|
-
# Load the scheduler provider, which is responsible for managing scheduled tasks.
|
277
|
-
# Developers can interact with it through the facade "orionis.luminate.facades.scheduler.scheduler_facade.Schedule".
|
278
|
-
_schedule_provider = ScheduleServiceProvider(app=self.container)
|
279
|
-
_schedule_provider.register()
|
280
|
-
_schedule_provider.boot()
|
281
|
-
|
282
|
-
# Load the commands provider, which is responsible for executing and managing CLI commands.
|
283
|
-
# Developers can interact with it through the facade "orionis.luminate.facades.commands.commands_facade.Commands".
|
284
|
-
_commands_provider = ReactorCommandsServiceProvider(app=self.container)
|
285
|
-
_commands_provider.register()
|
286
|
-
_commands_provider.boot()
|
295
|
+
Parameters
|
296
|
+
----------
|
297
|
+
None
|
298
|
+
|
299
|
+
Returns
|
300
|
+
-------
|
301
|
+
None
|
302
|
+
"""
|
303
|
+
for service in self._after_boot_service_providers:
|
304
|
+
_environment_provider : ServiceProvider = service(app=self.container)
|
305
|
+
_environment_provider.register()
|
306
|
+
_environment_provider.boot()
|
@@ -75,7 +75,7 @@ class Container(IContainer):
|
|
75
75
|
If the service is already registered.
|
76
76
|
"""
|
77
77
|
if self.has(obj):
|
78
|
-
raise OrionisContainerValueError("The service is already registered in the container.")
|
78
|
+
raise OrionisContainerValueError(f"The service ({str(obj)}) is already registered in the container.")
|
79
79
|
|
80
80
|
def _ensureIsCallable(self, concrete: Callable[..., Any]) -> None:
|
81
81
|
"""
|
@@ -2,7 +2,7 @@ import importlib
|
|
2
2
|
import pathlib
|
3
3
|
from dataclasses import asdict
|
4
4
|
from typing import Any, Dict
|
5
|
-
from orionis.contracts.
|
5
|
+
from orionis.contracts.foundation.config.i_config_bootstrapper import IConfigBootstrapper
|
6
6
|
from orionis.contracts.config.i_config import IConfig
|
7
7
|
from orionis.luminate.foundation.exceptions.exception_bootstrapper import BootstrapRuntimeError
|
8
8
|
|
@@ -2,7 +2,7 @@ import pathlib
|
|
2
2
|
import importlib
|
3
3
|
import inspect
|
4
4
|
from typing import Any, Callable, Dict, List
|
5
|
-
from orionis.contracts.
|
5
|
+
from orionis.contracts.foundation.console.i_command_bootstrapper import ICommandsBootstrapper
|
6
6
|
from orionis.luminate.foundation.exceptions.exception_bootstrapper import BootstrapRuntimeError
|
7
7
|
from orionis.luminate.console.base.command import BaseCommand
|
8
8
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
from typing import Dict
|
2
|
-
from orionis.contracts.
|
2
|
+
from orionis.contracts.foundation.environment.i_environment_bootstrapper import IEnvironmentBootstrapper
|
3
3
|
from orionis.luminate.facades.app import app
|
4
4
|
from orionis.luminate.services.environment.environment_service import EnvironmentService
|
5
5
|
|
@@ -1,10 +1,98 @@
|
|
1
|
+
import importlib
|
2
|
+
import inspect
|
3
|
+
import pathlib
|
4
|
+
from orionis.contracts.foundation.providers.i_service_providers_bootstrapper import IServiceProvidersBootstrapper
|
1
5
|
from orionis.luminate.container.container import Container
|
6
|
+
from orionis.luminate.foundation.exceptions.exception_bootstrapper import BootstrapRuntimeError
|
7
|
+
from orionis.luminate.providers.service_provider import ServiceProvider
|
2
8
|
|
3
|
-
class ServiceProvidersBootstrapper:
|
9
|
+
class ServiceProvidersBootstrapper(IServiceProvidersBootstrapper):
|
4
10
|
|
5
11
|
def __init__(self, container : Container) -> None:
|
6
12
|
self._container = container
|
13
|
+
self._before_providers = []
|
14
|
+
self._after_providers = []
|
7
15
|
self._autoload()
|
8
16
|
|
9
17
|
def _autoload(self) -> None:
|
10
|
-
|
18
|
+
"""
|
19
|
+
Scans the provider directories and loads provider classes.
|
20
|
+
|
21
|
+
This method searches for Python files in the specified directories, imports them,
|
22
|
+
and registers any class that inherits from `ServiceProvider`.
|
23
|
+
|
24
|
+
Raises
|
25
|
+
------
|
26
|
+
BootstrapRuntimeError
|
27
|
+
If there is an error loading a module.
|
28
|
+
"""
|
29
|
+
|
30
|
+
base_path = pathlib.Path.cwd()
|
31
|
+
|
32
|
+
command_dirs = [
|
33
|
+
pathlib.Path(__file__).resolve().parent.parent.parent / "providers"
|
34
|
+
]
|
35
|
+
|
36
|
+
for cmd_dir in command_dirs:
|
37
|
+
if not cmd_dir.is_dir():
|
38
|
+
continue
|
39
|
+
|
40
|
+
for file_path in cmd_dir.rglob("*.py"):
|
41
|
+
if file_path.name == "__init__.py":
|
42
|
+
continue
|
43
|
+
|
44
|
+
module_path = ".".join(file_path.relative_to(base_path).with_suffix("").parts)
|
45
|
+
|
46
|
+
# Remove 'site-packages.' prefix if present
|
47
|
+
if 'site-packages.' in module_path:
|
48
|
+
module_path = module_path.split('site-packages.')[1]
|
49
|
+
|
50
|
+
try:
|
51
|
+
module = importlib.import_module(module_path.strip())
|
52
|
+
|
53
|
+
# Find and register command classes
|
54
|
+
for name, concrete in inspect.getmembers(module, inspect.isclass):
|
55
|
+
if issubclass(concrete, ServiceProvider) and concrete is not ServiceProvider:
|
56
|
+
self._register(concrete)
|
57
|
+
except Exception as e:
|
58
|
+
raise BootstrapRuntimeError(f"Error loading {module_path}") from e
|
59
|
+
|
60
|
+
def _register(self, concrete: ServiceProvider) -> None:
|
61
|
+
"""
|
62
|
+
Validates and registers a service provider class.
|
63
|
+
|
64
|
+
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.
|
67
|
+
|
68
|
+
Parameters
|
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)
|
77
|
+
|
78
|
+
def getBeforeServiceProviders(self) -> list:
|
79
|
+
"""
|
80
|
+
Retrieve the registered service providers.
|
81
|
+
|
82
|
+
Returns
|
83
|
+
-------
|
84
|
+
list
|
85
|
+
A list of registered service providers
|
86
|
+
"""
|
87
|
+
return self._before_providers
|
88
|
+
|
89
|
+
def getAfterServiceProviders(self) -> list:
|
90
|
+
"""
|
91
|
+
Retrieve the registered service providers.
|
92
|
+
|
93
|
+
Returns
|
94
|
+
-------
|
95
|
+
list
|
96
|
+
A list of registered service providers
|
97
|
+
"""
|
98
|
+
return self._after_providers
|
@@ -4,15 +4,12 @@ from orionis.luminate.services.files.path_resolver_service import PathResolverSe
|
|
4
4
|
|
5
5
|
class EnvironmentServiceProvider(ServiceProvider):
|
6
6
|
|
7
|
+
beferoBootstrapping = True
|
8
|
+
|
7
9
|
def register(self) -> None:
|
8
10
|
"""
|
9
11
|
Registers services or bindings into the given container.
|
10
12
|
"""
|
11
|
-
self.beferoBootstrapping = True
|
12
|
-
|
13
|
-
if not self.app.bound(PathResolverService):
|
14
|
-
self.app.singleton(PathResolverService)
|
15
|
-
|
16
13
|
self._container_id = self.app.singleton(EnvironmentService)
|
17
14
|
|
18
15
|
def boot(self) -> None:
|
@@ -3,11 +3,12 @@ from orionis.luminate.services.files.path_resolver_service import PathResolverSe
|
|
3
3
|
|
4
4
|
class PathResolverProvider(ServiceProvider):
|
5
5
|
|
6
|
+
beferoBootstrapping = True
|
7
|
+
|
6
8
|
def register(self) -> None:
|
7
9
|
"""
|
8
10
|
Registers services or bindings into the given container.
|
9
11
|
"""
|
10
|
-
self.beferoBootstrapping = True
|
11
12
|
self._container_id = self.app.singleton(PathResolverService)
|
12
13
|
|
13
14
|
def boot(self) -> None:
|
@@ -11,6 +11,10 @@ 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
|
+
|
14
18
|
def __init__(self, app : Container) -> None:
|
15
19
|
"""
|
16
20
|
Initialize the service provider with the given container.
|
@@ -21,7 +25,6 @@ class ServiceProvider(IServiceProvider):
|
|
21
25
|
The container instance to be used by the service provider.
|
22
26
|
"""
|
23
27
|
self.app = app
|
24
|
-
self.beferoBootstrapping = False
|
25
28
|
|
26
29
|
def register(self) -> None:
|
27
30
|
"""
|
@@ -1,9 +1,9 @@
|
|
1
1
|
import logging
|
2
2
|
import os
|
3
|
+
from pathlib import Path
|
3
4
|
import re
|
4
5
|
from datetime import datetime
|
5
6
|
from logging.handlers import RotatingFileHandler, TimedRotatingFileHandler
|
6
|
-
from pathlib import Path
|
7
7
|
from orionis.contracts.services.log.i_log_service import ILogguerService
|
8
8
|
from orionis.luminate.services.config.config_service import ConfigService
|
9
9
|
|
@@ -69,11 +69,16 @@ class LogguerService(ILogguerService):
|
|
69
69
|
"""
|
70
70
|
try:
|
71
71
|
|
72
|
+
base = Path(self.config_service.get("logging.base_path", os.getcwd()))
|
73
|
+
default_path = base / "storage" / "logs"
|
74
|
+
default_path.mkdir(parents=True, exist_ok=True)
|
75
|
+
default_path = default_path / "orionis.log"
|
76
|
+
|
72
77
|
handlers = []
|
73
78
|
|
74
79
|
channel : str = self.config_service.get("logging.default")
|
75
80
|
config : dict = self.config_service.get(f"logging.channels.{channel}", {})
|
76
|
-
path : str = config.get("path",
|
81
|
+
path : str = config.get("path", default_path)
|
77
82
|
app_timezone : str = self.config_service.get("app.timezone", "UTC")
|
78
83
|
|
79
84
|
if channel == "stack":
|
@@ -1,10 +1,7 @@
|
|
1
1
|
orionis/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
2
|
orionis/cli_manager.py,sha256=0bM-hABXJSoPGuvEgnqeaj9qcLP8VjTQ3z9Mb0TSEUI,1381
|
3
|
-
orionis/framework.py,sha256=
|
3
|
+
orionis/framework.py,sha256=QMV7gtdwA98KhqCZ7Lg7Scvis94cgnJe4-d8SMqhhf8,1387
|
4
4
|
orionis/contracts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
5
|
-
orionis/contracts/bootstrap/i_command_bootstrapper.py,sha256=cfpYWSlNhOY1q_C9o0H7F381OoM0Oh0qaeqP-c85nzk,2457
|
6
|
-
orionis/contracts/bootstrap/i_config_bootstrapper.py,sha256=d2TXT74H2fCBbzWgrt9-ZG11S_H_YPQOEcJoIOrsgb0,4462
|
7
|
-
orionis/contracts/bootstrap/i_environment_bootstrapper.py,sha256=MEeZmh0XWvzvWHFB5ZOp5SKY89F1IHsIXJvdjmEncJU,1076
|
8
5
|
orionis/contracts/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
9
6
|
orionis/contracts/config/i_config.py,sha256=rbeojO2gm8XhSXIPY8EnUt4e0wO633OKF9Nx_tN5y60,785
|
10
7
|
orionis/contracts/console/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -34,6 +31,16 @@ orionis/contracts/facades/log/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5N
|
|
34
31
|
orionis/contracts/facades/log/i_log_facade.py,sha256=xkdR6nMAENv9NLOFUAnk1WRh9bYuisSAhnlkdlD5O7g,1894
|
35
32
|
orionis/contracts/facades/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
36
33
|
orionis/contracts/facades/tests/i_tests_facade.py,sha256=GM6d9skPZwynx1lu_abfuJ_L5GvG9b12vI-KX7phYJc,890
|
34
|
+
orionis/contracts/foundation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
35
|
+
orionis/contracts/foundation/i_bootstraper.py,sha256=9IFxjUW5akHTUb_BLwxiy88OIJkl0bptUOBVdfnk2PU,1165
|
36
|
+
orionis/contracts/foundation/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
37
|
+
orionis/contracts/foundation/config/i_config_bootstrapper.py,sha256=d2TXT74H2fCBbzWgrt9-ZG11S_H_YPQOEcJoIOrsgb0,4462
|
38
|
+
orionis/contracts/foundation/console/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
39
|
+
orionis/contracts/foundation/console/i_command_bootstrapper.py,sha256=cfpYWSlNhOY1q_C9o0H7F381OoM0Oh0qaeqP-c85nzk,2457
|
40
|
+
orionis/contracts/foundation/environment/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
41
|
+
orionis/contracts/foundation/environment/i_environment_bootstrapper.py,sha256=MEeZmh0XWvzvWHFB5ZOp5SKY89F1IHsIXJvdjmEncJU,1076
|
42
|
+
orionis/contracts/foundation/providers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
43
|
+
orionis/contracts/foundation/providers/i_service_providers_bootstrapper.py,sha256=iwILmTiDQBENOjJprCeAnZb-1YNeW_5PQUXDU_P6vog,1654
|
37
44
|
orionis/contracts/installer/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
38
45
|
orionis/contracts/installer/i_installer_manager.py,sha256=Zfndhuyu0JaTKo3PsGsKmVsvotQMw8Pmt4KQp97elY8,1567
|
39
46
|
orionis/contracts/installer/i_installer_output.py,sha256=SQZeXg5HRu-x1697HCdoU1-RVJWEqCWY-zNboWnc_vs,2897
|
@@ -60,7 +67,7 @@ orionis/installer/installer_manager.py,sha256=Hb6T0bmSl39T30maY-nUWkrLhG77JdrKe4
|
|
60
67
|
orionis/installer/installer_output.py,sha256=LeKxzuXpnHOKbKpUtx3tMGkCi2bGcPV1VNnfBxwfxUU,7161
|
61
68
|
orionis/installer/installer_setup.py,sha256=c2HtVklSa-2_-YVonc7fwtoK-RTDqBS2Ybvbekgfqtc,6970
|
62
69
|
orionis/luminate/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
63
|
-
orionis/luminate/app.py,sha256=
|
70
|
+
orionis/luminate/app.py,sha256=jlIVn5qeKmtERlRDu-r9imjNf8WjvmR5ySS18JlSbv8,12025
|
64
71
|
orionis/luminate/app_context.py,sha256=se2xpsGoy_drcuOROC7OHaIAN5Yd0kbm5V1zzsxxyQc,996
|
65
72
|
orionis/luminate/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
66
73
|
orionis/luminate/config/app.py,sha256=7teuVPuaV2ao0M5Bv-jhSgjEwb9DtVwde2saTRmYru4,1737
|
@@ -92,7 +99,7 @@ orionis/luminate/console/output/console.py,sha256=khlnCmhGW3Iu2YYO8GG7YLtnLeqysy
|
|
92
99
|
orionis/luminate/console/output/executor.py,sha256=0_6AGM1vE5umdpVVogQUE5eW9cu5UUQwc-ZvuccTI8E,3362
|
93
100
|
orionis/luminate/console/output/progress_bar.py,sha256=ssi8Drryr-shl7OxweTgGOhvRvAlCVxjBGm1L1qyO84,3089
|
94
101
|
orionis/luminate/console/output/styles.py,sha256=2e1_FJdNpKaVqmdlCx-udzTleH_6uEFE9_TjH7T1ZUk,3696
|
95
|
-
orionis/luminate/container/container.py,sha256=
|
102
|
+
orionis/luminate/container/container.py,sha256=kg1zrvlMrzYCrORbDZ12JVZJ_z81gLDUpfLsAjxRgpU,17006
|
96
103
|
orionis/luminate/container/exception.py,sha256=ap1SqYEjQEEHXJJTNmL7V1jrmRjgT5_7geZ95MYkhMA,1691
|
97
104
|
orionis/luminate/container/types.py,sha256=BDcXN0__voRNHZ5Gr5dF0sWIYAQyNk4TxAwILBWyDAA,1735
|
98
105
|
orionis/luminate/facades/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -112,28 +119,28 @@ orionis/luminate/facades/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5
|
|
112
119
|
orionis/luminate/facades/tests/tests_facade.py,sha256=eH_fyXjzEVw8aqEwxAgSujFUItz2woau6hc2Mf4VlkE,1660
|
113
120
|
orionis/luminate/foundation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
114
121
|
orionis/luminate/foundation/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
115
|
-
orionis/luminate/foundation/config/config_bootstrapper.py,sha256=
|
122
|
+
orionis/luminate/foundation/config/config_bootstrapper.py,sha256=42OIgBLX0R2hW0wSkDqqKmZl4aKBjYCcH52nuEBgy9M,7494
|
116
123
|
orionis/luminate/foundation/console/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
117
|
-
orionis/luminate/foundation/console/command_bootstrapper.py,sha256=
|
124
|
+
orionis/luminate/foundation/console/command_bootstrapper.py,sha256=7m_lME1qou9fpy3U7OGArO6KhU448qA-oTB4tVxosTs,7057
|
118
125
|
orionis/luminate/foundation/environment/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
119
|
-
orionis/luminate/foundation/environment/environment_bootstrapper.py,sha256=
|
126
|
+
orionis/luminate/foundation/environment/environment_bootstrapper.py,sha256=15xpmzUjnFfFlo-zg7w-WbJiQPlEjVr-i2VufMsnZhs,2790
|
120
127
|
orionis/luminate/foundation/exceptions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
121
128
|
orionis/luminate/foundation/exceptions/exception_bootstrapper.py,sha256=wDKfEW295c7-bavr7YUHK2CLYcTSZgjT9ZRSBne6GOE,1356
|
122
129
|
orionis/luminate/foundation/providers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
123
|
-
orionis/luminate/foundation/providers/service_providers_bootstrapper.py,sha256=
|
130
|
+
orionis/luminate/foundation/providers/service_providers_bootstrapper.py,sha256=YS_fBrwc-2qcVq_W1Y5sblOHpFuz67xLXmhhhPNrHNI,3480
|
124
131
|
orionis/luminate/patterns/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
125
132
|
orionis/luminate/patterns/singleton.py,sha256=b3U0nubKSQWyal5wTXADVPtOztkaTk-M8Zwy-bje1L0,1425
|
126
133
|
orionis/luminate/providers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
127
|
-
orionis/luminate/providers/service_provider.py,sha256=
|
134
|
+
orionis/luminate/providers/service_provider.py,sha256=7Hz33bMmSZ11H_4x8-h4IAVqlTByPr_l8tfZEYe8gIM,1639
|
128
135
|
orionis/luminate/providers/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
129
136
|
orionis/luminate/providers/commands/reactor_commands_service_provider.py,sha256=3HX3wwPCH_Y9OsoTyfC4_LrNlPW_-UaffDcz3Wehuvk,701
|
130
137
|
orionis/luminate/providers/commands/scheduler_provider.py,sha256=owOzdGIZmkeTFJQ3yyG8Hk2Kb8l-jXmaJHAo7v3_uAk,670
|
131
138
|
orionis/luminate/providers/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
132
139
|
orionis/luminate/providers/config/config_service_provider.py,sha256=NLKB3Vcu4kqZ0WyeImMG3CsclSu_P4aWs6yXitcv474,659
|
133
140
|
orionis/luminate/providers/environment/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
134
|
-
orionis/luminate/providers/environment/environment__service_provider.py,sha256=
|
141
|
+
orionis/luminate/providers/environment/environment__service_provider.py,sha256=2BsofUJzU0_Z8FG7BDVNco4httxxY_ifu-qe-L1okUs,807
|
135
142
|
orionis/luminate/providers/files/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
136
|
-
orionis/luminate/providers/files/paths_provider.py,sha256=
|
143
|
+
orionis/luminate/providers/files/paths_provider.py,sha256=bZVuOVn44ysE_NPupxe9xZPP0D3ay5Ztdnsbi-Fv43o,712
|
137
144
|
orionis/luminate/providers/log/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
138
145
|
orionis/luminate/providers/log/log_service_provider.py,sha256=tcWDEI-fubi1mWSS-IKiRReuc0pRMHpxvbvuDgs2Uy0,654
|
139
146
|
orionis/luminate/services/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -147,7 +154,7 @@ orionis/luminate/services/environment/environment_service.py,sha256=IgrfzLELNhnE
|
|
147
154
|
orionis/luminate/services/files/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
148
155
|
orionis/luminate/services/files/path_resolver_service.py,sha256=Xsxrp-WIQLwKldW98p1dggb_BvDV9MDo-9MWNxiWCD0,1811
|
149
156
|
orionis/luminate/services/log/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
150
|
-
orionis/luminate/services/log/log_service.py,sha256=
|
157
|
+
orionis/luminate/services/log/log_service.py,sha256=vaGw2VXCIiaUcPD90BFNtmB2O2pKm9MZdUs5xg9rxEE,8382
|
151
158
|
orionis/luminate/support/dot_dict.py,sha256=FVHfBuAGTTVMjNG01Fix645fRNKKUMmNx61pYkxPL5c,1253
|
152
159
|
orionis/luminate/support/exception_to_dict.py,sha256=jpQ-c7ud1JLm8dTWbvMT1dI-rL3yTB2P8VxNscAX71k,2098
|
153
160
|
orionis/luminate/support/reflection.py,sha256=VYpluTQJ0W_m6jYQ9_L02sYFrk2wlLYtLY2yp9rZMKA,11944
|
@@ -168,9 +175,9 @@ tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
168
175
|
tests/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
169
176
|
tests/tools/class_example.py,sha256=dIPD997Y15n6WmKhWoOFSwEldRm9MdOHTZZ49eF1p3c,1056
|
170
177
|
tests/tools/test_reflection.py,sha256=bhLQ7VGVod4B8sv-rW9AjnOumvaBVsoxieA3sdoM2yM,5244
|
171
|
-
orionis-0.
|
172
|
-
orionis-0.
|
173
|
-
orionis-0.
|
174
|
-
orionis-0.
|
175
|
-
orionis-0.
|
176
|
-
orionis-0.
|
178
|
+
orionis-0.110.0.dist-info/LICENCE,sha256=-_4cF2EBKuYVS_SQpy1uapq0oJPUU1vl_RUWSy2jJTo,1111
|
179
|
+
orionis-0.110.0.dist-info/METADATA,sha256=tw-h4q3EINRhXMBX4TgrYPqF7P6auRBvipJBz_wrXH8,2979
|
180
|
+
orionis-0.110.0.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
181
|
+
orionis-0.110.0.dist-info/entry_points.txt,sha256=eef1_CVewfokKjrGBynXa06KabSJYo7LlDKKIKvs1cM,53
|
182
|
+
orionis-0.110.0.dist-info/top_level.txt,sha256=2bdoHgyGZhOtLAXS6Om8OCTmL24dUMC_L1quMe_ETbk,14
|
183
|
+
orionis-0.110.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|