orionis 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (133) hide show
  1. orionis/__init__.py +0 -0
  2. orionis/cli_manager.py +48 -0
  3. orionis/framework.py +45 -0
  4. orionis/luminate/__init__.py +0 -0
  5. orionis/luminate/app.py +0 -0
  6. orionis/luminate/bootstrap/__init__.py +0 -0
  7. orionis/luminate/bootstrap/parser.py +49 -0
  8. orionis/luminate/bootstrap/register.py +95 -0
  9. orionis/luminate/cache/__init__.py +0 -0
  10. orionis/luminate/cache/app/__init__.py +0 -0
  11. orionis/luminate/cache/app/config.py +96 -0
  12. orionis/luminate/cache/console/__init__.py +0 -0
  13. orionis/luminate/cache/console/commands.py +98 -0
  14. orionis/luminate/config/__init__.py +0 -0
  15. orionis/luminate/config/dataclass/__init__.py +0 -0
  16. orionis/luminate/config/dataclass/app.py +50 -0
  17. orionis/luminate/config/dataclass/auth.py +17 -0
  18. orionis/luminate/config/dataclass/cache.py +51 -0
  19. orionis/luminate/config/dataclass/cors.py +58 -0
  20. orionis/luminate/config/dataclass/database.py +203 -0
  21. orionis/luminate/config/dataclass/filesystems.py +102 -0
  22. orionis/luminate/config/dataclass/logging.py +107 -0
  23. orionis/luminate/config/dataclass/mail.py +81 -0
  24. orionis/luminate/config/dataclass/queue.py +63 -0
  25. orionis/luminate/config/dataclass/session.py +59 -0
  26. orionis/luminate/config/environment.py +110 -0
  27. orionis/luminate/config/sections.py +37 -0
  28. orionis/luminate/console/__init__.py +0 -0
  29. orionis/luminate/console/base/__init__.py +0 -0
  30. orionis/luminate/console/base/command.py +427 -0
  31. orionis/luminate/console/cache.py +132 -0
  32. orionis/luminate/console/command.py +40 -0
  33. orionis/luminate/console/command_filter.py +40 -0
  34. orionis/luminate/console/commands/__init__.py +0 -0
  35. orionis/luminate/console/commands/cache_clear.py +56 -0
  36. orionis/luminate/console/commands/help.py +59 -0
  37. orionis/luminate/console/commands/schedule_work.py +50 -0
  38. orionis/luminate/console/commands/tests.py +40 -0
  39. orionis/luminate/console/commands/version.py +39 -0
  40. orionis/luminate/console/exceptions/__init__.py +0 -0
  41. orionis/luminate/console/exceptions/cli_exception.py +125 -0
  42. orionis/luminate/console/kernel.py +32 -0
  43. orionis/luminate/console/output/__init__.py +0 -0
  44. orionis/luminate/console/output/console.py +426 -0
  45. orionis/luminate/console/output/executor.py +90 -0
  46. orionis/luminate/console/output/progress_bar.py +100 -0
  47. orionis/luminate/console/output/styles.py +95 -0
  48. orionis/luminate/console/parser.py +159 -0
  49. orionis/luminate/console/register.py +98 -0
  50. orionis/luminate/console/runner.py +126 -0
  51. orionis/luminate/console/scripts/__init__.py +0 -0
  52. orionis/luminate/console/scripts/management.py +94 -0
  53. orionis/luminate/console/tasks/__init__.py +0 -0
  54. orionis/luminate/console/tasks/scheduler.py +616 -0
  55. orionis/luminate/contracts/__init__.py +0 -0
  56. orionis/luminate/contracts/bootstrap/parser_interface.py +46 -0
  57. orionis/luminate/contracts/cache/__init__.py +0 -0
  58. orionis/luminate/contracts/cache/cache_commands_interface.py +69 -0
  59. orionis/luminate/contracts/config/__init__.py +0 -0
  60. orionis/luminate/contracts/config/config_interface.py +27 -0
  61. orionis/luminate/contracts/config/environment_interface.py +64 -0
  62. orionis/luminate/contracts/console/__init__.py +0 -0
  63. orionis/luminate/contracts/console/base_command_interface.py +448 -0
  64. orionis/luminate/contracts/console/cli_cache_interface.py +34 -0
  65. orionis/luminate/contracts/console/command_filter_interface.py +32 -0
  66. orionis/luminate/contracts/console/command_interface.py +36 -0
  67. orionis/luminate/contracts/console/console_interface.py +305 -0
  68. orionis/luminate/contracts/console/executor_interface.py +51 -0
  69. orionis/luminate/contracts/console/kernel_interface.py +32 -0
  70. orionis/luminate/contracts/console/management_interface.py +63 -0
  71. orionis/luminate/contracts/console/parser_interface.py +76 -0
  72. orionis/luminate/contracts/console/progress_bar_interface.py +66 -0
  73. orionis/luminate/contracts/console/register_interface.py +32 -0
  74. orionis/luminate/contracts/console/runner_interface.py +50 -0
  75. orionis/luminate/contracts/console/schedule_interface.py +317 -0
  76. orionis/luminate/contracts/console/task_manager_interface.py +37 -0
  77. orionis/luminate/contracts/facades/__init__.py +0 -0
  78. orionis/luminate/contracts/facades/env_interface.py +64 -0
  79. orionis/luminate/contracts/facades/log_interface.py +48 -0
  80. orionis/luminate/contracts/facades/paths_interface.py +141 -0
  81. orionis/luminate/contracts/facades/tests_interface.py +33 -0
  82. orionis/luminate/contracts/files/__init__.py +0 -0
  83. orionis/luminate/contracts/files/paths_interface.py +29 -0
  84. orionis/luminate/contracts/installer/__init__.py +0 -0
  85. orionis/luminate/contracts/installer/output_interface.py +125 -0
  86. orionis/luminate/contracts/installer/setup_interface.py +29 -0
  87. orionis/luminate/contracts/installer/upgrade_interface.py +24 -0
  88. orionis/luminate/contracts/log/__init__.py +0 -0
  89. orionis/luminate/contracts/log/logger_interface.py +33 -0
  90. orionis/luminate/contracts/pipelines/cli_pipeline_interface.py +84 -0
  91. orionis/luminate/contracts/publisher/__init__.py +0 -0
  92. orionis/luminate/contracts/publisher/pypi_publisher_interface.py +36 -0
  93. orionis/luminate/contracts/test/__init__.py +0 -0
  94. orionis/luminate/contracts/test/unit_test_interface.py +51 -0
  95. orionis/luminate/contracts/tools/__init__.py +0 -0
  96. orionis/luminate/contracts/tools/reflection_interface.py +343 -0
  97. orionis/luminate/contracts/tools/std_interface.py +56 -0
  98. orionis/luminate/facades/__init__.py +0 -0
  99. orionis/luminate/facades/environment.py +81 -0
  100. orionis/luminate/facades/log.py +56 -0
  101. orionis/luminate/facades/paths.py +268 -0
  102. orionis/luminate/facades/tests.py +48 -0
  103. orionis/luminate/files/__init__.py +0 -0
  104. orionis/luminate/files/paths.py +56 -0
  105. orionis/luminate/installer/__init__.py +0 -0
  106. orionis/luminate/installer/icon.ascii +11 -0
  107. orionis/luminate/installer/info.ascii +13 -0
  108. orionis/luminate/installer/output.py +188 -0
  109. orionis/luminate/installer/setup.py +191 -0
  110. orionis/luminate/installer/upgrade.py +42 -0
  111. orionis/luminate/log/__init__.py +0 -0
  112. orionis/luminate/log/logger.py +116 -0
  113. orionis/luminate/pipelines/__init__.py +0 -0
  114. orionis/luminate/pipelines/cli_pipeline.py +116 -0
  115. orionis/luminate/publisher/__init__.py +0 -0
  116. orionis/luminate/publisher/pypi.py +206 -0
  117. orionis/luminate/static/logos/flaskavel.png +0 -0
  118. orionis/luminate/test/__init__.py +0 -0
  119. orionis/luminate/test/exception.py +48 -0
  120. orionis/luminate/test/unit_test.py +108 -0
  121. orionis/luminate/tools/__init__.py +0 -0
  122. orionis/luminate/tools/reflection.py +390 -0
  123. orionis/luminate/tools/std.py +53 -0
  124. orionis-0.1.0.dist-info/LICENCE +21 -0
  125. orionis-0.1.0.dist-info/METADATA +27 -0
  126. orionis-0.1.0.dist-info/RECORD +133 -0
  127. orionis-0.1.0.dist-info/WHEEL +5 -0
  128. orionis-0.1.0.dist-info/entry_points.txt +2 -0
  129. orionis-0.1.0.dist-info/top_level.txt +2 -0
  130. tests/__init__.py +0 -0
  131. tests/tools/__init__.py +0 -0
  132. tests/tools/class_example.py +50 -0
  133. tests/tools/test_reflection.py +128 -0
