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,101 @@
1
+ from abc import ABC, abstractmethod
2
+
3
+ class IInstallerOutput(ABC):
4
+ """
5
+ Interface for the InstallerOutput class.
6
+ """
7
+
8
+ @abstractmethod
9
+ def _print(label: str, message: str, color_code: str):
10
+ """
11
+ Prints messages to the console with specific formatting and colors.
12
+
13
+ Parameters
14
+ ----------
15
+ label : str
16
+ The label for the message (e.g., INFO, FAIL, ERROR).
17
+ message : str
18
+ The message to display.
19
+ color_code : str
20
+ ANSI color code for the background of the message.
21
+ """
22
+ pass
23
+
24
+ @abstractmethod
25
+ def asciiIco():
26
+ """
27
+ Displays a welcome message to the framework, including ASCII art.
28
+
29
+ Attempts to load an ASCII art file (art.ascii). If not found, defaults to displaying basic information.
30
+
31
+ If the ASCII art file is found, placeholders are replaced with dynamic content such as version, docs, and year.
32
+ """
33
+ pass
34
+
35
+ @abstractmethod
36
+ def asciiInfo():
37
+ """
38
+ Displays another type of welcome message to the framework, including different ASCII art.
39
+
40
+ Attempts to load an ASCII art file (info.ascii). If not found, defaults to displaying basic information.
41
+
42
+ Similar to `asciiIco()`, but with different ASCII art.
43
+ """
44
+ pass
45
+
46
+ @abstractmethod
47
+ def startInstallation():
48
+ """
49
+ Displays the starting message when the installation begins.
50
+ This includes a welcoming message and the ASCII art.
51
+ """
52
+ pass
53
+
54
+ @abstractmethod
55
+ def endInstallation():
56
+ """
57
+ Displays the ending message after the installation is complete.
58
+ Provides a message of encouragement to start using the framework.
59
+ """
60
+ pass
61
+
62
+ @abstractmethod
63
+ def info(message: str = ''):
64
+ """
65
+ Displays an informational message to the console.
66
+
67
+ Parameters
68
+ ----------
69
+ message : str, optional
70
+ The message to display. Defaults to an empty string.
71
+ """
72
+ pass
73
+
74
+ @abstractmethod
75
+ def fail(message: str = ''):
76
+ """
77
+ Displays a failure message to the console.
78
+
79
+ Parameters
80
+ ----------
81
+ message : str, optional
82
+ The message to display. Defaults to an empty string.
83
+ """
84
+ pass
85
+
86
+ @abstractmethod
87
+ def error(message: str = '', e = None):
88
+ """
89
+ Displays an error message to the console and terminates the program.
90
+
91
+ Parameters
92
+ ----------
93
+ message : str, optional
94
+ The message to display. Defaults to an empty string.
95
+
96
+ Raises
97
+ ------
98
+ SystemExit
99
+ Terminates the program with a non-zero exit code, indicating an error occurred.
100
+ """
101
+ pass
@@ -0,0 +1,59 @@
1
+ from abc import ABC, abstractmethod
2
+
3
+ class InstallerSetup(ABC):
4
+ """
5
+ Interface for the InstallerSetup class.
6
+ """
7
+
8
+ @abstractmethod
9
+ def _sanitize_folder_name(self, name: str) -> str:
10
+ """
11
+ Sanitize the provided folder name to ensure it is valid across different operating systems.
12
+
13
+ Steps:
14
+ 1. Normalize text to remove accents and special characters.
15
+ 2. Convert to lowercase.
16
+ 3. Replace spaces with underscores.
17
+ 4. Remove invalid characters.
18
+ 5. Strip leading and trailing whitespace.
19
+ 6. Enforce length limit (255 characters).
20
+ 7. Ensure the result contains only valid characters.
21
+
22
+ Parameters
23
+ ----------
24
+ name : str
25
+ The original folder name to sanitize.
26
+
27
+ Returns
28
+ -------
29
+ str
30
+ The sanitized folder name.
31
+
32
+ Raises
33
+ ------
34
+ ValueError
35
+ If the sanitized folder name is empty or contains invalid characters.
36
+ """
37
+ pass
38
+
39
+ @abstractmethod
40
+ def handle(self):
41
+ """
42
+ Executes the setup process for initializing the Orionis project.
43
+
44
+ This process includes:
45
+ 1. Cloning the repository.
46
+ 2. Creating a virtual environment.
47
+ 3. Installing dependencies from requirements.txt.
48
+ 4. Setting up the .env file.
49
+ 5. Generating an API key.
50
+ 6. Cleaning up temporary files and .git remote origin.
51
+
52
+ Raises
53
+ ------
54
+ ValueError
55
+ If there is an error during any subprocess execution.
56
+ Exception
57
+ If any unexpected error occurs.
58
+ """
59
+ pass
@@ -0,0 +1,27 @@
1
+ from abc import ABC, abstractmethod
2
+ from orionis.luminate.container.container import Container
3
+
4
+ class IServiceProvider(ABC):
5
+
6
+ @abstractmethod
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
+ pass
15
+
16
+ @abstractmethod
17
+ def boot(self, container: Container) -> None:
18
+ """
19
+ Boot the service provider.
20
+
21
+ This method is intended to be overridden by subclasses to perform
22
+ any necessary bootstrapping or initialization tasks.
23
+
24
+ Args:
25
+ container (Container): The service container instance.
26
+ """
27
+ pass
@@ -0,0 +1,37 @@
1
+ from abc import ABC, abstractmethod
2
+ from typing import Any, Optional
3
+
4
+ class IConfigService(ABC):
5
+
6
+ @abstractmethod
7
+ def set(self, key: str, value: Any) -> None:
8
+ """
9
+ Dynamically sets a configuration value using dot notation.
10
+
11
+ Parameters
12
+ ----------
13
+ key : str
14
+ The configuration key (e.g., 'app.debug').
15
+ value : Any
16
+ The value to set.
17
+ """
18
+ pass
19
+
20
+ @abstractmethod
21
+ def get(self, key: str, default: Optional[Any] = None) -> Any:
22
+ """
23
+ Retrieves a configuration value using dot notation.
24
+
25
+ Parameters
26
+ ----------
27
+ key : str
28
+ The configuration key (e.g., 'app.debug').
29
+ default : Optional[Any]
30
+ The default value to return if the key is not found.
31
+
32
+ Returns
33
+ -------
34
+ Any
35
+ The configuration value or the default value if the key is not found.
36
+ """
37
+ pass
@@ -0,0 +1,31 @@
1
+ import os
2
+ from pathlib import Path
3
+ from abc import ABC, abstractmethod
4
+
5
+ class IPathService(ABC):
6
+
7
+ @abstractmethod
8
+ def resolve(self, route: str) -> str:
9
+ """
10
+ Resolves and returns the absolute path as a string.
11
+
12
+ This method combines the base path (current working directory) with the provided
13
+ relative path, resolves it to an absolute path, and validates that it exists
14
+ and is either a directory or a file.
15
+
16
+ Parameters
17
+ ----------
18
+ route : str
19
+ The relative directory or file path to be resolved.
20
+
21
+ Returns
22
+ -------
23
+ str
24
+ The absolute path to the directory or file.
25
+
26
+ Raises
27
+ ------
28
+ ValueError
29
+ If the resolved path does not exist or is neither a directory nor a file.
30
+ """
31
+ pass
@@ -0,0 +1,89 @@
1
+ from abc import ABC, abstractmethod
2
+ from typing import Optional
3
+
4
+ class ILogguerService(ABC):
5
+
6
+ @abstractmethod
7
+ def _initialize_logger(self, path: Optional[str], level: int, filename: Optional[str] = 'orionis.log'):
8
+ """
9
+ Configures the logger with the specified settings.
10
+
11
+ This method sets up the logger to write logs to a file. If the specified
12
+ directory does not exist, it creates it. The log format includes the
13
+ timestamp and the log message.
14
+
15
+ Parameters
16
+ ----------
17
+ path : Optional[str]
18
+ The directory path where the log file will be stored.
19
+ level : int
20
+ The logging level (e.g., logging.INFO, logging.ERROR).
21
+ filename : Optional[str]
22
+ The name of the log file.
23
+
24
+ Raises
25
+ ------
26
+ RuntimeError
27
+ If the logger cannot be initialized due to an error.
28
+ """
29
+ pass
30
+
31
+ @abstractmethod
32
+ def info(self, message: str) -> None:
33
+ """
34
+ Logs an informational message.
35
+
36
+ Parameters
37
+ ----------
38
+ message : str
39
+ The message to log.
40
+ """
41
+ pass
42
+
43
+ @abstractmethod
44
+ def error(self, message: str) -> None:
45
+ """
46
+ Logs an error message.
47
+
48
+ Parameters
49
+ ----------
50
+ message : str
51
+ The message to log.
52
+ """
53
+ pass
54
+
55
+ @abstractmethod
56
+ def success(self, message: str) -> None:
57
+ """
58
+ Logs a success message (treated as info).
59
+
60
+ Parameters
61
+ ----------
62
+ message : str
63
+ The message to log.
64
+ """
65
+ pass
66
+
67
+ @abstractmethod
68
+ def warning(self, message: str) -> None:
69
+ """
70
+ Logs a warning message.
71
+
72
+ Parameters
73
+ ----------
74
+ message : str
75
+ The message to log.
76
+ """
77
+ pass
78
+
79
+ @abstractmethod
80
+ def debug(self, message: str) -> None:
81
+ """
82
+ Logs a debug message.
83
+
84
+ Parameters
85
+ ----------
86
+ message : str
87
+ The message to log.
88
+ """
89
+ pass
@@ -1,29 +1,22 @@
1
- from orionis.luminate.config.environment import Environment
2
- from orionis.luminate.contracts.facades.env_interface import IEnv
1
+ from abc import ABC, abstractmethod
3
2
 
