orionis 0.44.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.
- orionis/cli_manager.py +16 -30
- orionis/contracts/bootstrap/i_command_bootstrapper.py +59 -0
- orionis/contracts/bootstrap/i_config_bootstrapper.py +112 -0
- orionis/contracts/bootstrap/i_environment_bootstrapper.py +33 -0
- orionis/{luminate/contracts/console/base/base_command_interface.py → contracts/console/base/i_command.py} +0 -1
- orionis/contracts/facades/config/i_config_facade.py +37 -0
- orionis/contracts/facades/environment/i_environment_facade.py +40 -0
- orionis/{luminate/contracts/facades/paths_interface.py → contracts/facades/files/i_path_facade.py} +27 -20
- orionis/contracts/facades/log/i_log_facade.py +83 -0
- orionis/{luminate/contracts/facades/tests_interface.py → contracts/facades/tests/i_tests_facade.py} +3 -6
- orionis/{luminate/contracts/console/scripts/management_interface.py → contracts/installer/i_installer_manager.py} +19 -16
- orionis/contracts/installer/i_installer_output.py +101 -0
- orionis/contracts/installer/i_installer_setup.py +59 -0
- orionis/contracts/providers/i_service_provider.py +27 -0
- orionis/contracts/services/config/i_config_service.py +37 -0
- orionis/contracts/services/files/i_path_service.py +31 -0
- orionis/contracts/services/log/i_log_service.py +89 -0
- orionis/{luminate/facades/environment.py → contracts/support/i_environment.py} +25 -32
- orionis/{luminate/contracts/tools/exception_to_dict_interface.py → contracts/support/i_exception_to_dict.py} +0 -9
- orionis/{luminate/contracts/tools/reflection_interface.py → contracts/support/i_reflection.py} +17 -8
- orionis/{luminate/contracts/tools/std_interface.py → contracts/support/i_std.py} +3 -16
- orionis/framework.py +1 -1
- orionis/{luminate/console/scripts/management.py → installer/installer_manager.py} +22 -16
- orionis/{luminate/installer/output.py → installer/installer_output.py} +16 -10
- orionis/{luminate/installer/setup.py → installer/installer_setup.py} +13 -25
- orionis/luminate/app.py +15 -11
- orionis/luminate/bootstrap/command_bootstrapper.py +150 -0
- orionis/luminate/bootstrap/config_bootstrapper.py +168 -0
- orionis/luminate/bootstrap/environment_bootstrapper.py +67 -0
- orionis/luminate/config/helpers.py +20 -0
- orionis/luminate/console/base/command.py +1 -3
- orionis/luminate/console/command_filter.py +2 -2
- orionis/luminate/console/commands/cache_clear.py +17 -5
- orionis/luminate/console/commands/help.py +19 -13
- orionis/luminate/console/commands/schedule_work.py +6 -3
- orionis/luminate/console/commands/tests.py +1 -6
- orionis/luminate/console/commands/version.py +0 -5
- orionis/luminate/console/exceptions/cli_exception.py +1 -4
- orionis/luminate/console/kernel.py +2 -2
- orionis/luminate/console/output/console.py +2 -2
- orionis/luminate/console/output/executor.py +1 -1
- orionis/luminate/console/output/progress_bar.py +1 -1
- orionis/luminate/console/parser.py +2 -2
- orionis/luminate/console/runner.py +127 -126
- orionis/luminate/console/tasks/scheduler.py +8 -7
- orionis/luminate/container/container.py +1 -1
- orionis/luminate/container/types.py +38 -12
- orionis/luminate/facades/config/config_facade.py +43 -0
- orionis/luminate/facades/environment/environment_facade.py +68 -0
- orionis/luminate/facades/{paths.py → files/path_facade.py} +50 -6
- orionis/luminate/facades/log/__init__.py +0 -0
- orionis/luminate/facades/log/log_facade.py +95 -0
- orionis/luminate/facades/tests/__init__.py +0 -0
- orionis/luminate/facades/{tests.py → tests/tests_facade.py} +1 -1
- orionis/luminate/patterns/__init__.py +0 -0
- orionis/luminate/pipelines/cli_pipeline.py +122 -116
- orionis/luminate/providers/__init__.py +0 -0
- orionis/luminate/providers/config/__init__.py +0 -0
- orionis/luminate/providers/config/config_service_provider.py +26 -0
- orionis/luminate/providers/files/__init__.py +0 -0
- orionis/luminate/providers/files/path_service_provider.py +26 -0
- orionis/luminate/providers/log/__init__.py +0 -0
- orionis/luminate/providers/log/log_service_provider.py +26 -0
- orionis/luminate/services/__init__.py +0 -0
- orionis/luminate/services/config/__init__.py +0 -0
- orionis/luminate/services/config/config_service.py +72 -0
- orionis/luminate/services/files/__init__.py +0 -0
- orionis/luminate/services/files/path_service.py +71 -0
- orionis/luminate/services/log/__init__.py +0 -0
- orionis/luminate/services/log/log_service.py +159 -0
- orionis/luminate/{config → support}/environment.py +21 -32
- orionis/luminate/{tools → support}/exception_to_dict.py +1 -1
- orionis/luminate/{tools → support}/reflection.py +1 -1
- orionis/luminate/{tools → support}/std.py +1 -1
- orionis/luminate/test/unit_test.py +1 -2
- {orionis-0.44.0.dist-info → orionis-0.46.0.dist-info}/METADATA +1 -1
- orionis-0.46.0.dist-info/RECORD +157 -0
- tests/tools/test_reflection.py +1 -1
- orionis/luminate/bootstrap/commands/bootstrapper.py +0 -101
- orionis/luminate/bootstrap/commands/register.py +0 -92
- orionis/luminate/bootstrap/config/bootstrapper.py +0 -79
- orionis/luminate/bootstrap/config/parser.py +0 -53
- orionis/luminate/bootstrap/config/register.py +0 -76
- orionis/luminate/cache/app/config.py +0 -91
- orionis/luminate/cache/console/commands.py +0 -97
- orionis/luminate/console/cache.py +0 -87
- orionis/luminate/console/command.py +0 -40
- orionis/luminate/contracts/bootstrap/commands/bootstrapper_interface.py +0 -44
- orionis/luminate/contracts/bootstrap/commands/register_interface.py +0 -33
- orionis/luminate/contracts/bootstrap/config/bootstrapper_interface.py +0 -40
- orionis/luminate/contracts/bootstrap/config/parser_interface.py +0 -46
- orionis/luminate/contracts/bootstrap/config/register_interface.py +0 -47
- orionis/luminate/contracts/cache/app/config_interface.py +0 -76
- orionis/luminate/contracts/cache/console/commands_interface.py +0 -78
- orionis/luminate/contracts/config/environment_interface.py +0 -64
- orionis/luminate/contracts/console/command_interface.py +0 -36
- orionis/luminate/contracts/console/runner_interface.py +0 -50
- orionis/luminate/contracts/facades/env_interface.py +0 -64
- orionis/luminate/contracts/facades/log_interface.py +0 -48
- orionis/luminate/contracts/files/paths_interface.py +0 -29
- orionis/luminate/contracts/installer/output_interface.py +0 -125
- orionis/luminate/contracts/installer/setup_interface.py +0 -29
- orionis/luminate/contracts/installer/upgrade_interface.py +0 -24
- orionis/luminate/contracts/log/logger_interface.py +0 -33
- orionis/luminate/contracts/pipelines/cli_pipeline_interface.py +0 -84
- orionis/luminate/contracts/publisher/pypi_publisher_interface.py +0 -36
- orionis/luminate/contracts/test/unit_test_interface.py +0 -51
- orionis/luminate/facades/config.py +0 -10
- orionis/luminate/facades/log.py +0 -56
- orionis/luminate/files/paths.py +0 -56
- orionis/luminate/installer/upgrade.py +0 -42
- orionis/luminate/log/logger.py +0 -116
- orionis/luminate/publisher/pypi.py +0 -215
- orionis-0.44.0.dist-info/RECORD +0 -156
- /orionis/{luminate/bootstrap/config → contracts}/__init__.py +0 -0
- /orionis/{luminate/cache → contracts/config}/__init__.py +0 -0
- /orionis/{luminate/contracts/config/config_interface.py → contracts/config/i_config.py} +0 -0
- /orionis/{luminate/cache/app → contracts/console}/__init__.py +0 -0
- /orionis/{luminate/cache/console → contracts/console/base}/__init__.py +0 -0
- /orionis/{luminate/contracts/console/command_filter_interface.py → contracts/console/i_command_filter.py} +0 -0
- /orionis/{luminate/contracts/console/kernel_interface.py → contracts/console/i_kernel.py} +0 -0
- /orionis/{luminate/contracts/console/parser_interface.py → contracts/console/i_parser.py} +0 -0
- /orionis/{luminate/contracts/console/task_manager_interface.py → contracts/console/i_task_manager.py} +0 -0
- /orionis/{luminate/config/dataclass → contracts/console/output}/__init__.py +0 -0
- /orionis/{luminate/contracts/console/output/console_interface.py → contracts/console/output/i_console.py} +0 -0
- /orionis/{luminate/contracts/console/output/executor_interface.py → contracts/console/output/i_executor.py} +0 -0
- /orionis/{luminate/contracts/console/output/progress_bar_interface.py → contracts/console/output/i_progress_bar.py} +0 -0
- /orionis/{luminate/console/scripts → contracts/console/tasks}/__init__.py +0 -0
- /orionis/{luminate/contracts/console/tasks/schedule_interface.py → contracts/console/tasks/i_schedule.py} +0 -0
- /orionis/{luminate/contracts/container/container_interface.py → contracts/container/i_container.py} +0 -0
- /orionis/{luminate/contracts/container/types_interface.py → contracts/container/i_types.py} +0 -0
- /orionis/{luminate/contracts → contracts/facades}/__init__.py +0 -0
- /orionis/{luminate/contracts/cache → contracts/facades/config}/__init__.py +0 -0
- /orionis/{luminate/contracts/config → contracts/facades/environment}/__init__.py +0 -0
- /orionis/{luminate/contracts/console → contracts/facades/files}/__init__.py +0 -0
- /orionis/{luminate/contracts/facades → contracts/facades/log}/__init__.py +0 -0
- /orionis/{luminate/contracts/files → contracts/facades/tests}/__init__.py +0 -0
- /orionis/{luminate/contracts → contracts}/installer/__init__.py +0 -0
- /orionis/{luminate/contracts/log → contracts/providers}/__init__.py +0 -0
- /orionis/{luminate/contracts/publisher → contracts/services}/__init__.py +0 -0
- /orionis/{luminate/contracts/test → contracts/services/config}/__init__.py +0 -0
- /orionis/{luminate/contracts/tools → contracts/services/files}/__init__.py +0 -0
- /orionis/{luminate/files → contracts/services/log}/__init__.py +0 -0
- /orionis/{luminate/installer → installer}/__init__.py +0 -0
- /orionis/luminate/bootstrap/{cli_exception.py → exception_bootstrapper.py} +0 -0
- /orionis/luminate/config/{dataclass/app.py → app.py} +0 -0
- /orionis/luminate/config/{dataclass/auth.py → auth.py} +0 -0
- /orionis/luminate/config/{dataclass/cache.py → cache.py} +0 -0
- /orionis/luminate/config/{dataclass/cors.py → cors.py} +0 -0
- /orionis/luminate/config/{dataclass/database.py → database.py} +0 -0
- /orionis/luminate/config/{dataclass/filesystems.py → filesystems.py} +0 -0
- /orionis/luminate/config/{dataclass/logging.py → logging.py} +0 -0
- /orionis/luminate/config/{dataclass/mail.py → mail.py} +0 -0
- /orionis/luminate/config/{dataclass/queue.py → queue.py} +0 -0
- /orionis/luminate/config/{dataclass/session.py → session.py} +0 -0
- /orionis/luminate/{log → facades/config}/__init__.py +0 -0
- /orionis/luminate/{publisher → facades/environment}/__init__.py +0 -0
- /orionis/luminate/{tools → facades/files}/__init__.py +0 -0
- /orionis/luminate/{tools → support}/dot_dict.py +0 -0
- /orionis/{luminate/installer → static/ascii}/icon.ascii +0 -0
- /orionis/{luminate/installer → static/ascii}/info.ascii +0 -0
- /orionis/{luminate/static → static}/bg/galaxy.jpg +0 -0
- /orionis/{luminate/static → static}/favicon/OrionisFrameworkFavicon.png +0 -0
- /orionis/{luminate/static → static}/logos/OrionisFramework.jpg +0 -0
- /orionis/{luminate/static → static}/logos/OrionisFramework.png +0 -0
- /orionis/{luminate/static → static}/logos/OrionisFramework.psd +0 -0
- /orionis/{luminate/static → static}/logos/OrionisFramework2.png +0 -0
- /orionis/{luminate/static → static}/logos/OrionisFramework3.png +0 -0
- {orionis-0.44.0.dist-info → orionis-0.46.0.dist-info}/LICENCE +0 -0
- {orionis-0.44.0.dist-info → orionis-0.46.0.dist-info}/WHEEL +0 -0
- {orionis-0.44.0.dist-info → orionis-0.46.0.dist-info}/entry_points.txt +0 -0
- {orionis-0.44.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
|
2
|
-
from orionis.luminate.contracts.facades.env_interface import IEnv
|
1
|
+
from abc import ABC, abstractmethod
|
3
2
|
|
4
|
-
|
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
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
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
|
-
|
11
|
+
Parameters
|
12
|
+
----------
|
13
|
+
path : str, optional
|
14
|
+
Path to the .env file. Defaults to None.
|
15
|
+
"""
|
16
|
+
pass
|
24
17
|
|
25
|
-
@
|
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
|
-
|
36
|
+
pass
|
44
37
|
|
45
|
-
@
|
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
|
-
|
50
|
+
pass
|
58
51
|
|
59
|
-
@
|
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
|
-
|
62
|
+
pass
|
70
63
|
|
71
|
-
@
|
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
|
-
|
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):
|
orionis/{luminate/contracts/tools/reflection_interface.py → contracts/support/i_reflection.py}
RENAMED
@@ -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
|
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
|
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
|
-
|
6
|
-
|
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)
|
34
|
+
def update(self, **kwargs):
|
48
35
|
"""
|
49
36
|
Updates the object's attributes dynamically.
|
50
37
|
|
orionis/framework.py
CHANGED
@@ -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
|
-
|
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 :
|
17
|
+
output : InstallerOutput
|
16
18
|
Instance of Output to manage command-line display messages.
|
17
19
|
"""
|
18
20
|
|
19
|
-
def __init__(self, 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
|
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
|
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
|
-
|
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
|
66
|
+
raise RuntimeError(f"Upgrade failed: {e}")
|
67
|
+
|
62
68
|
|
63
|
-
def
|
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
|
-
|
84
|
+
InstallerSetup(name=name_app, output=self.output).handle()
|
79
85
|
except Exception as e:
|
80
|
-
raise RuntimeError(f"Failed to create
|
86
|
+
raise RuntimeError(f"Failed to create new app: {e}")
|
81
87
|
|
82
|
-
def
|
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}")
|