orionis 0.43.0__py3-none-any.whl → 0.46.0__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
Files changed (173) hide show
  1. orionis/cli_manager.py +16 -30
  2. orionis/contracts/bootstrap/i_command_bootstrapper.py +59 -0
  3. orionis/contracts/bootstrap/i_config_bootstrapper.py +112 -0
  4. orionis/contracts/bootstrap/i_environment_bootstrapper.py +33 -0
  5. orionis/{luminate/contracts/console/base/base_command_interface.py → contracts/console/base/i_command.py} +0 -1
  6. orionis/contracts/facades/config/i_config_facade.py +37 -0
  7. orionis/contracts/facades/environment/i_environment_facade.py +40 -0
  8. orionis/{luminate/contracts/facades/paths_interface.py → contracts/facades/files/i_path_facade.py} +27 -20
  9. orionis/contracts/facades/log/i_log_facade.py +83 -0
  10. orionis/{luminate/contracts/facades/tests_interface.py → contracts/facades/tests/i_tests_facade.py} +3 -6
  11. orionis/{luminate/contracts/console/scripts/management_interface.py → contracts/installer/i_installer_manager.py} +19 -16
  12. orionis/contracts/installer/i_installer_output.py +101 -0
  13. orionis/contracts/installer/i_installer_setup.py +59 -0
  14. orionis/contracts/providers/i_service_provider.py +27 -0
  15. orionis/contracts/services/config/i_config_service.py +37 -0
  16. orionis/contracts/services/files/i_path_service.py +31 -0
  17. orionis/contracts/services/log/i_log_service.py +89 -0
  18. orionis/{luminate/facades/environment.py → contracts/support/i_environment.py} +25 -32
  19. orionis/{luminate/contracts/tools/exception_to_dict_interface.py → contracts/support/i_exception_to_dict.py} +0 -9
  20. orionis/{luminate/contracts/tools/reflection_interface.py → contracts/support/i_reflection.py} +17 -8
  21. orionis/{luminate/contracts/tools/std_interface.py → contracts/support/i_std.py} +3 -16
  22. orionis/framework.py +1 -1
  23. orionis/{luminate/console/scripts/management.py → installer/installer_manager.py} +22 -16
  24. orionis/{luminate/installer/output.py → installer/installer_output.py} +16 -10
  25. orionis/{luminate/installer/setup.py → installer/installer_setup.py} +13 -25
  26. orionis/luminate/app.py +15 -11
  27. orionis/luminate/app_context.py +1 -1
  28. orionis/luminate/bootstrap/command_bootstrapper.py +150 -0
  29. orionis/luminate/bootstrap/config_bootstrapper.py +168 -0
  30. orionis/luminate/bootstrap/environment_bootstrapper.py +67 -0
  31. orionis/luminate/config/helpers.py +20 -0
  32. orionis/luminate/console/base/command.py +1 -3
  33. orionis/luminate/console/command_filter.py +2 -2
  34. orionis/luminate/console/commands/cache_clear.py +17 -5
  35. orionis/luminate/console/commands/help.py +19 -13
  36. orionis/luminate/console/commands/schedule_work.py +6 -3
  37. orionis/luminate/console/commands/tests.py +1 -6
  38. orionis/luminate/console/commands/version.py +0 -5
  39. orionis/luminate/console/exceptions/cli_exception.py +1 -4
  40. orionis/luminate/console/kernel.py +2 -2
  41. orionis/luminate/console/output/console.py +2 -2
  42. orionis/luminate/console/output/executor.py +1 -1
  43. orionis/luminate/console/output/progress_bar.py +1 -1
  44. orionis/luminate/console/parser.py +2 -2
  45. orionis/luminate/console/runner.py +127 -126
  46. orionis/luminate/console/tasks/scheduler.py +8 -7
  47. orionis/luminate/container/container.py +1 -1
  48. orionis/luminate/container/types.py +38 -12
  49. orionis/luminate/facades/config/config_facade.py +43 -0
  50. orionis/luminate/facades/environment/environment_facade.py +68 -0
  51. orionis/luminate/facades/{paths.py → files/path_facade.py} +50 -6
  52. orionis/luminate/facades/log/__init__.py +0 -0
  53. orionis/luminate/facades/log/log_facade.py +95 -0
  54. orionis/luminate/facades/tests/__init__.py +0 -0
  55. orionis/luminate/facades/{tests.py → tests/tests_facade.py} +1 -1
  56. orionis/luminate/patterns/__init__.py +0 -0
  57. orionis/luminate/pipelines/cli_pipeline.py +122 -116
  58. orionis/luminate/providers/__init__.py +0 -0
  59. orionis/luminate/providers/config/__init__.py +0 -0
  60. orionis/luminate/providers/config/config_service_provider.py +26 -0
  61. orionis/luminate/providers/files/__init__.py +0 -0
  62. orionis/luminate/providers/files/path_service_provider.py +26 -0
  63. orionis/luminate/providers/log/__init__.py +0 -0
  64. orionis/luminate/providers/log/log_service_provider.py +26 -0
  65. orionis/luminate/services/__init__.py +0 -0
  66. orionis/luminate/services/config/__init__.py +0 -0
  67. orionis/luminate/services/config/config_service.py +72 -0
  68. orionis/luminate/services/files/__init__.py +0 -0
  69. orionis/luminate/services/files/path_service.py +71 -0
  70. orionis/luminate/services/log/__init__.py +0 -0
  71. orionis/luminate/services/log/log_service.py +159 -0
  72. orionis/luminate/{config → support}/environment.py +21 -32
  73. orionis/luminate/{tools → support}/exception_to_dict.py +1 -1
  74. orionis/luminate/{tools → support}/reflection.py +1 -1
  75. orionis/luminate/{tools → support}/std.py +1 -1
  76. orionis/luminate/test/unit_test.py +1 -2
  77. {orionis-0.43.0.dist-info → orionis-0.46.0.dist-info}/METADATA +1 -1
  78. orionis-0.46.0.dist-info/RECORD +157 -0
  79. tests/tools/test_reflection.py +1 -1
  80. orionis/luminate/bootstrap/commands/bootstrapper.py +0 -101
  81. orionis/luminate/bootstrap/commands/register.py +0 -92
  82. orionis/luminate/bootstrap/config/bootstrapper.py +0 -79
  83. orionis/luminate/bootstrap/config/parser.py +0 -53
  84. orionis/luminate/bootstrap/config/register.py +0 -76
  85. orionis/luminate/cache/app/config.py +0 -91
  86. orionis/luminate/cache/console/commands.py +0 -97
  87. orionis/luminate/console/cache.py +0 -87
  88. orionis/luminate/console/command.py +0 -40
  89. orionis/luminate/contracts/bootstrap/commands/bootstrapper_interface.py +0 -44
  90. orionis/luminate/contracts/bootstrap/commands/register_interface.py +0 -33
  91. orionis/luminate/contracts/bootstrap/config/bootstrapper_interface.py +0 -40
  92. orionis/luminate/contracts/bootstrap/config/parser_interface.py +0 -46
  93. orionis/luminate/contracts/bootstrap/config/register_interface.py +0 -47
  94. orionis/luminate/contracts/cache/app/config_interface.py +0 -76
  95. orionis/luminate/contracts/cache/console/commands_interface.py +0 -78
  96. orionis/luminate/contracts/config/environment_interface.py +0 -64
  97. orionis/luminate/contracts/console/command_interface.py +0 -36
  98. orionis/luminate/contracts/console/runner_interface.py +0 -50
  99. orionis/luminate/contracts/facades/env_interface.py +0 -64
  100. orionis/luminate/contracts/facades/log_interface.py +0 -48
  101. orionis/luminate/contracts/files/paths_interface.py +0 -29
  102. orionis/luminate/contracts/installer/output_interface.py +0 -125
  103. orionis/luminate/contracts/installer/setup_interface.py +0 -29
  104. orionis/luminate/contracts/installer/upgrade_interface.py +0 -24
  105. orionis/luminate/contracts/log/logger_interface.py +0 -33
  106. orionis/luminate/contracts/pipelines/cli_pipeline_interface.py +0 -84
  107. orionis/luminate/contracts/publisher/pypi_publisher_interface.py +0 -36
  108. orionis/luminate/contracts/test/unit_test_interface.py +0 -51
  109. orionis/luminate/facades/config.py +0 -10
  110. orionis/luminate/facades/log.py +0 -56
  111. orionis/luminate/files/paths.py +0 -56
  112. orionis/luminate/installer/upgrade.py +0 -42
  113. orionis/luminate/log/logger.py +0 -116
  114. orionis/luminate/publisher/pypi.py +0 -215
  115. orionis-0.43.0.dist-info/RECORD +0 -156
  116. /orionis/{luminate/bootstrap/config → contracts}/__init__.py +0 -0
  117. /orionis/{luminate/cache → contracts/config}/__init__.py +0 -0
  118. /orionis/{luminate/contracts/config/config_interface.py → contracts/config/i_config.py} +0 -0
  119. /orionis/{luminate/cache/app → contracts/console}/__init__.py +0 -0
  120. /orionis/{luminate/cache/console → contracts/console/base}/__init__.py +0 -0
  121. /orionis/{luminate/contracts/console/command_filter_interface.py → contracts/console/i_command_filter.py} +0 -0
  122. /orionis/{luminate/contracts/console/kernel_interface.py → contracts/console/i_kernel.py} +0 -0
  123. /orionis/{luminate/contracts/console/parser_interface.py → contracts/console/i_parser.py} +0 -0
  124. /orionis/{luminate/contracts/console/task_manager_interface.py → contracts/console/i_task_manager.py} +0 -0
  125. /orionis/{luminate/config/dataclass → contracts/console/output}/__init__.py +0 -0
  126. /orionis/{luminate/contracts/console/output/console_interface.py → contracts/console/output/i_console.py} +0 -0
  127. /orionis/{luminate/contracts/console/output/executor_interface.py → contracts/console/output/i_executor.py} +0 -0
  128. /orionis/{luminate/contracts/console/output/progress_bar_interface.py → contracts/console/output/i_progress_bar.py} +0 -0
  129. /orionis/{luminate/console/scripts → contracts/console/tasks}/__init__.py +0 -0
  130. /orionis/{luminate/contracts/console/tasks/schedule_interface.py → contracts/console/tasks/i_schedule.py} +0 -0
  131. /orionis/{luminate/contracts/container/container_interface.py → contracts/container/i_container.py} +0 -0
  132. /orionis/{luminate/contracts/container/types_interface.py → contracts/container/i_types.py} +0 -0
  133. /orionis/{luminate/contracts → contracts/facades}/__init__.py +0 -0
  134. /orionis/{luminate/contracts/cache → contracts/facades/config}/__init__.py +0 -0
  135. /orionis/{luminate/contracts/config → contracts/facades/environment}/__init__.py +0 -0
  136. /orionis/{luminate/contracts/console → contracts/facades/files}/__init__.py +0 -0
  137. /orionis/{luminate/contracts/facades → contracts/facades/log}/__init__.py +0 -0
  138. /orionis/{luminate/contracts/files → contracts/facades/tests}/__init__.py +0 -0
  139. /orionis/{luminate/contracts → contracts}/installer/__init__.py +0 -0
  140. /orionis/{luminate/contracts/log → contracts/providers}/__init__.py +0 -0
  141. /orionis/{luminate/contracts/publisher → contracts/services}/__init__.py +0 -0
  142. /orionis/{luminate/contracts/test → contracts/services/config}/__init__.py +0 -0
  143. /orionis/{luminate/contracts/tools → contracts/services/files}/__init__.py +0 -0
  144. /orionis/{luminate/files → contracts/services/log}/__init__.py +0 -0
  145. /orionis/{luminate/installer → installer}/__init__.py +0 -0
  146. /orionis/luminate/bootstrap/{cli_exception.py → exception_bootstrapper.py} +0 -0
  147. /orionis/luminate/config/{dataclass/app.py → app.py} +0 -0
  148. /orionis/luminate/config/{dataclass/auth.py → auth.py} +0 -0
  149. /orionis/luminate/config/{dataclass/cache.py → cache.py} +0 -0
  150. /orionis/luminate/config/{dataclass/cors.py → cors.py} +0 -0
  151. /orionis/luminate/config/{dataclass/database.py → database.py} +0 -0
  152. /orionis/luminate/config/{dataclass/filesystems.py → filesystems.py} +0 -0
  153. /orionis/luminate/config/{dataclass/logging.py → logging.py} +0 -0
  154. /orionis/luminate/config/{dataclass/mail.py → mail.py} +0 -0
  155. /orionis/luminate/config/{dataclass/queue.py → queue.py} +0 -0
  156. /orionis/luminate/config/{dataclass/session.py → session.py} +0 -0
  157. /orionis/luminate/{log → facades/config}/__init__.py +0 -0
  158. /orionis/luminate/{publisher → facades/environment}/__init__.py +0 -0
  159. /orionis/luminate/{tools → facades/files}/__init__.py +0 -0
  160. /orionis/luminate/{tools → support}/dot_dict.py +0 -0
  161. /orionis/{luminate/installer → static/ascii}/icon.ascii +0 -0
  162. /orionis/{luminate/installer → static/ascii}/info.ascii +0 -0
  163. /orionis/{luminate/static → static}/bg/galaxy.jpg +0 -0
  164. /orionis/{luminate/static → static}/favicon/OrionisFrameworkFavicon.png +0 -0
  165. /orionis/{luminate/static → static}/logos/OrionisFramework.jpg +0 -0
  166. /orionis/{luminate/static → static}/logos/OrionisFramework.png +0 -0
  167. /orionis/{luminate/static → static}/logos/OrionisFramework.psd +0 -0
  168. /orionis/{luminate/static → static}/logos/OrionisFramework2.png +0 -0
  169. /orionis/{luminate/static → static}/logos/OrionisFramework3.png +0 -0
  170. {orionis-0.43.0.dist-info → orionis-0.46.0.dist-info}/LICENCE +0 -0
  171. {orionis-0.43.0.dist-info → orionis-0.46.0.dist-info}/WHEEL +0 -0
  172. {orionis-0.43.0.dist-info → orionis-0.46.0.dist-info}/entry_points.txt +0 -0
  173. {orionis-0.43.0.dist-info → orionis-0.46.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,68 @@
1
+ from orionis.contracts.facades.environment.i_environment_facade import IEnv
2
+ from orionis.luminate.app_context import AppContext
3
+
4
+ def env(key: str, default=None) -> str:
5
+ """
6
+ Retrieves the value of an environment variable.
7
+
8
+ This function provides a convenient way to access environment variables
9
+ stored in the application context. If the variable does not exist, it
10
+ returns the specified default value.
11
+
12
+ Parameters
13
+ ----------
14
+ key : str
15
+ The name of the environment variable to retrieve.
16
+ default : Any, optional
17
+ The default value to return if the environment variable does not exist.
18
+ Defaults to None.
19
+
20
+ Returns
21
+ -------
22
+ str
23
+ The value of the environment variable, or the default value if the variable
24
+ does not exist.
25
+ """
26
+ with AppContext() as app:
27
+ env : dict = app._environment_vars
28
+ return env.get(key, default)
29
+
30
+ class Env(IEnv):
31
+ """
32
+ A facade class for accessing environment variables.
33
+
34
+ This class provides a static method to retrieve environment variables
35
+ stored in the application context. It implements the `IEnv` interface.
36
+
37
+ Methods
38
+ -------
39
+ get(key: str, default=None) -> str
40
+ Retrieves the value of an environment variable.
41
+ """
42
+
43
+ @staticmethod
44
+ def get(key: str, default=None) -> str:
45
+ """
46
+ Retrieves the value of an environment variable.
47
+
48
+ This method provides a convenient way to access environment variables
49
+ stored in the application context. If the variable does not exist, it
50
+ returns the specified default value.
51
+
52
+ Parameters
53
+ ----------
54
+ key : str
55
+ The name of the environment variable to retrieve.
56
+ default : Any, optional
57
+ The default value to return if the environment variable does not exist.
58
+ Defaults to None.
59
+
60
+ Returns
61
+ -------
62
+ str
63
+ The value of the environment variable, or the default value if the variable
64
+ does not exist.
65
+ """
66
+ with AppContext() as app:
67
+ env : dict = app._environment_vars
68
+ return env.get(key, default)
@@ -1,25 +1,60 @@
1
1
  import os
2
- from orionis.luminate.files.paths import SkeletonPath
3
- from orionis.luminate.contracts.facades.paths_interface import IPath
2
+ from orionis.contracts.facades.files.i_path_facade import IPath
3
+ from orionis.luminate.app_context import AppContext
4
+ from orionis.luminate.services.files.path_service import PathService
4
5
 
5
6
  class Path(IPath):
7
+ """
8
+ A facade class for resolving absolute paths to various application directories.
9
+
10
+ This class provides static methods to resolve paths to common directories such as
11
+ 'app', 'config', 'database', 'resources', 'routes', 'storage', and 'tests'.
12
+ It uses the `PathService` to resolve and validate paths.
13
+
14
+ Methods
15
+ -------
16
+ _resolve_directory(directory: str, file: str = None) -> SkeletonPath
17
+ Resolves the absolute path for a given directory and optional file.
18
+ app(file: str = None) -> SkeletonPath
19
+ Returns the absolute path for a file inside the 'app' directory.
20
+ config(file: str = None) -> SkeletonPath
21
+ Returns the absolute path for a file inside the 'config' directory.
22
+ database(file: str = None) -> SkeletonPath
23
+ Returns the absolute path for a file inside the 'database' directory.
24
+ resource(file: str = None) -> SkeletonPath
25
+ Returns the absolute path for a file inside the 'resource' directory.
26
+ routes(file: str = None) -> SkeletonPath
27
+ Returns the absolute path for a file inside the 'routes' directory.
28
+ storage(file: str = None) -> SkeletonPath
29
+ Returns the absolute path for a file inside the 'storage' directory.
30
+ tests(file: str = None) -> SkeletonPath
31
+ Returns the absolute path for a file inside the 'tests' directory.
32
+ """
6
33
 
7
34
  @staticmethod
8
35
  def _resolve_directory(directory: str, file: str = None):
9
36
  """
10
- Internal helper function to resolve an absolute path for a given directory.
37
+ Resolves the absolute path for a given directory and optional file.
38
+
39
+ This method constructs a path by joining the directory and file, normalizes it,
40
+ and resolves it using the `PathService`.
11
41
 
12
42
  Parameters
13
43
  ----------
14
44
  directory : str
15
45
  The base directory to resolve the path from.
16
46
  file : str, optional
17
- The relative file path inside the directory (default is an empty string).
47
+ The relative file path inside the directory (default is None).
18
48
 
19
49
  Returns
20
50
  -------
21
51
  SkeletonPath
22
52
  The resolved absolute path wrapped in a SkeletonPath object.
53
+
54
+ Raises
55
+ ------
56
+ ValueError
57
+ If the resolved path is invalid or cannot be resolved.
23
58
  """
24
59
  # Default to an empty string if None
25
60
  file = file or ""
@@ -30,7 +65,10 @@ class Path(IPath):
30
65
  # Normalize path (removes redundant slashes)
31
66
  route = os.path.normpath(route)
32
67
 
33
- return SkeletonPath(route).resolve()
68
+ # Obtain the path service from the container
69
+ with AppContext() as app:
70
+ path_service : PathService = app.container.make(PathService)
71
+ return path_service.resolve(route)
34
72
 
35
73
  @staticmethod
36
74
  def app(file: str = None):
@@ -171,6 +209,7 @@ def app_path(file: str = None):
171
209
  """
172
210
  return Path._resolve_directory("app", file)
173
211
 
212
+
174
213
  def config_path(file: str = None):
175
214
  """
176
215
  Returns the absolute path for a file inside the 'config' directory.
@@ -187,6 +226,7 @@ def config_path(file: str = None):
187
226
  """
188
227
  return Path._resolve_directory("config", file)
189
228
 
229
+
190
230
  def database_path(file: str = None):
191
231
  """
192
232
  Returns the absolute path for a file inside the 'database' directory.
@@ -203,6 +243,7 @@ def database_path(file: str = None):
203
243
  """
204
244
  return Path._resolve_directory("database", file)
205
245
 
246
+
206
247
  def resource_path(file: str = None):
207
248
  """
208
249
  Returns the absolute path for a file inside the 'resource' directory.
@@ -219,6 +260,7 @@ def resource_path(file: str = None):
219
260
  """
220
261
  return Path._resolve_directory("resource", file)
221
262
 
263
+
222
264
  def routes_path(file: str = None):
223
265
  """
224
266
  Returns the absolute path for a file inside the 'routes' directory.
@@ -235,6 +277,7 @@ def routes_path(file: str = None):
235
277
  """
236
278
  return Path._resolve_directory("routes", file)
237
279
 
280
+
238
281
  def storage_path(file: str = None):
239
282
  """
240
283
  Returns the absolute path for a file inside the 'storage' directory.
@@ -251,6 +294,7 @@ def storage_path(file: str = None):
251
294
  """
252
295
  return Path._resolve_directory("storage", file)
253
296
 
297
+
254
298
  def tests_path(file: str = None):
255
299
  """
256
300
  Returns the absolute path for a file inside the 'tests' directory.
@@ -265,4 +309,4 @@ def tests_path(file: str = None):
265
309
  SkeletonPath
266
310
  The resolved path wrapped in a SkeletonPath object.
267
311
  """
268
- return Path._resolve_directory("tests", file)
312
+ return Path._resolve_directory("tests", file)
File without changes
@@ -0,0 +1,95 @@
1
+ from orionis.contracts.facades.log.i_log_facade import ILog
2
+ from orionis.luminate.app_context import AppContext
3
+ from orionis.luminate.services.log.log_service import LogguerService
4
+
5
+ class Log(ILog):
6
+ """
7
+ A facade class for logging messages with different severity levels.
8
+
9
+ This class provides static methods to log messages using the `LogguerService`.
10
+ It simplifies the process of logging by abstracting the service resolution
11
+ and providing a clean interface for logging.
12
+
13
+ Methods
14
+ -------
15
+ info(message: str) -> None
16
+ Logs an informational message.
17
+ error(message: str) -> None
18
+ Logs an error message.
19
+ success(message: str) -> None
20
+ Logs a success message.
21
+ warning(message: str) -> None
22
+ Logs a warning message.
23
+ debug(message: str) -> None
24
+ Logs a debug message.
25
+ """
26
+
27
+ @staticmethod
28
+ def info(message: str) -> None:
29
+ """
30
+ Logs an informational message.
31
+
32
+ Parameters
33
+ ----------
34
+ message : str
35
+ The message to log.
36
+ """
37
+ with AppContext() as app:
38
+ log_service: LogguerService = app.container.make(LogguerService)
39
+ log_service.info(message)
40
+
41
+ @staticmethod
42
+ def error(message: str) -> None:
43
+ """
44
+ Logs an error message.
45
+
46
+ Parameters
47
+ ----------
48
+ message : str
49
+ The message to log.
50
+ """
51
+ with AppContext() as app:
52
+ log_service: LogguerService = app.container.make(LogguerService)
53
+ log_service.error(message)
54
+
55
+ @staticmethod
56
+ def success(message: str) -> None:
57
+ """
58
+ Logs a success message.
59
+
60
+ Parameters
61
+ ----------
62
+ message : str
63
+ The message to log.
64
+ """
65
+ with AppContext() as app:
66
+ log_service: LogguerService = app.container.make(LogguerService)
67
+ log_service.success(message)
68
+
69
+ @staticmethod
70
+ def warning(message: str) -> None:
71
+ """
72
+ Logs a warning message.
73
+
74
+ Parameters
75
+ ----------
76
+ message : str
77
+ The message to log.
78
+ """
79
+ with AppContext() as app:
80
+ log_service: LogguerService = app.container.make(LogguerService)
81
+ log_service.warning(message)
82
+
83
+ @staticmethod
84
+ def debug(message: str) -> None:
85
+ """
86
+ Logs a debug message.
87
+
88
+ Parameters
89
+ ----------
90
+ message : str
91
+ The message to log.
92
+ """
93
+ with AppContext() as app:
94
+ log_service: LogguerService = app.container.make(LogguerService)
95
+ log_service.debug(message)
File without changes
@@ -1,6 +1,6 @@
1
1
  import os
2
+ from orionis.contracts.facades.tests.i_tests_facade import IUnitTests
2
3
  from orionis.luminate.test.unit_test import UnitTest
3
- from orionis.luminate.contracts.facades.tests_interface import IUnitTests
4
4
 
5
5
  class UnitTests(IUnitTests):
6
6
  """
File without changes
@@ -1,116 +1,122 @@
1
- import argparse
2
- from typing import Dict, Any, Optional
3
- from orionis.luminate.console.parser import Parser
4
- from orionis.luminate.console.cache import CLICache
5
- from orionis.luminate.console.base.command import BaseCommand
6
- from orionis.luminate.contracts.pipelines.cli_pipeline_interface import ICLIPipeline
7
-
8
- class CLIPipeline(ICLIPipeline):
9
- """
10
- Handles the retrieval, parsing, and execution of CLI commands within the Orionis framework.
11
-
12
- This class is responsible for:
13
- - Retrieving command metadata from cache.
14
- - Parsing command-line arguments dynamically.
15
- - Executing the corresponding command with parsed arguments.
16
-
17
- Attributes
18
- ----------
19
- _command : dict
20
- Stores the command's metadata, including its instance and expected arguments.
21
- _parsed_arguments : argparse.Namespace
22
- Holds parsed arguments after processing user input.
23
- """
24
-
25
- def __init__(self):
26
- """
27
- Initializes the CLIPipeline instance with an empty command cache
28
- and a default argument namespace.
29
- """
30
- self._command: Dict[str, Any] = {}
31
- self._parsed_arguments: argparse.Namespace = argparse.Namespace()
32
-
33
- def getCommand(self, signature: str) -> "CLIPipeline":
34
- """
35
- Retrieves a command from the cache based on its signature.
36
-
37
- Parameters
38
- ----------
39
- signature : str
40
- The unique identifier of the command.
41
-
42
- Returns
43
- -------
44
- CLIPipeline
45
- The current instance of CLIPipeline for method chaining.
46
-
47
- Raises
48
- ------
49
- ValueError
50
- If the command signature is not found in the cache.
51
- """
52
- try:
53
- cache = CLICache().getCommands()
54
- self._command = cache.get(signature)
55
- return self
56
- except KeyError as e:
57
- raise ValueError(e)
58
-
59
- def parseArguments(self, vars: Optional[Dict[str, Any]] = None, *args, **kwargs) -> "CLIPipeline":
60
- """
61
- Parses command-line arguments using the Orionis argument parser.
62
-
63
- Parameters
64
- ----------
65
- vars : dict, optional
66
- A dictionary of predefined variables to be included in parsing.
67
- *args
68
- Positional arguments for the parser.
69
- **kwargs
70
- Keyword arguments for the parser.
71
-
72
- Returns
73
- -------
74
- CLIPipeline
75
- The current instance of CLIPipeline for method chaining.
76
-
77
- Raises
78
- ------
79
- ValueError
80
- If an error occurs during argument parsing.
81
- """
82
- try:
83
- arguments = self._command.get("arguments")
84
- if arguments:
85
- arg_parser = Parser(vars=vars or {}, args=args, kwargs=kwargs)
86
- arg_parser.setArguments(arguments=arguments)
87
- arg_parser.recognize()
88
- self._parsed_arguments = arg_parser.get()
89
-
90
- return self
91
-
92
- except Exception as e:
93
- raise ValueError(f"Error parsing arguments: {e}")
94
-
95
- def execute(self) -> Any:
96
- """
97
- Executes the retrieved command using parsed arguments.
98
-
99
- This method:
100
- - Instantiates the command class.
101
- - Calls the `handle()` method, passing the parsed arguments.
102
-
103
- Returns
104
- -------
105
- Any
106
- The output of the command execution.
107
-
108
- Raises
109
- ------
110
- ValueError
111
- If the command instance is invalid.
112
- """
113
- command_class = self._command.get("instance")
114
- command_instance: BaseCommand = command_class()
115
- command_instance.setArgs(self._parsed_arguments)
116
- return command_instance.handle(**vars(self._parsed_arguments))
1
+ # import argparse
2
+ # from typing import Dict, Any, Optional
3
+ # from orionis.luminate.app_context import AppContext
4
+ # from orionis.luminate.console.parser import Parser
5
+ # from orionis.luminate.console.cache import CLICache
6
+ # from orionis.luminate.console.base.command import BaseCommand
7
+ # from orionis.luminate.contracts.pipelines.cli_pipeline_interface import ICLIPipeline
8
+
9
+ class CLIPipeline:
10
+ pass
11
+ # """
12
+ # Handles the retrieval, parsing, and execution of CLI commands within the Orionis framework.
13
+
14
+ # This class is responsible for:
15
+ # - Retrieving command metadata from cache.
16
+ # - Parsing command-line arguments dynamically.
17
+ # - Executing the corresponding command with parsed arguments.
18
+
19
+ # Attributes
20
+ # ----------
21
+ # _command : dict
22
+ # Stores the command's metadata, including its instance and expected arguments.
23
+ # _parsed_arguments : argparse.Namespace
24
+ # Holds parsed arguments after processing user input.
25
+ # """
26
+
27
+ # def __init__(self):
28
+ # """
29
+ # Initializes the CLIPipeline instance with an empty command cache
30
+ # and a default argument namespace.
31
+ # """
32
+ # self._command: Dict[str, Any] = {}
33
+ # self._parsed_arguments: argparse.Namespace = argparse.Namespace()
34
+
35
+ # def getCommand(self, signature: str) -> "CLIPipeline":
36
+ # """
37
+ # Retrieves a command from the cache based on its signature.
38
+
39
+ # Parameters
40
+ # ----------
41
+ # signature : str
42
+ # The unique identifier of the command.
43
+
44
+ # Returns
45
+ # -------
46
+ # CLIPipeline
47
+ # The current instance of CLIPipeline for method chaining.
48
+
49
+ # Raises
50
+ # ------
51
+ # ValueError
52
+ # If the command signature is not found in the cache.
53
+ # """
54
+ # with AppContext() as app:
55
+ # config_service : BaseCommand = app.container.run_command("config")
56
+ # config_service.
57
+
58
+ # try:
59
+ # cache = CLICache().getCommands()
60
+ # self._command = cache.get(signature)
61
+ # return self
62
+ # except KeyError as e:
63
+ # raise ValueError(e)
64
+
65
+ # def parseArguments(self, vars: Optional[Dict[str, Any]] = None, *args, **kwargs) -> "CLIPipeline":
66
+ # """
67
+ # Parses command-line arguments using the Orionis argument parser.
68
+
69
+ # Parameters
70
+ # ----------
71
+ # vars : dict, optional
72
+ # A dictionary of predefined variables to be included in parsing.
73
+ # *args
74
+ # Positional arguments for the parser.
75
+ # **kwargs
76
+ # Keyword arguments for the parser.
77
+
78
+ # Returns
79
+ # -------
80
+ # CLIPipeline
81
+ # The current instance of CLIPipeline for method chaining.
82
+
83
+ # Raises
84
+ # ------
85
+ # ValueError
86
+ # If an error occurs during argument parsing.
87
+ # """
88
+ # try:
89
+ # arguments = self._command.get("arguments")
90
+ # if arguments:
91
+ # arg_parser = Parser(vars=vars or {}, args=args, kwargs=kwargs)
92
+ # arg_parser.setArguments(arguments=arguments)
93
+ # arg_parser.recognize()
94
+ # self._parsed_arguments = arg_parser.get()
95
+
96
+ # return self
97
+
98
+ # except Exception as e:
99
+ # raise ValueError(f"Error parsing arguments: {e}")
100
+
101
+ # def execute(self) -> Any:
102
+ # """
103
+ # Executes the retrieved command using parsed arguments.
104
+
105
+ # This method:
106
+ # - Instantiates the command class.
107
+ # - Calls the `handle()` method, passing the parsed arguments.
108
+
109
+ # Returns
110
+ # -------
111
+ # Any
112
+ # The output of the command execution.
113
+
114
+ # Raises
115
+ # ------
116
+ # ValueError
117
+ # If the command instance is invalid.
118
+ # """
119
+ # command_class = self._command.get("instance")
120
+ # command_instance: BaseCommand = command_class()
121
+ # command_instance.setArgs(self._parsed_arguments)
122
+ # return command_instance.handle(**vars(self._parsed_arguments))
File without changes
File without changes
@@ -0,0 +1,26 @@
1
+ from orionis.contracts.providers.i_service_provider import IServiceProvider
2
+ from orionis.luminate.container.container import Container
3
+ from orionis.luminate.services.config.config_service import ConfigService
4
+
5
+ class ConfigServiceProvider(IServiceProvider):
6
+
7
+ def register(self, container: Container) -> None:
8
+ """
9
+ Registers services or bindings into the given container.
10
+
11
+ Args:
12
+ container (Container): The container to register services or bindings into.
13
+ """
14
+ self.key_sp = container.scoped(ConfigService)
15
+
16
+ def boot(self, container: Container) -> None:
17
+ """
18
+ Boot the service provider.
19
+
20
+ This method is intended to be overridden by subclasses to perform
21
+ any necessary bootstrapping or initialization tasks.
22
+
23
+ Args:
24
+ container (Container): The service container instance.
25
+ """
26
+ container.make(self.key_sp)
File without changes
@@ -0,0 +1,26 @@
1
+ from orionis.contracts.providers.i_service_provider import IServiceProvider
2
+ from orionis.luminate.container.container import Container
3
+ from orionis.luminate.services.files.path_service import PathService
4
+
5
+ class PathServiceProvider(IServiceProvider):
6
+
7
+ def register(self, container: Container) -> None:
8
+ """
9
+ Registers services or bindings into the given container.
10
+
11
+ Args:
12
+ container (Container): The container to register services or bindings into.
13
+ """
14
+ self.key_sp = container.singleton(PathService)
15
+
16
+ def boot(self, container: Container) -> None:
17
+ """
18
+ Boot the service provider.
19
+
20
+ This method is intended to be overridden by subclasses to perform
21
+ any necessary bootstrapping or initialization tasks.
22
+
23
+ Args:
24
+ container (Container): The service container instance.
25
+ """
26
+ container.make(self.key_sp)
File without changes
@@ -0,0 +1,26 @@
1
+ from orionis.contracts.providers.i_service_provider import IServiceProvider
2
+ from orionis.luminate.container.container import Container
3
+ from orionis.luminate.services.log.log_service import LogguerService
4
+
5
+ class LogServiceProvider(IServiceProvider):
6
+
7
+ def register(self, container: Container) -> None:
8
+ """
9
+ Registers services or bindings into the given container.
10
+
11
+ Args:
12
+ container (Container): The container to register services or bindings into.
13
+ """
14
+ self.key_sp = container.singleton(LogguerService)
15
+
16
+ def boot(self, container: Container) -> None:
17
+ """
18
+ Boot the service provider.
19
+
20
+ This method is intended to be overridden by subclasses to perform
21
+ any necessary bootstrapping or initialization tasks.
22
+
23
+ Args:
24
+ container (Container): The service container instance.
25
+ """
26
+ container.make(self.key_sp)
File without changes
File without changes