4
- def env(key: str, default=None) -> str:
5
- """
6
- Retrieves the value of an environment variable from the .env file
7
- or from system environment variables if not found.
3
+ class IEnvironment(ABC):
8
4
 
9
- Parameters
10
- ----------
11
- key : str
12
- The key of the environment variable.
13
- default : optional
14
- Default value if the key does not exist. Defaults to None.
15
-
16
- Returns
17
- -------
18
- str
19
- The value of the environment variable or the default value.
20
- """
21
- return Environment().get(key, default)
5
+ @abstractmethod
6
+ def _initialize(self, path: str = None):
7
+ """
8
+ Initializes the instance by setting the path to the .env file.
9
+ If no path is provided, defaults to a `.env` file in the current directory.
22
10
 
23
- class Env(IEnv):
11
+ Parameters
12
+ ----------
13
+ path : str, optional
14
+ Path to the .env file. Defaults to None.
15
+ """
16
+ pass
24
17
 
25
- @staticmethod
26
- def get(key: str, default=None) -> str:
18
+ @abstractmethod
19
+ def get(self, key: str, default=None) -> str:
27
20
  """
28
21
  Retrieves the value of an environment variable from the .env file
29
22
  or from system environment variables if not found.
@@ -40,10 +33,10 @@ class Env(IEnv):
40
33
  str
41
34
  The value of the environment variable or the default value.
42
35
  """