@@ -0,0 +1,40 @@
1
+ from typing import Any
2
+ from orionis.luminate.console.runner import CLIRunner
3
+ from orionis.luminate.contracts.console.command_interface import ICommand
4
+
5
+ class Command(ICommand):
6
+ """
7
+ Command class for managing and executing registered CLI commands.
8
+
9
+ This class provides a static method to invoke commands registered in the
10
+ `CacheCommands` singleton, passing the required signature and any additional
11
+ parameters.
12
+
13
+ Methods
14
+ -------
15
+ call(signature: str, vars: dict[str, Any] = {}, *args: Any, **kwargs: Any) -> Any
16
+ Executes the specified command with the provided arguments.
17
+ """
18
+
19
+ @staticmethod
20
+ def call(signature: str, vars: dict[str, Any] = {}, *args: Any, **kwargs: Any) -> Any:
21
+ """
22
+ Calls a registered command using the `CLIRunner`.
23
+
24
+ Parameters
25
+ ----------
26
+ signature : str
27
+ The command signature (name) to execute.
28
+ vars : dict[str, Any], optional
29
+ A dictionary containing named arguments for the command (default is `{}`).
30
+ *args : Any
31
+ Additional positional arguments.
32
+ **kwargs : Any
33
+ Additional keyword arguments.
34
+
35
+ Returns
36
+ -------
37
+ Any
38
+ The output of the executed command.
39
+ """
40
+ return CLIRunner.handle(signature, vars, *args, **kwargs)
@@ -0,0 +1,40 @@
1
+ from orionis.luminate.contracts.console.command_filter_interface import ICommandFilter
2
+
3
+ # List of commands that should be excluded from output formatting
4
+ EXCLUDED_COMMANDS = [
5
+ 'schedule:work', # Command to handle scheduled work
6
+ 'help', # Command to show help information
7
+ 'version', # Command to display version information
8
+ 'tests:run' # Command to run tests
9
+ ]
10
+
11
+ class CommandFilter(ICommandFilter):
12
+ """
13
+ CommandFilter handles the exclusion of specific commands from output formatting.
14
+
15
+ This class:
16
+ - Determines whether a command should be excluded from output formatting based on a predefined list.
17
+ - Can be extended or modified to support more advanced filtering if needed.
18
+
19
+ Methods
20
+ -------
21
+ isExcluded(command: str) -> bool
22
+ Checks if the given command is excluded from output formatting.
23
+ """
24
+
25
+ @staticmethod
26
+ def isExcluded(command: str) -> bool:
27
+ """
28
+ Checks if the given command is in the excluded commands list.
29
+
30
+ Parameters
31
+ ----------
32
+ command : str
33
+ The command to check.
34
+
35
+ Returns
36
+ -------
37
+ bool
38
+ Returns True if the command is excluded from output formatting, False otherwise.
39
+ """
40
+ return command in EXCLUDED_COMMANDS
File without changes
@@ -0,0 +1,56 @@
1
+ import os
2
+ import shutil
3
+ from orionis.luminate.console.register import register
4
+ from orionis.luminate.console.base.command import BaseCommand
5
+
6
+ @register.command
7
+ class CacheClearCommand(BaseCommand):
8
+ """
9
+ Clears Python bytecode caches (__pycache__) within the project directory.
10
+
11
+ This command recursively searches for and removes all `__pycache__` directories
12
+ in the project folder to ensure that no stale bytecode files persist.
13
+
14
+ Attributes
15
+ ----------
16
+ signature : str
17
+ The unique identifier for the command, used to trigger its execution.
18
+ description : str
19
+ A brief summary describing the purpose of the command.
20
+ """
21
+
22
+ # The command signature used to execute this command.
23
+ signature = 'cache:clear'
24
+
25
+ # A brief description of the command.
26
+ description = 'Clears the project cache by removing all __pycache__ directories.'
27
+
28
+ def handle(self) -> None:
29
+ """
30
+ Executes the cache clearing process.
31
+
32
+ This method performs the following actions:
33
+ - Recursively searches the project directory for `__pycache__` directories.
34
+ - Deletes all found `__pycache__` directories and their contents.
35
+ - Logs a success message if the process completes successfully, or an error message if an exception occurs.
36
+ """
37
+ try:
38
+
39
+ # Get the base project path
40
+ base_path = os.getcwd()
41
+
42
+ # Recursively traverse directories starting from the base path
43
+ for root, dirs, files in os.walk(base_path):
44
+ for dir in dirs:
45
+ if dir == '__pycache__':
46
+ # Form the path to the __pycache__ directory and remove it
47
+ pycache_path = os.path.join(root, dir)
48
+ shutil.rmtree(pycache_path)
49
+
50
+ # Log a success message once all caches are cleared
51
+ self.success(message='The application cache has been successfully cleared.', timestamp=True)
52
+
53
+ except Exception as e:
54
+
55
+ # Handle any unexpected error and display the error message
56
+ raise RuntimeError(f"An unexpected error occurred while clearing the cache: {e}") from e
@@ -0,0 +1,59 @@
1
+ from orionis.luminate.console.register import register
2
+ from orionis.luminate.console.base.command import BaseCommand
3
+ from orionis.luminate.cache.console.commands import CacheCommands
4
+
5
+ @register.command
6
+ class HelpCommand(BaseCommand):
7
+ """
8
+ Command class to display the list of available commands in the Orionis application.
9
+
10
+ This command fetches all registered commands from the cache and presents them in a table format.
11
+ """
12
+
13
+ # Command signature used for execution.
14
+ signature = "help"
15
+
16
+ # Brief description of the command.
17
+ description = "Prints the list of available commands along with their descriptions."
18
+
19
+ def handle(self) -> None:
20
+ """
21
+ Execute the help command.
22
+
23
+ This method retrieves all available commands from the cache, sorts them alphabetically,
24
+ and displays them in a structured table format.
25
+
26
+ Raises
27
+ ------
28
+ ValueError
29
+ If an unexpected error occurs during execution, a ValueError is raised
30
+ with the original exception message.
31
+ """
32
+ try:
33
+
34
+ # Display the available commands
35
+ self.newLine()
36
+ self.textSuccessBold(" (CLI Interpreter) Available Commands: ")
37
+
38
+ # Retrieve command cache
39
+ cache = CacheCommands()
40
+
41
+ # Fetch and store commands in a structured format
42
+ rows = [[command, cache.get(command)['description']] for command in cache.commands]
43
+
44
+ # Sort commands alphabetically
45
+ rows_sorted = sorted(rows, key=lambda x: x[0])
46
+
47
+ # Display the commands in a table format
48
+ self.table(
49
+ ["Signature", "Description"],
50
+ rows_sorted
51
+ )
52
+
53
+ # Add a new line after the table
54
+ self.newLine()
55
+
56
+ except Exception as e:
57
+
58
+ # Raise a ValueError if an unexpected error occurs.
59
+ raise ValueError(f"An unexpected error occurred: {e}") from e
@@ -0,0 +1,50 @@
1
+ from orionis.luminate.console.register import register
2
+ from orionis.luminate.console.base.command import BaseCommand
3
+ from orionis.luminate.console.tasks.scheduler import Schedule
4
+ from orionis.luminate.contracts.console.task_manager_interface import ITaskManager
5
+
6
+ @register.command
7
+ class ScheduleWorkCommand(BaseCommand):
8
+ """
9
+ Command class to handle scheduled tasks within the Orionis application.
10
+
11
+ This command initializes the scheduling system, registers the schedule,
12
+ and starts the execution of scheduled tasks.
13
+ """
14
+
15
+ # The command signature used to execute this command.
16
+ signature = "schedule:work"
17
+
18
+ # A brief description of the command.
19
+ description = "Starts the scheduled tasks."
20
+
21
+ def handle(self) -> None:
22
+ """
23
+ Execute the scheduled tasks.
24
+
25
+ This method initializes a Schedule instance, creates a TaskManager (Kernel),
26
+ registers the schedule, and starts the execution of scheduled tasks.
27
+
28
+ Raises
29
+ ------
30
+ RuntimeError
31
+ If an unexpected error occurs during execution, a RuntimeError is raised
32
+ with the original exception message.
33
+ """
34
+ try:
35
+
36
+ # Initialize a new Schedule instance.
37
+ schedule = Schedule()
38
+
39
+ # Create an instance of the TaskManager to manage the scheduling.
40
+ from app.console.tasks_manager import TaskManager # type: ignore
41
+ kernel: ITaskManager = TaskManager()
42
+ kernel.schedule(schedule)
43
+
44
+ # Start running the scheduled tasks using the schedule runner.
45
+ schedule.start()
46
+
47
+ except Exception as e:
48
+
49
+ # Raise a RuntimeError if an unexpected error occurs.
50
+ raise RuntimeError(f"An unexpected error occurred: {e}") from e
@@ -0,0 +1,40 @@
1
+ from orionis.luminate.facades.tests import UnitTests
2
+ from orionis.luminate.console.register import register
3
+ from orionis.luminate.console.base.command import BaseCommand
4
+
5
+ @register.command
6
+ class TestsCommand(BaseCommand):
7
+ """
8
+ Command class to display the list of available commands in the Orionis application.
9
+
10
+ This command fetches all registered commands from the cache and presents them in a table format.
11
+ """
12
+
13
+ # Command signature used for execution.
14
+ signature = "tests:run"
15
+
16
+ # Brief description of the command.
17
+ description = "Prints the list of available commands along with their descriptions."
18
+
19
+ def handle(self) -> None:
20
+ """
21
+ Execute the help command.
22
+
23
+ This method retrieves all available commands from the cache, sorts them alphabetically,
24
+ and displays them in a structured table format.
25
+
26
+ Raises
27
+ ------
28
+ ValueError
29
+ If an unexpected error occurs during execution, a ValueError is raised
30
+ with the original exception message.
31
+ """
32
+ try:
33
+
34
+ # Initialize the test suite using the custom testing framework.
35
+ return UnitTests.execute()
36
+
37
+ except Exception as e:
38
+
39
+ # Raise a ValueError if an unexpected error occurs.
40
+ raise ValueError(f"An unexpected error occurred: {e}") from e
@@ -0,0 +1,39 @@
1
+ from orionis.framework import VERSION
2
+ from orionis.luminate.console.register import register
3
+ from orionis.luminate.console.base.command import BaseCommand
4
+
5
+ @register.command
6
+ class VersionCommand(BaseCommand):
7
+ """
8
+ Command class to display the current version of the Orionis framework.
9
+
10
+ This command prints the version number of the framework in use.
11
+ """
12
+
13
+ # Command signature used for execution.
14
+ signature = "version"
15
+
16
+ # Brief description of the command.
17
+ description = "Prints the version of the framework in use."
18
+
19
+ def handle(self) -> None:
20
+ """
21
+ Execute the version command.
22
+
23
+ This method retrieves and prints the version of the Orionis framework.
24
+
25
+ Raises
26
+ ------
27
+ ValueError
28
+ If an unexpected error occurs during execution, a ValueError is raised
29
+ with the original exception message.
30
+ """
31
+ try:
32
+
33
+ # Print the version number
34
+ self.textSuccessBold(f"Orionis Framework v{VERSION}")
35
+
36
+ except Exception as e:
37
+
38
+ # Raise a ValueError if an unexpected error occurs.
39
+ raise ValueError(f"An unexpected error occurred: {e}") from e
File without changes
@@ -0,0 +1,125 @@
1
+ class CLIOrionisException(Exception):
2
+ """
3
+ Custom exception raised when there is an issue with dumping the Orionis data.
4
+
5
+ Parameters
6
+ ----------
7
+ response : str
8
+ The response message associated with the exception.
9
+
10
+ Attributes
11
+ ----------
12
+ response : str
13
+ Stores the response message passed during initialization.
14
+
15
+ Methods
16
+ -------
17
+ __str__()
18
+ Returns a string representation of the exception, including the response message.
19
+ """
20
+
21
+ def __init__(self, response: str):
22
+ """
23
+ Initializes the CLIOrionisException with the given response message.
24
+
25
+ Parameters
26
+ ----------
27
+ response : str
28
+ The response message associated with the exception.
29
+ """
30
+ self.response = response
31
+
32
+ def __str__(self):
33
+ """
34
+ Returns a string representation of the exception, including the response message.
35
+
36
+ Returns
37
+ -------
38
+ str
39
+ A string containing the exception name and the response message.
40
+ """
41
+ return f"CLIOrionisException: {self.response}"
42
+
43
+ class CLIOrionisValueError(Exception):
44
+ """
45
+ Custom exception raised when there is an issue with dumping the Orionis data.
46
+
47
+ Parameters
48
+ ----------
49
+ response : str
50
+ The response message associated with the exception.
51
+
52
+ Attributes
53
+ ----------
54
+ response : str
55
+ Stores the response message passed during initialization.
56
+
57
+ Methods
58
+ -------
59
+ __str__()
60
+ Returns a string representation of the exception, including the response message.
61
+ """
62
+
63
+ def __init__(self, response: str):
64
+ """
65
+ Initializes the CLIOrionisValueError with the given response message.
66
+
67
+ Parameters
68
+ ----------
69
+ response : str
70
+ The response message associated with the exception.
71
+ """
72
+ self.response = response
73
+
74
+ def __str__(self):
75
+ """
76
+ Returns a string representation of the exception, including the response message.
77
+
78
+ Returns
79
+ -------
80
+ str
81
+ A string containing the exception name and the response message.
82
+ """
83
+ return f"CLIOrionisValueError: {self.response}"
84
+
85
+ class CLIOrionisScheduleException(Exception):
86
+ """
87
+ Custom exception raised when there is an issue with dumping the Orionis data.
88
+
89
+ Parameters
90
+ ----------
91
+ response : str
92
+ The response message associated with the exception.
93
+
94
+ Attributes
95
+ ----------
96
+ response : str
97
+ Stores the response message passed during initialization.
98
+
99
+ Methods
100
+ -------
101
+ __str__()
102
+ Returns a string representation of the exception, including the response message.
103
+ """
104
+
105
+ def __init__(self, response: str):
106
+ """
107
+ Initializes the CLIOrionisValueError with the given response message.
108
+
109
+ Parameters
110
+ ----------
111
+ response : str
112
+ The response message associated with the exception.
113
+ """
114
+ self.response = response
115
+
116
+ def __str__(self):
117
+ """
118
+ Returns a string representation of the exception, including the response message.
119
+
120
+ Returns
121
+ -------
122
+ str
123
+ A string containing the exception name and the response message.
124
+ """
125
+ return f"CLIOrionisValueError: {self.response}"
@@ -0,0 +1,32 @@
1
+ from typing import Any, Tuple
2
+ from orionis.luminate.console.runner import CLIRunner
3
+ from orionis.luminate.contracts.console.kernel_interface import ICLIKernel
4
+
5
+ class CLIKernel(ICLIKernel):
6
+ """
7
+ CLIKernel acts as a bridge between the CLI entry point and the command runner.
8
+
9
+ This class provides a static method to handle command execution via `CLIRunner`.
10
+
11
+ Methods
12
+ -------
13
+ handle(*args: tuple[Any, ...]) -> Any
14
+ Processes CLI arguments and delegates execution to `CLIRunner`.
15
+ """
16
+
17
+ @staticmethod
18
+ def handle(*args: tuple[Any, ...]) -> Any:
19
+ """
20
+ Handles CLI command execution by forwarding arguments to `CLIRunner`.
21
+
22
+ Parameters
23
+ ----------
24
+ *args : tuple[Any, ...]
25
+ A tuple containing CLI arguments passed from the command line.
26
+
27
+ Returns
28
+ -------
29
+ Any
30
+ The result of the executed command.
31
+ """
32
+ return CLIRunner.handle(None, {}, *args)
File without changes