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
@@ -38,13 +38,25 @@ class CacheClearCommand(BaseCommand):
|
|
38
38
|
# Get the base project path
|
39
39
|
base_path = os.getcwd()
|
40
40
|
|
41
|
+
# Normalize the base path to ensure consistent formatting
|
42
|
+
base_path = os.path.normpath(base_path)
|
43
|
+
|
41
44
|
# Recursively traverse directories starting from the base path
|
42
|
-
for root, dirs, files in os.walk(base_path):
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
45
|
+
for root, dirs, files in os.walk(base_path, topdown=True):
|
46
|
+
|
47
|
+
# Skip the 'venv' directory and its subdirectories
|
48
|
+
if 'venv' in dirs:
|
49
|
+
dirs.remove('venv')
|
50
|
+
|
51
|
+
# Check for __pycache__ directories
|
52
|
+
if '__pycache__' in dirs:
|
53
|
+
pycache_path = os.path.join(root, '__pycache__')
|
54
|
+
|
55
|
+
# Attempt to remove the __pycache__ directory
|
56
|
+
try:
|
47
57
|
shutil.rmtree(pycache_path)
|
58
|
+
except OSError as e:
|
59
|
+
self.fail(f"Error removing {pycache_path}: {e}")
|
48
60
|
|
49
61
|
# Log a success message once all caches are cleared
|
50
62
|
self.success(message='The application cache has been successfully cleared.')
|
@@ -1,3 +1,4 @@
|
|
1
|
+
from orionis.luminate.app_context import AppContext
|
1
2
|
from orionis.luminate.console.base.command import BaseCommand
|
2
3
|
from orionis.luminate.cache.console.commands import CacheCommands
|
3
4
|
from orionis.luminate.console.exceptions.cli_exception import CLIOrionisRuntimeError
|
@@ -34,23 +35,28 @@ class HelpCommand(BaseCommand):
|
|
34
35
|
self.newLine()
|
35
36
|
self.textSuccessBold(" (CLI Interpreter) Available Commands: ")
|
36
37
|
|
37
|
-
#
|
38
|
-
|
38
|
+
# Fetch the commands from the container IoC
|
39
|
+
with AppContext() as app:
|
39
40
|
|
40
|
-
|
41
|
-
|
41
|
+
# Get the list of commands from the container
|
42
|
+
commands : dict = app.container._commands
|
42
43
|
|
43
|
-
|
44
|
-
|
44
|
+
# Initialize an empty list to store the rows.
|
45
|
+
rows = []
|
46
|
+
for signature, command_data in commands.items():
|
47
|
+
rows.append([signature, command_data['description']])
|
45
48
|
|
46
|
-
|
47
|
-
|
48
|
-
["Signature", "Description"],
|
49
|
-
rows_sorted
|
50
|
-
)
|
49
|
+
# Sort commands alphabetically
|
50
|
+
rows_sorted = sorted(rows, key=lambda x: x[0])
|
51
51
|
|
52
|
-
|
53
|
-
|
52
|
+
# Display the commands in a table format
|
53
|
+
self.table(
|
54
|
+
["Signature", "Description"],
|
55
|
+
rows_sorted
|
56
|
+
)
|
57
|
+
|
58
|
+
# Add a new line after the table
|
59
|
+
self.newLine()
|
54
60
|
|
55
61
|
except Exception as e:
|
56
62
|
|
@@ -1,7 +1,9 @@
|
|
1
|
+
import importlib
|
2
|
+
from orionis.luminate.app_context import AppContext
|
1
3
|
from orionis.luminate.console.base.command import BaseCommand
|
2
4
|
from orionis.luminate.console.exceptions.cli_exception import CLIOrionisRuntimeError
|
3
5
|
from orionis.luminate.console.tasks.scheduler import Schedule
|
4
|
-
from orionis.
|
6
|
+
from orionis.contracts.console.i_task_manager import ITaskManager
|
5
7
|
|
6
8
|
class ScheduleWorkCommand(BaseCommand):
|
7
9
|
"""
|
@@ -36,7 +38,8 @@ class ScheduleWorkCommand(BaseCommand):
|
|
36
38
|
schedule = Schedule()
|
37
39
|
|
38
40
|
# Create an instance of the TaskManager to manage the scheduling.
|
39
|
-
|
41
|
+
tasks_manager = importlib.import_module("app.console.tasks_manager")
|
42
|
+
TaskManager = getattr(tasks_manager, "TaskManager")
|
40
43
|
kernel: ITaskManager = TaskManager()
|
41
44
|
kernel.schedule(schedule)
|
42
45
|
|
@@ -46,4 +49,4 @@ class ScheduleWorkCommand(BaseCommand):
|
|
46
49
|
except Exception as e:
|
47
50
|
|
48
51
|
# Handle any unexpected error and display the error message
|
49
|
-
raise CLIOrionisRuntimeError(f"An unexpected error occurred: {e}") from e
|
52
|
+
raise CLIOrionisRuntimeError(f"An unexpected error occurred: {e}") from e
|
@@ -1,6 +1,6 @@
|
|
1
1
|
from orionis.luminate.console.exceptions.cli_exception import CLIOrionisRuntimeError
|
2
|
-
from orionis.luminate.facades.tests import UnitTests
|
3
2
|
from orionis.luminate.console.base.command import BaseCommand
|
3
|
+
from orionis.luminate.facades.tests.tests_facade import UnitTests
|
4
4
|
|
5
5
|
class TestsCommand(BaseCommand):
|
6
6
|
"""
|
@@ -29,11 +29,6 @@ class TestsCommand(BaseCommand):
|
|
29
29
|
with the original exception message.
|
30
30
|
"""
|
31
31
|
try:
|
32
|
-
|
33
|
-
# Initialize the test suite using the custom testing framework.
|
34
32
|
return UnitTests.execute()
|
35
|
-
|
36
33
|
except Exception as e:
|
37
|
-
|
38
|
-
# Handle any unexpected error and display the error message
|
39
34
|
raise CLIOrionisRuntimeError(f"An unexpected error occurred: {e}") from e
|
@@ -28,11 +28,6 @@ class VersionCommand(BaseCommand):
|
|
28
28
|
with the original exception message.
|
29
29
|
"""
|
30
30
|
try:
|
31
|
-
|
32
|
-
# Print the version number
|
33
31
|
self.textSuccessBold(f"Orionis Framework v{VERSION}")
|
34
|
-
|
35
32
|
except Exception as e:
|
36
|
-
|
37
|
-
# Handle any unexpected error and display the error message
|
38
33
|
raise CLIOrionisRuntimeError(f"An unexpected error occurred: {e}") from e
|
@@ -40,7 +40,6 @@ class CLIOrionisException(Exception):
|
|
40
40
|
"""
|
41
41
|
return f"[CLIOrionisException]: {self.args[0]}"
|
42
42
|
|
43
|
-
|
44
43
|
class CLIOrionisValueError(ValueError):
|
45
44
|
"""
|
46
45
|
Custom exception raised when there is a value error in Orionis data processing.
|
@@ -83,7 +82,6 @@ class CLIOrionisValueError(ValueError):
|
|
83
82
|
"""
|
84
83
|
return f"[CLIOrionisValueError]: {self.args[0]}"
|
85
84
|
|
86
|
-
|
87
85
|
class CLIOrionisScheduleException(Exception):
|
88
86
|
"""
|
89
87
|
Custom exception raised when there is an issue with the Orionis schedule.
|
@@ -126,7 +124,6 @@ class CLIOrionisScheduleException(Exception):
|
|
126
124
|
"""
|
127
125
|
return f"[CLIOrionisScheduleException]: {self.args[0]}"
|
128
126
|
|
129
|
-
|
130
127
|
class CLIOrionisRuntimeError(RuntimeError):
|
131
128
|
"""
|
132
129
|
Custom exception raised when there is a runtime issue with Orionis processing.
|
@@ -167,4 +164,4 @@ class CLIOrionisRuntimeError(RuntimeError):
|
|
167
164
|
str
|
168
165
|
A string containing the exception name and the response message.
|
169
166
|
"""
|
170
|
-
return f"[CLIOrionisRuntimeError]: {self.args[0]}"
|
167
|
+
return f"[CLIOrionisRuntimeError]: {self.args[0]}"
|
@@ -1,6 +1,6 @@
|
|
1
1
|
from typing import Any
|
2
|
+
from orionis.contracts.console.i_kernel import ICLIKernel
|
2
3
|
from orionis.luminate.console.runner import CLIRunner
|
3
|
-
from orionis.luminate.contracts.console.kernel_interface import ICLIKernel
|
4
4
|
|
5
5
|
class CLIKernel(ICLIKernel):
|
6
6
|
"""
|
@@ -29,4 +29,4 @@ class CLIKernel(ICLIKernel):
|
|
29
29
|
Any
|
30
30
|
The result of the executed command.
|
31
31
|
"""
|
32
|
-
|
32
|
+
pass
|
@@ -2,9 +2,9 @@ import os
|
|
2
2
|
import sys
|
3
3
|
import getpass
|
4
4
|
import datetime
|
5
|
+
from orionis.contracts.console.output.i_console import IConsole
|
5
6
|
from orionis.luminate.console.output.styles import ANSIColors
|
6
|
-
from orionis.luminate.
|
7
|
-
from orionis.luminate.tools.exception_to_dict import ExceptionsToDict
|
7
|
+
from orionis.luminate.support.exception_to_dict import ExceptionsToDict
|
8
8
|
|
9
9
|
class Console(IConsole):
|
10
10
|
"""
|
@@ -1,6 +1,6 @@
|
|
1
1
|
from datetime import datetime
|
2
|
+
from orionis.contracts.console.output.i_executor import IExecutor
|
2
3
|
from orionis.luminate.console.output.styles import ANSIColors
|
3
|
-
from orionis.luminate.contracts.console.output.executor_interface import IExecutor
|
4
4
|
|
5
5
|
class Executor(IExecutor):
|
6
6
|
"""
|
@@ -1,9 +1,9 @@
|
|
1
1
|
import shlex
|
2
2
|
import types
|
3
3
|
import argparse
|
4
|
-
from io import StringIO
|
5
4
|
from contextlib import redirect_stderr
|
6
|
-
from
|
5
|
+
from io import StringIO
|
6
|
+
from orionis.contracts.console.i_parser import IParser
|
7
7
|
|
8
8
|
class Parser(IParser):
|
9
9
|
"""
|
@@ -1,126 +1,127 @@
|
|
1
|
-
import time
|
2
|
-
from orionis.luminate.facades.log import Log
|
3
|
-
from orionis.luminate.console.output.console import Console
|
4
|
-
from orionis.luminate.console.output.executor import Executor
|
5
|
-
from orionis.luminate.pipelines.cli_pipeline import CLIPipeline
|
6
|
-
from orionis.luminate.console.command_filter import CommandFilter
|
7
|
-
from orionis.luminate.contracts.console.runner_interface import ICLIRunner
|
8
|
-
|
9
|
-
class CLIRunner
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
-
|
16
|
-
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
1
|
+
# import time
|
2
|
+
# from orionis.luminate.facades.log import Log
|
3
|
+
# from orionis.luminate.console.output.console import Console
|
4
|
+
# from orionis.luminate.console.output.executor import Executor
|
5
|
+
# from orionis.luminate.pipelines.cli_pipeline import CLIPipeline
|
6
|
+
# from orionis.luminate.console.command_filter import CommandFilter
|
7
|
+
# from orionis.luminate.contracts.console.runner_interface import ICLIRunner
|
8
|
+
|
9
|
+
class CLIRunner:
|
10
|
+
pass
|
11
|
+
# """
|
12
|
+
# CLIRunner manages the execution of CLI commands in Orionis.
|
13
|
+
|
14
|
+
# This class:
|
15
|
+
# - Parses command-line arguments or function parameters.
|
16
|
+
# - Executes commands through the `CLIPipeline`.
|
17
|
+
# - Logs execution status and errors.
|
18
|
+
|
19
|
+
# Methods
|
20
|
+
# -------
|
21
|
+
# handle(signature: str = None, vars: dict = {}, *args, **kwargs)
|
22
|
+
# Processes and executes a CLI command based on provided arguments.
|
23
|
+
# """
|
24
|
+
|
25
|
+
# @staticmethod
|
26
|
+
# def handle(signature: str = None, vars: dict = {}, *args, **kwargs):
|
27
|
+
# """
|
28
|
+
# Processes and executes a CLI command.
|
29
|
+
|
30
|
+
# This method:
|
31
|
+
# - Determines whether the command is invoked from `sys.argv` or as a function.
|
32
|
+
# - Extracts the command signature and arguments.
|
33
|
+
# - Executes the command pipeline.
|
34
|
+
# - Logs execution status and handles errors.
|
35
|
+
|
36
|
+
# Parameters
|
37
|
+
# ----------
|
38
|
+
# signature : str, optional
|
39
|
+
# The command signature (default is None, meaning it is extracted from `sys.argv`).
|
40
|
+
# vars : dict, optional
|
41
|
+
# Named arguments for the command (default is an empty dictionary).
|
42
|
+
# *args
|
43
|
+
# Additional arguments for the command.
|
44
|
+
# **kwargs
|
45
|
+
# Additional keyword arguments for the command.
|
46
|
+
|
47
|
+
# Returns
|
48
|
+
# -------
|
49
|
+
# Any
|
50
|
+
# The output of the executed command.
|
51
|
+
|
52
|
+
# Raises
|
53
|
+
# ------
|
54
|
+
# ValueError
|
55
|
+
# If no command signature is provided.
|
56
|
+
# Exception
|
57
|
+
# If an unexpected error occurs during execution.
|
58
|
+
# """
|
59
|
+
|
60
|
+
# try:
|
61
|
+
|
62
|
+
# # Exclude commands from Printing
|
63
|
+
# exclude_running = CommandFilter.isExcluded(signature)
|
64
|
+
|
65
|
+
# # Determine if command is being executed from sys.argv
|
66
|
+
# sys_argv = signature is None
|
67
|
+
|
68
|
+
# # Start execution timer
|
69
|
+
# start_time = time.perf_counter()
|
70
|
+
|
71
|
+
# # Handle command signature extraction from sys.argv
|
72
|
+
# if sys_argv:
|
73
|
+
|
74
|
+
# # Extract command signature and arguments from sys.argv
|
75
|
+
# if not args or len(args[0]) <= 1:
|
76
|
+
# raise ValueError("No command signature specified.")
|
77
|
+
|
78
|
+
# # Extract command signature and arguments
|
79
|
+
# args_list = args[0]
|
80
|
+
# signature, *args = args_list[1:]
|
81
|
+
|
82
|
+
# # Log command execution start
|
83
|
+
# Log.info(f"Running command: {signature}")
|
84
|
+
|
85
|
+
# if not exclude_running:
|
86
|
+
# Executor.running(program=signature)
|
87
|
+
|
88
|
+
# # Initialize command pipeline
|
89
|
+
# pipeline = CLIPipeline().getCommand(signature)
|
90
|
+
|
91
|
+
# # Parse arguments based on invocation type
|
92
|
+
# if sys_argv:
|
93
|
+
# pipeline.parseArguments(*args)
|
94
|
+
# else:
|
95
|
+
# pipeline.parseArguments(vars, *args, **kwargs)
|
96
|
+
|
97
|
+
# # Execute the command
|
98
|
+
# output = pipeline.execute()
|
99
|
+
|
100
|
+
# # Log successful execution
|
101
|
+
# Log.success(f"Command executed successfully: {signature}")
|
102
|
+
|
103
|
+
# # Calculate execution time
|
104
|
+
# if not exclude_running:
|
105
|
+
# elapsed_time = round(time.perf_counter() - start_time, 2)
|
106
|
+
# Executor.done(program=signature, time=f"{elapsed_time}s")
|
107
|
+
|
108
|
+
# # Return command output
|
109
|
+
# return output
|
110
|
+
|
111
|
+
# except ValueError as e:
|
112
|
+
|
113
|
+
# # Handle missing or invalid command signature
|
114
|
+
# Log.error(f"Command failed: {signature or 'Unknown'}, Value Error: {e}")
|
115
|
+
# if not exclude_running:
|
116
|
+
# Console.error(message=f"Value Error: {e}")
|
117
|
+
# elapsed_time = round(time.perf_counter() - start_time, 2)
|
118
|
+
# Executor.fail(program=signature or "Unknown", time=f"{elapsed_time}s")
|
119
|
+
|
120
|
+
# except Exception as e:
|
121
|
+
|
122
|
+
# # Handle unexpected errors
|
123
|
+
# Log.error(f"Command failed: {signature or 'Unknown'}, Execution Error: {e}")
|
124
|
+
# if not exclude_running:
|
125
|
+
# Console.error(message=f"Execution Error: {e}")
|
126
|
+
# elapsed_time = round(time.perf_counter() - start_time, 2)
|
127
|
+
# Executor.fail(program=signature or "Unknown", time=f"{elapsed_time}s")
|
@@ -1,14 +1,15 @@
|
|
1
|
+
import logging
|
1
2
|
import re
|
2
3
|
import sys
|
3
4
|
import time
|
4
|
-
import logging
|
5
|
-
from typing import Any
|
6
5
|
from datetime import datetime
|
6
|
+
from typing import Any
|
7
|
+
from apscheduler.schedulers.background import BackgroundScheduler
|
7
8
|
from apscheduler.triggers.cron import CronTrigger
|
8
|
-
from orionis.luminate.console.command import Command
|
9
9
|
from apscheduler.triggers.interval import IntervalTrigger
|
10
|
-
from
|
11
|
-
from orionis.luminate.
|
10
|
+
from orionis.contracts.console.tasks.i_schedule import ISchedule
|
11
|
+
from orionis.luminate.app_context import AppContext
|
12
|
+
from orionis.luminate.console.command import Command
|
12
13
|
from orionis.luminate.console.exceptions.cli_exception import CLIOrionisScheduleException
|
13
14
|
|
14
15
|
class Schedule(ISchedule):
|
@@ -65,10 +66,10 @@ class Schedule(ISchedule):
|
|
65
66
|
Schedule
|
66
67
|
Returns the Schedule instance itself, allowing method chaining.
|
67
68
|
"""
|
68
|
-
# Store the command logic as a lambda function
|
69
69
|
def func():
|
70
70
|
try:
|
71
|
-
|
71
|
+
with AppContext() as app:
|
72
|
+
app.container.makeCommand(signature, vars, *args, **kwargs)
|
72
73
|
finally:
|
73
74
|
if not self.scheduler.get_jobs():
|
74
75
|
self.wait = False
|
@@ -2,9 +2,9 @@ import inspect
|
|
2
2
|
from collections import deque
|
3
3
|
from threading import Lock
|
4
4
|
from typing import Callable, Any, Dict
|
5
|
+
from orionis.contracts.container.i_container import IContainer
|
5
6
|
from orionis.luminate.container.exception import OrionisContainerException, OrionisContainerValueError, OrionisContainerTypeError
|
6
7
|
from orionis.luminate.container.types import Types
|
7
|
-
from orionis.luminate.contracts.container.container_interface import IContainer
|
8
8
|
|
9
9
|
BINDING = 'binding'
|
10
10
|
TRANSIENT = 'transient'
|
@@ -1,9 +1,24 @@
|
|
1
|
-
from orionis.
|
1
|
+
from orionis.contracts.container.i_types import ITypes
|
2
2
|
|
3
3
|
class Types(ITypes):
|
4
|
-
"""
|
4
|
+
"""
|
5
|
+
A class that handles validation of primitive types to prevent registering services with primitive-type names.
|
6
|
+
|
7
|
+
This class provides a method to check if a given name corresponds to a primitive type.
|
8
|
+
It is used to ensure that services or aliases are not registered with names that conflict
|
9
|
+
with Python's built-in primitive types.
|
10
|
+
|
11
|
+
Attributes
|
12
|
+
----------
|
13
|
+
_primitive_types : set
|
14
|
+
A set containing Python's built-in primitive types and their string representations.
|
15
|
+
|
16
|
+
Methods
|
17
|
+
-------
|
18
|
+
isPrimitive(name: str) -> bool
|
19
|
+
Checks if the provided name corresponds to a primitive type.
|
20
|
+
"""
|
5
21
|
|
6
|
-
# A set of common primitive types in Python
|
7
22
|
_primitive_types = {
|
8
23
|
int, float, str, bool, bytes, type(None), complex,
|
9
24
|
list, tuple, dict, set, frozenset,
|
@@ -11,15 +26,26 @@ class Types(ITypes):
|
|
11
26
|
"list", "tuple", "dict", "set", "frozenset"
|
12
27
|
}
|
13
28
|
|
14
|
-
def isPrimitive(self, name: str) ->
|
15
|
-
"""
|
29
|
+
def isPrimitive(self, name: str) -> bool:
|
30
|
+
"""
|
31
|
+
Checks if the provided name corresponds to a primitive type.
|
32
|
+
|
33
|
+
This method is used to prevent registering services or aliases with names that
|
34
|
+
conflict with Python's built-in primitive types.
|
35
|
+
|
36
|
+
Parameters
|
37
|
+
----------
|
38
|
+
name : str
|
39
|
+
The name of the service or alias to check.
|
16
40
|
|
17
|
-
|
18
|
-
|
41
|
+
Returns
|
42
|
+
-------
|
43
|
+
bool
|
44
|
+
True if the name corresponds to a primitive type, False otherwise.
|
19
45
|
|
20
|
-
Raises
|
21
|
-
|
46
|
+
Raises
|
47
|
+
------
|
48
|
+
OrionisContainerException
|
49
|
+
If the name matches a primitive type (not implemented in this method).
|
22
50
|
"""
|
23
|
-
|
24
|
-
return True
|
25
|
-
return False
|
51
|
+
return name in self._primitive_types
|
@@ -0,0 +1,43 @@
|
|
1
|
+
from typing import Any, Optional
|
2
|
+
from orionis.contracts.facades.config.i_config_facade import IConfig
|
3
|
+
from orionis.luminate.app_context import AppContext
|
4
|
+
from orionis.luminate.services.config.config_service import ConfigService
|
5
|
+
|
6
|
+
class Config(IConfig):
|
7
|
+
|
8
|
+
@staticmethod
|
9
|
+
def set(key: str, value: Any) -> None:
|
10
|
+
"""
|
11
|
+
Dynamically sets a configuration value using dot notation.
|
12
|
+
|
13
|
+
Parameters
|
14
|
+
----------
|
15
|
+
key : str
|
16
|
+
The configuration key (e.g., 'app.debug').
|
17
|
+
value : Any
|
18
|
+
The value to set.
|
19
|
+
"""
|
20
|
+
with AppContext() as app:
|
21
|
+
config_service : ConfigService = app.container.make(ConfigService)
|
22
|
+
config_service.set(key, value)
|
23
|
+
|
24
|
+
@staticmethod
|
25
|
+
def get(key: str, default: Optional[Any] = None) -> Any:
|
26
|
+
"""
|
27
|
+
Retrieves a configuration value using dot notation.
|
28
|
+
|
29
|
+
Parameters
|
30
|
+
----------
|
31
|
+
key : str
|
32
|
+
The configuration key (e.g., 'app.debug').
|
33
|
+
default : Optional[Any]
|
34
|
+
The default value to return if the key is not found.
|
35
|
+
|
36
|
+
Returns
|
37
|
+
-------
|
38
|
+
Any
|
39
|
+
The configuration value or the default value if the key is not found.
|
40
|
+
"""
|
41
|
+
with AppContext() as app:
|
42
|
+
config_service : ConfigService = app.container.make(ConfigService)
|
43
|
+
return config_service.get(key, default)
|