43
- Environment().get(key, default)
36
+ pass
44
37
 
45
- @staticmethod
46
- def set(key: str, value: str) -> None:
38
+ @abstractmethod
39
+ def set(self, key: str, value: str) -> None:
47
40
  """
48
41
  Sets the value of an environment variable in the .env file.
49
42
 
@@ -54,10 +47,10 @@ class Env(IEnv):
54
47
  value : str
55
48
  The value to set.
56
49
  """
57
- Environment().set(key, value)
50
+ pass
58
51
 
59
- @staticmethod
60
- def unset(key: str) -> None:
52
+ @abstractmethod
53
+ def unset(self, key: str) -> None:
61
54
  """
62
55
  Removes an environment variable from the .env file.
63
56
 
@@ -66,10 +59,10 @@ class Env(IEnv):
66
59
  key : str
67
60
  The key of the environment variable to remove.
68
61
  """
69
- Environment().unset(key)
62
+ pass
70
63
 
71
- @staticmethod
72
- def all() -> dict:
64
+ @abstractmethod
65
+ def all(self) -> dict:
73
66
  """
74
67
  Retrieves all environment variable values from the .env file.
75
68
 
@@ -78,4 +71,4 @@ class Env(IEnv):
78
71
  dict
79
72
  A dictionary of all environment variables and their values.
80
73
  """
81
- Environment().all()
74
+ pass
@@ -1,15 +1,6 @@
1
1
  from abc import ABC, abstractmethod
2
2
 
3
3
  class IExceptionsToDict(ABC):
4
- """
5
- A utility class to parse an exception and convert it into a structured dictionary.
6
-
7
- Methods
8
- -------
9
- parse(exception: Exception) -> dict
10
- Converts an exception into a dictionary containing the error type, message,
11
- and stack trace information.
12
- """
13
4
 
14
5
  @abstractmethod
15
6
  def parse(exception):
@@ -2,15 +2,19 @@ from abc import ABC, abstractmethod
2
2
  from typing import Any, List, Optional
3
3
 
4
4
  class IReflection(ABC):
5
- """
6
- Abstract base class for reflection operations on a Python class.
7
- This interface defines the methods that any reflection class must implement.
8
- """
9
5
 
10
6
  @abstractmethod
11
7
  def safeImport(self):
12
8
  """
13
- Safely imports the module and class as specified in the instance.
9
+ Safely imports the specified module and assigns the class object if a classname is provided.
10
+
11
+ This method raises a ValueError if the module cannot be imported or if the class does not exist
12
+ within the module.
13
+
14
+ Raises
15
+ ------
16
+ ValueError
17
+ If the module cannot be imported or the class does not exist in the module.
14
18
  """
15
19
  pass
16
20
 
@@ -22,7 +26,12 @@ class IReflection(ABC):
22
26
  Returns
23
27
  -------
24
28
  str
25
- The file path of the class definition.
29
+ The file path if the class is found, otherwise raises an error.
30
+
31
+ Raises
32
+ ------
33
+ ValueError
34
+ If the class has not been loaded yet.
26
35
  """
27
36
  pass
28
37
 
@@ -128,7 +137,7 @@ class IReflection(ABC):
128
137
  @abstractmethod
129
138
  def getFileName(self, remove_extension: bool = False) -> str:
130
139
  """
131
- Retrieves the file name where the class is defined.
140
+ Retrieves the file name where the class is defined, the same as `get_file()`.
132
141
 
133
142
  Parameters
134
143
  ----------
@@ -340,4 +349,4 @@ class IReflection(ABC):
340
349
  str
341
350
  A string describing the class and module.
342
351
  """
343
- pass
352
+ pass
@@ -2,23 +2,10 @@ from abc import ABC, abstractmethod
2
2
 
3
3
  class IStdClass(ABC):
4
4
  """
5
- An abstract base class defining the contract for any StdClass-like object.
6
- This class ensures that any concrete implementation provides the necessary methods
7
- for attribute management and dynamic behavior.
5
+ Interface for a dynamic class that allows setting arbitrary attributes,
6
+ similar to PHP's stdClass.
8
7
  """
9
8
 
10
- @abstractmethod
11
- def __init__(self, **kwargs):
12
- """
13
- Initializes the object with optional keyword arguments to set attributes.
14
-
15
- Parameters
16
- ----------
17
- kwargs : dict
18
- Key-value pairs to set as attributes.
19
- """
20
- pass
21
-
22
9
  @abstractmethod
23
10
  def __repr__(self) -> str:
24
11
  """
@@ -44,7 +31,7 @@ class IStdClass(ABC):
44
31
  pass
45
32
 
46
33
  @abstractmethod
47
- def update(self, **kwargs) -> None:
34
+ def update(self, **kwargs):
48
35
  """
49
36
  Updates the object's attributes dynamically.
50
37
 
orionis/framework.py CHANGED
@@ -5,7 +5,7 @@
5
5
  NAME = "orionis"
6
6
 
7
7
  # Current version of the framework
8
- VERSION = "0.43.0"
8
+ VERSION = "0.46.0"
9
9
 
10
10
  # Full name of the author or maintainer of the project
11
11
  AUTHOR = "Raul Mauricio Uñate Castro"
@@ -1,9 +1,11 @@
1
- from orionis.luminate.installer.setup import Setup
2
- from orionis.luminate.installer.output import Output
3
- from orionis.luminate.installer.upgrade import Upgrade
4
- from orionis.luminate.contracts.console.scripts.management_interface import IManagement
5
1
 
6
- class Management(IManagement):
2
+ import subprocess
3
+ import sys
4
+ from orionis.contracts.installer.i_installer_manager import IInstallerManager
5
+ from orionis.installer.installer_output import InstallerOutput
6
+ from orionis.installer.installer_setup import InstallerSetup
7
+
8
+ class InstallerManager(IInstallerManager):
7
9
  """
8
10
  Management class responsible for handling framework-related operations.
9
11
 
@@ -12,11 +14,11 @@ class Management(IManagement):
12
14
 
13
15
  Attributes
14
16
  ----------
15
- output : Output
17
+ output : InstallerOutput
16
18
  Instance of Output to manage command-line display messages.
17
19
  """
18
20
 
19
- def __init__(self, output = Output):
21
+ def __init__(self, output = InstallerOutput):
20
22
  """
21
23
  Initialize the Management class with an output handler.
22
24
 
@@ -27,7 +29,7 @@ class Management(IManagement):
27
29
  """
28
30
  self.output = output
29
31
 
30
- def displayVersion(self) -> str:
32
+ def handleVersion(self) -> str:
31
33
  """
32
34
  Display the current version of the framework in ASCII format.
33
35
 
@@ -46,7 +48,7 @@ class Management(IManagement):
46
48
  except Exception as e:
47
49
  raise RuntimeError(f"Failed to display version: {e}")
48
50
 
49
- def executeUpgrade(self) -> None:
51
+ def handleUpgrade(self) -> None:
50
52
  """
51
53
  Execute the framework upgrade process to the latest version.
52
54
 
@@ -56,11 +58,15 @@ class Management(IManagement):
56
58
  If an error occurs during the upgrade process.
57
59
  """
58
60
  try:
59
- Upgrade.execute()
61
+ self.output.info("Starting the upgrade process...")
62
+ subprocess.check_call([sys.executable, "-m", "pip", "install", "--upgrade", "orionis"])
63
+ except subprocess.CalledProcessError as e:
64
+ raise RuntimeError(f"Upgrade failed: {e}")
60
65
  except Exception as e:
61
- raise RuntimeError(f"Upgrade process failed: {e}")
66
+ raise RuntimeError(f"Upgrade failed: {e}")
67
+
62
68
 
63
- def createNewApp(self, name_app: str = "example-app") -> None:
69
+ def handleNewApp(self, name_app: str = "example-app") -> None:
64
70
  """
65
71
  Create a new application with the specified name.
66
72
 
@@ -75,11 +81,11 @@ class Management(IManagement):
75
81
  If an error occurs during the application setup.
76
82
  """
77
83
  try:
78
- Setup(name_app).handle()
84
+ InstallerSetup(name=name_app, output=self.output).handle()
79
85
  except Exception as e:
80
- raise RuntimeError(f"Failed to create application '{name_app}': {e}")
86
+ raise RuntimeError(f"Failed to create new app: {e}")
81
87
 
82
- def displayInfo(self) -> None:
88
+ def handleInfo(self) -> None:
83
89
  """
84
90
  Display additional framework information in ASCII format.
85
91
 
@@ -91,4 +97,4 @@ class Management(IManagement):
91
97
  try:
92
98
  self.output.asciiInfo()
93
99
  except Exception as e:
94
- raise RuntimeError(f"Failed to display information: {e}")
100
+ raise RuntimeError(f"Failed to display information: {e}")