orionis 0.25.0__tar.gz → 0.27.0__tar.gz
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.
- {orionis-0.25.0/orionis.egg-info → orionis-0.27.0}/PKG-INFO +1 -1
- {orionis-0.25.0 → orionis-0.27.0}/orionis/framework.py +1 -1
- orionis-0.27.0/orionis/luminate/bootstrap/cli_exception.py +54 -0
- orionis-0.27.0/orionis/luminate/bootstrap/commands/bootstrapper.py +99 -0
- {orionis-0.25.0/orionis/luminate/console → orionis-0.27.0/orionis/luminate/bootstrap/commands}/register.py +7 -13
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/bootstrap/config/bootstrapper.py +2 -1
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/cache/app/config.py +14 -7
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/cache/console/commands.py +20 -21
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/console/base/command.py +1 -1
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/console/cache.py +12 -57
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/console/commands/cache_clear.py +3 -4
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/console/commands/help.py +3 -4
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/console/commands/schedule_work.py +3 -4
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/console/commands/tests.py +3 -4
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/console/commands/version.py +3 -4
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/console/exceptions/cli_exception.py +43 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/console/kernel.py +1 -1
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/console/output/console.py +1 -1
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/console/output/executor.py +1 -1
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/console/output/progress_bar.py +1 -1
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/console/scripts/management.py +1 -1
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/console/tasks/scheduler.py +1 -1
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/container/container.py +19 -22
- orionis-0.27.0/orionis/luminate/contracts/bootstrap/commands/bootstrapper_interface.py +44 -0
- {orionis-0.25.0/orionis/luminate/contracts/console → orionis-0.27.0/orionis/luminate/contracts/bootstrap/commands}/register_interface.py +2 -1
- orionis-0.27.0/orionis/luminate/contracts/cache/app/config_interface.py +76 -0
- orionis-0.25.0/orionis/luminate/contracts/cache/cache_commands_interface.py → orionis-0.27.0/orionis/luminate/contracts/cache/console/commands_interface.py +14 -5
- {orionis-0.25.0 → orionis-0.27.0/orionis.egg-info}/PKG-INFO +1 -1
- {orionis-0.25.0 → orionis-0.27.0}/orionis.egg-info/SOURCES.txt +13 -10
- orionis-0.25.0/orionis/luminate/contracts/console/cli_cache_interface.py +0 -34
- {orionis-0.25.0 → orionis-0.27.0}/LICENCE +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/MANIFEST.in +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/README.md +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/__init__.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/cli_manager.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/__init__.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/app.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/bootstrap/__init__.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/bootstrap/config/__init__.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/bootstrap/config/parser.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/bootstrap/config/register.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/cache/__init__.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/cache/app/__init__.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/cache/console/__init__.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/config/__init__.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/config/dataclass/__init__.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/config/dataclass/app.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/config/dataclass/auth.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/config/dataclass/cache.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/config/dataclass/cors.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/config/dataclass/database.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/config/dataclass/filesystems.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/config/dataclass/logging.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/config/dataclass/mail.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/config/dataclass/queue.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/config/dataclass/session.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/config/environment.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/console/__init__.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/console/base/__init__.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/console/command.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/console/command_filter.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/console/commands/__init__.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/console/exceptions/__init__.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/console/output/__init__.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/console/output/styles.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/console/parser.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/console/runner.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/console/scripts/__init__.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/console/tasks/__init__.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/container/exception.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/container/types.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/contracts/__init__.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/contracts/bootstrap/config/bootstrapper_interface.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/contracts/bootstrap/config/parser_interface.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/contracts/bootstrap/config/register_interface.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/contracts/cache/__init__.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/contracts/config/__init__.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/contracts/config/config_interface.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/contracts/config/environment_interface.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/contracts/console/__init__.py +0 -0
- {orionis-0.25.0/orionis/luminate/contracts/console → orionis-0.27.0/orionis/luminate/contracts/console/base}/base_command_interface.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/contracts/console/command_filter_interface.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/contracts/console/command_interface.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/contracts/console/kernel_interface.py +0 -0
- {orionis-0.25.0/orionis/luminate/contracts/console → orionis-0.27.0/orionis/luminate/contracts/console/output}/console_interface.py +0 -0
- {orionis-0.25.0/orionis/luminate/contracts/console → orionis-0.27.0/orionis/luminate/contracts/console/output}/executor_interface.py +0 -0
- {orionis-0.25.0/orionis/luminate/contracts/console → orionis-0.27.0/orionis/luminate/contracts/console/output}/progress_bar_interface.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/contracts/console/parser_interface.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/contracts/console/runner_interface.py +0 -0
- {orionis-0.25.0/orionis/luminate/contracts/console → orionis-0.27.0/orionis/luminate/contracts/console/scripts}/management_interface.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/contracts/console/task_manager_interface.py +0 -0
- {orionis-0.25.0/orionis/luminate/contracts/console → orionis-0.27.0/orionis/luminate/contracts/console/tasks}/schedule_interface.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/contracts/container/container_interface.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/contracts/container/types_interface.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/contracts/facades/__init__.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/contracts/facades/env_interface.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/contracts/facades/log_interface.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/contracts/facades/paths_interface.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/contracts/facades/tests_interface.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/contracts/files/__init__.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/contracts/files/paths_interface.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/contracts/installer/__init__.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/contracts/installer/output_interface.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/contracts/installer/setup_interface.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/contracts/installer/upgrade_interface.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/contracts/log/__init__.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/contracts/log/logger_interface.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/contracts/pipelines/cli_pipeline_interface.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/contracts/publisher/__init__.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/contracts/publisher/pypi_publisher_interface.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/contracts/test/__init__.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/contracts/test/unit_test_interface.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/contracts/tools/__init__.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/contracts/tools/reflection_interface.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/contracts/tools/std_interface.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/facades/__init__.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/facades/environment.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/facades/log.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/facades/paths.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/facades/tests.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/files/__init__.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/files/paths.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/installer/__init__.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/installer/icon.ascii +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/installer/info.ascii +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/installer/output.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/installer/setup.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/installer/upgrade.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/log/__init__.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/log/logger.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/pipelines/__init__.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/pipelines/cli_pipeline.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/publisher/__init__.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/publisher/pypi.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/static/bg/galaxy.jpg +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/static/favicon/OrionisFrameworkFavicon.png +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/static/logos/OrionisFramework.jpg +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/static/logos/OrionisFramework.png +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/static/logos/OrionisFramework.psd +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/static/logos/OrionisFramework2.png +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/static/logos/OrionisFramework3.png +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/test/__init__.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/test/exception.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/test/unit_test.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/tools/__init__.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/tools/dot_dict.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/tools/reflection.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis/luminate/tools/std.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis.egg-info/dependency_links.txt +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis.egg-info/entry_points.txt +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis.egg-info/requires.txt +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/orionis.egg-info/top_level.txt +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/setup.cfg +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/setup.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/tests/__init__.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/tests/tools/__init__.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/tests/tools/class_example.py +0 -0
- {orionis-0.25.0 → orionis-0.27.0}/tests/tools/test_reflection.py +0 -0
@@ -0,0 +1,54 @@
|
|
1
|
+
class BootstrapRuntimeError(RuntimeError):
|
2
|
+
"""
|
3
|
+
Exception raised for errors related to dumping Orionis data.
|
4
|
+
|
5
|
+
Parameters
|
6
|
+
----------
|
7
|
+
message : str
|
8
|
+
The error message describing the issue.
|
9
|
+
|
10
|
+
Attributes
|
11
|
+
----------
|
12
|
+
message : str
|
13
|
+
The stored error message.
|
14
|
+
|
15
|
+
Methods
|
16
|
+
-------
|
17
|
+
__str__()
|
18
|
+
Returns a user-friendly string representation of the exception.
|
19
|
+
__repr__()
|
20
|
+
Returns a detailed representation for debugging purposes.
|
21
|
+
"""
|
22
|
+
|
23
|
+
def __init__(self, message: str):
|
24
|
+
"""
|
25
|
+
Initialize the exception with a message.
|
26
|
+
|
27
|
+
Parameters
|
28
|
+
----------
|
29
|
+
message : str
|
30
|
+
The error message describing the issue.
|
31
|
+
"""
|
32
|
+
super().__init__(f"[BootstrapRuntimeError]: {message}")
|
33
|
+
|
34
|
+
def __str__(self) -> str:
|
35
|
+
"""
|
36
|
+
Returns a user-friendly string representation.
|
37
|
+
|
38
|
+
Returns
|
39
|
+
-------
|
40
|
+
str
|
41
|
+
A formatted error message.
|
42
|
+
"""
|
43
|
+
return self.args[0]
|
44
|
+
|
45
|
+
def __repr__(self) -> str:
|
46
|
+
"""
|
47
|
+
Returns a detailed representation for debugging.
|
48
|
+
|
49
|
+
Returns
|
50
|
+
-------
|
51
|
+
str
|
52
|
+
A detailed string representation including the exception name.
|
53
|
+
"""
|
54
|
+
return f"{self.__class__.__name__}({self.args[0]!r})"
|
@@ -0,0 +1,99 @@
|
|
1
|
+
import pathlib
|
2
|
+
import importlib
|
3
|
+
import inspect
|
4
|
+
from orionis.luminate.bootstrap.cli_exception import BootstrapRuntimeError
|
5
|
+
from orionis.luminate.bootstrap.commands.register import Register
|
6
|
+
from orionis.luminate.console.base.command import BaseCommand
|
7
|
+
from orionis.luminate.contracts.bootstrap.commands.bootstrapper_interface import IBootstrapper
|
8
|
+
|
9
|
+
class Bootstrapper(IBootstrapper):
|
10
|
+
"""
|
11
|
+
Manages the automatic loading and registration of command classes
|
12
|
+
from Python files located in predefined directories.
|
13
|
+
|
14
|
+
The `Bootstrapper` class scans specific directories for Python files, dynamically
|
15
|
+
imports them, and registers classes that inherit from `BaseCommand`.
|
16
|
+
|
17
|
+
Attributes
|
18
|
+
----------
|
19
|
+
register : Register
|
20
|
+
An instance of the `Register` class used to register command classes.
|
21
|
+
|
22
|
+
Methods
|
23
|
+
-------
|
24
|
+
__init__(register: Register) -> None
|
25
|
+
Initializes the `Bootstrapper` with a `Register` instance and triggers autoloading.
|
26
|
+
_autoload() -> None
|
27
|
+
Scans predefined directories for Python files, dynamically imports modules,
|
28
|
+
and registers classes that extend `BaseCommand`.
|
29
|
+
"""
|
30
|
+
|
31
|
+
def __init__(self, register: Register) -> None:
|
32
|
+
"""
|
33
|
+
Initializes the `Bootstrapper` with a `Register` instance and triggers autoloading.
|
34
|
+
|
35
|
+
Parameters
|
36
|
+
----------
|
37
|
+
register : Register
|
38
|
+
An instance of the `Register` class used to register command classes.
|
39
|
+
"""
|
40
|
+
self.register = register
|
41
|
+
self._autoload()
|
42
|
+
|
43
|
+
def _autoload(self) -> None:
|
44
|
+
"""
|
45
|
+
Autoloads command modules from specified directories and registers command classes.
|
46
|
+
|
47
|
+
This method searches for Python files in the predefined command directories,
|
48
|
+
dynamically imports the modules, and registers classes that inherit from `BaseCommand`.
|
49
|
+
|
50
|
+
The command directories searched are:
|
51
|
+
- `app/console/commands` relative to the current working directory.
|
52
|
+
- `console/commands` relative to the parent directory of the current file.
|
53
|
+
|
54
|
+
It skips `__init__.py` files and ignores directories that do not exist.
|
55
|
+
|
56
|
+
Raises
|
57
|
+
------
|
58
|
+
BootstrapRuntimeError
|
59
|
+
If an error occurs while loading a module.
|
60
|
+
"""
|
61
|
+
|
62
|
+
# Define the base project path
|
63
|
+
base_path = pathlib.Path.cwd()
|
64
|
+
|
65
|
+
# Define the command directories to search
|
66
|
+
command_dirs = [
|
67
|
+
base_path / "app" / "console" / "commands",
|
68
|
+
pathlib.Path(__file__).resolve().parent.parent / "console" / "commands"
|
69
|
+
]
|
70
|
+
|
71
|
+
# Iterate over each command directory
|
72
|
+
for cmd_dir in command_dirs:
|
73
|
+
|
74
|
+
# Skip if the directory does not exist
|
75
|
+
if not cmd_dir.is_dir():
|
76
|
+
continue
|
77
|
+
|
78
|
+
# Iterate over Python files in the directory (recursive search)
|
79
|
+
for file_path in cmd_dir.rglob("*.py"):
|
80
|
+
|
81
|
+
# Skip `__init__.py` files
|
82
|
+
if file_path.name == "__init__.py":
|
83
|
+
continue
|
84
|
+
|
85
|
+
# Convert file path to a Python module import path
|
86
|
+
module_path = ".".join(file_path.relative_to(base_path).with_suffix("").parts)
|
87
|
+
|
88
|
+
try:
|
89
|
+
# Dynamically import the module
|
90
|
+
module = importlib.import_module(module_path)
|
91
|
+
|
92
|
+
# Find classes that inherit from `BaseCommand`
|
93
|
+
for name, obj in inspect.getmembers(module, inspect.isclass):
|
94
|
+
if issubclass(obj, BaseCommand) and obj is not BaseCommand:
|
95
|
+
# Register the class
|
96
|
+
self.register.command(obj)
|
97
|
+
|
98
|
+
except Exception as e:
|
99
|
+
raise BootstrapRuntimeError(f"Error loading {module_path}") from e
|
@@ -1,6 +1,7 @@
|
|
1
|
+
from typing import Any, Callable
|
1
2
|
from orionis.luminate.console.base.command import BaseCommand
|
2
3
|
from orionis.luminate.cache.console.commands import CacheCommands
|
3
|
-
from orionis.luminate.contracts.
|
4
|
+
from orionis.luminate.contracts.bootstrap.commands.register_interface import IRegister
|
4
5
|
|
5
6
|
class Register(IRegister):
|
6
7
|
"""
|
@@ -12,13 +13,13 @@ class Register(IRegister):
|
|
12
13
|
A dictionary storing registered command classes.
|
13
14
|
"""
|
14
15
|
|
15
|
-
def __init__(self, cache : CacheCommands
|
16
|
+
def __init__(self, cache : CacheCommands):
|
16
17
|
"""
|
17
18
|
Initializes the Register instance and prepares the cache commands system.
|
18
19
|
"""
|
19
|
-
self.cache_commands = cache
|
20
|
+
self.cache_commands = cache
|
20
21
|
|
21
|
-
def command(self, command_class):
|
22
|
+
def command(self, command_class: Callable[..., Any]) -> None:
|
22
23
|
"""
|
23
24
|
Registers a command class after validating its structure.
|
24
25
|
|
@@ -84,15 +85,8 @@ class Register(IRegister):
|
|
84
85
|
|
85
86
|
# Register the command
|
86
87
|
self.cache_commands.register(
|
87
|
-
|
88
|
+
concrete=command_class,
|
88
89
|
arguments=arguments,
|
89
90
|
description=description,
|
90
91
|
signature=signature
|
91
|
-
)
|
92
|
-
|
93
|
-
# Return Class
|
94
|
-
return command_class
|
95
|
-
|
96
|
-
|
97
|
-
# Return Decorator.
|
98
|
-
register = Register()
|
92
|
+
)
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import importlib
|
2
2
|
import pathlib
|
3
|
+
from orionis.luminate.bootstrap.cli_exception import BootstrapRuntimeError
|
3
4
|
from orionis.luminate.bootstrap.config.register import Register
|
4
5
|
from orionis.luminate.contracts.bootstrap.config.bootstrapper_interface import IBootstrapper
|
5
6
|
|
@@ -74,5 +75,5 @@ class Bootstrapper(IBootstrapper):
|
|
74
75
|
if hasattr(module, "Config"):
|
75
76
|
self.register.config(getattr(module, "Config"))
|
76
77
|
except Exception as e:
|
77
|
-
raise
|
78
|
+
raise BootstrapRuntimeError(f"Error loading module {module_path}") from e
|
78
79
|
|
@@ -1,15 +1,22 @@
|
|
1
1
|
from typing import Dict, Any
|
2
|
+
from orionis.luminate.contracts.cache.app.config_interface import ICacheConfig
|
2
3
|
|
3
|
-
class CacheConfig:
|
4
|
+
class CacheConfig(ICacheConfig):
|
4
5
|
"""
|
5
|
-
|
6
|
-
and provides methods to register, unregister, and retrieve configurations.
|
6
|
+
CacheConfig is a class that manages the registration, unregistration, and retrieval of configuration sections.
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
8
|
+
Methods
|
9
|
+
-------
|
10
|
+
__init__()
|
11
|
+
Initializes a new instance of the class with an empty configuration dictionary.
|
12
|
+
register(section: str, data: Dict[str, Any])
|
13
|
+
Registers a configuration section with its associated data.
|
14
|
+
unregister(section: str)
|
15
|
+
Unregisters a previously registered configuration section.
|
16
|
+
get(section: str)
|
17
|
+
Retrieves the configuration data for a specific section.
|
12
18
|
"""
|
19
|
+
|
13
20
|
def __init__(self) -> None:
|
14
21
|
"""
|
15
22
|
Initializes a new instance of the class with an empty configuration dictionary.
|
@@ -1,33 +1,32 @@
|
|
1
|
-
from
|
1
|
+
from typing import Any, Callable
|
2
|
+
from orionis.luminate.contracts.cache.console.commands_interface import ICacheCommands
|
2
3
|
|
3
4
|
class CacheCommands(ICacheCommands):
|
4
5
|
"""
|
5
|
-
|
6
|
+
CacheCommands is a class that manages the registration, unregistration, and retrieval of command instances.
|
6
7
|
|
7
|
-
|
8
|
-
|
8
|
+
Methods
|
9
|
+
-------
|
10
|
+
__init__()
|
11
|
+
Initializes the command cache with an empty dictionary.
|
12
|
+
register(signature: str, description: str, arguments: list, concrete: Callable[..., Any])
|
13
|
+
Register a new command with its signature, description, and class instance.
|
14
|
+
unregister(signature: str)
|
15
|
+
Unregister an existing command by its signature.
|
16
|
+
get(signature: str)
|
17
|
+
Retrieve the information of a registered command by its signature.
|
9
18
|
"""
|
10
19
|
|
11
|
-
|
20
|
+
def __init__(self):
|
12
21
|
|
13
|
-
def __new__(cls, *args, **kwargs):
|
14
22
|
"""
|
15
|
-
|
23
|
+
Initializes the command cache.
|
16
24
|
|
17
|
-
|
18
|
-
during the lifetime of the application.
|
19
|
-
|
20
|
-
Returns
|
21
|
-
-------
|
22
|
-
CacheCommands
|
23
|
-
The singleton instance of the class.
|
25
|
+
This constructor sets up an empty dictionary to store commands.
|
24
26
|
"""
|
25
|
-
|
26
|
-
cls._instance = super().__new__(cls, *args, **kwargs)
|
27
|
-
cls._instance.commands = {}
|
28
|
-
return cls._instance
|
27
|
+
self.commands = {}
|
29
28
|
|
30
|
-
def register(self, signature: str, description: str, arguments: list,
|
29
|
+
def register(self, signature: str, description: str, arguments: list, concrete: Callable[..., Any]):
|
31
30
|
"""
|
32
31
|
Register a new command with its signature, description, and class instance.
|
33
32
|
|
@@ -37,7 +36,7 @@ class CacheCommands(ICacheCommands):
|
|
37
36
|
The unique identifier (signature) for the command.
|
38
37
|
description : str
|
39
38
|
A brief description of what the command does.
|
40
|
-
|
39
|
+
concrete : class
|
41
40
|
The class or callable instance that defines the command behavior.
|
42
41
|
|
43
42
|
Raises
|
@@ -49,7 +48,7 @@ class CacheCommands(ICacheCommands):
|
|
49
48
|
raise ValueError(f"Command '{signature}' is already registered. Please ensure signatures are unique.")
|
50
49
|
|
51
50
|
self.commands[signature] = {
|
52
|
-
'
|
51
|
+
'concrete':concrete,
|
53
52
|
'arguments':arguments,
|
54
53
|
'description':description,
|
55
54
|
'signature':signature
|
@@ -1,6 +1,6 @@
|
|
1
1
|
from orionis.luminate.console.output.console import Console
|
2
2
|
from orionis.luminate.console.output.progress_bar import ProgressBar
|
3
|
-
from orionis.luminate.contracts.console.base_command_interface import IBaseCommand
|
3
|
+
from orionis.luminate.contracts.console.base.base_command_interface import IBaseCommand
|
4
4
|
|
5
5
|
class BaseCommand(IBaseCommand):
|
6
6
|
"""
|
@@ -1,59 +1,25 @@
|
|
1
1
|
import os
|
2
|
-
from threading import Lock
|
3
2
|
from orionis.luminate.tools.reflection import Reflection
|
4
|
-
from orionis.luminate.cache.console.commands import CacheCommands
|
5
|
-
from orionis.luminate.contracts.console.cli_cache_interface import ICLICache
|
6
3
|
|
7
|
-
class CLICache
|
4
|
+
class CLICache:
|
8
5
|
"""
|
9
|
-
|
6
|
+
Class responsible for managing the loading and execution of commands within the framework.
|
10
7
|
|
11
|
-
This class ensures that commands are loaded only once and are accessible for execution.
|
12
|
-
the Singleton pattern, meaning only one instance of this class will exist in the application lifecycle.
|
8
|
+
This class ensures that commands are loaded only once and are accessible for execution.
|
13
9
|
|
14
10
|
Attributes
|
15
11
|
----------
|
16
|
-
_instance : CLICache
|
17
|
-
The singleton instance of the CLICache class.
|
18
|
-
_lock : threading.Lock
|
19
|
-
A lock used to ensure thread-safety during instance creation.
|
20
|
-
_initialized : bool
|
21
|
-
A flag indicating whether the class has been initialized.
|
22
12
|
paths : list
|
23
13
|
List of directories where commands are located.
|
24
14
|
|
25
15
|
Methods
|
26
16
|
-------
|
27
|
-
__new__ :
|
28
|
-
Creates and returns the singleton instance of the CLICache class.
|
29
17
|
__init__ :
|
30
18
|
Initializes the CLICache instance, loading commands if not already initialized.
|
31
19
|
_load_commands :
|
32
20
|
Loads command modules from predefined directories and imports them dynamically.
|
33
|
-
getCommands :
|
34
|
-
Returns the instance of CacheCommands containing the command cache.
|
35
21
|
"""
|
36
22
|
|
37
|
-
_instance = None
|
38
|
-
_lock = Lock()
|
39
|
-
|
40
|
-
def __new__(cls):
|
41
|
-
"""
|
42
|
-
Ensures only one instance of the CLICache class exists (Singleton pattern).
|
43
|
-
|
44
|
-
This method is responsible for controlling the instance creation process, ensuring that no more than one
|
45
|
-
CLICache instance is created in the system, even in multi-threaded environments.
|
46
|
-
|
47
|
-
Returns
|
48
|
-
-------
|
49
|
-
CLICache
|
50
|
-
The singleton instance of the CLICache class.
|
51
|
-
"""
|
52
|
-
with cls._lock:
|
53
|
-
if cls._instance is None:
|
54
|
-
cls._instance = super(CLICache, cls).__new__(cls)
|
55
|
-
cls._instance._initialized = False
|
56
|
-
return cls._instance
|
57
23
|
|
58
24
|
def __init__(self) -> None:
|
59
25
|
"""
|
@@ -67,12 +33,8 @@ class CLICache(ICLICache):
|
|
67
33
|
paths : list
|
68
34
|
List of directories containing command files to be loaded.
|
69
35
|
"""
|
70
|
-
if self._initialized:
|
71
|
-
return
|
72
|
-
|
73
36
|
self.paths = []
|
74
37
|
self._load_commands()
|
75
|
-
self._initialized = True
|
76
38
|
|
77
39
|
def _load_commands(self):
|
78
40
|
"""
|
@@ -110,23 +72,16 @@ class CLICache(ICLICache):
|
|
110
72
|
pre_module = current_directory.replace(base_path, '').replace(os.sep, '.').lstrip('.')
|
111
73
|
for file in files:
|
112
74
|
if file.endswith('.py'):
|
113
|
-
# Construct the module name and path
|
114
|
-
module_name = file[:-3] # Remove the '.py' extension
|
115
|
-
module_path = f"{pre_module}.{module_name}".replace('venv.Lib.site-packages.', '')
|
116
75
|
|
117
|
-
#
|
118
|
-
|
76
|
+
# Remove the '.py' extension
|
77
|
+
module_name = file[:-3]
|
119
78
|
|
120
|
-
|
121
|
-
|
122
|
-
Returns the instance of the CacheCommands containing the command cache.
|
79
|
+
# Construct the full module path
|
80
|
+
module_path = f"{pre_module}.{module_name}"
|
123
81
|
|
124
|
-
|
125
|
-
|
82
|
+
# Remove the 'site-packages' prefix from the module path
|
83
|
+
if 'site-packages.' in module_path:
|
84
|
+
module_path = module_path.split('site-packages.')[1]
|
126
85
|
|
127
|
-
|
128
|
-
|
129
|
-
CacheCommands
|
130
|
-
The instance of CacheCommands that holds the cached commands.
|
131
|
-
"""
|
132
|
-
return CacheCommands()
|
86
|
+
# Use Reflection to load the module dynamically
|
87
|
+
Reflection(module=module_path)
|
@@ -1,9 +1,8 @@
|
|
1
1
|
import os
|
2
2
|
import shutil
|
3
|
-
from orionis.luminate.console.register import register
|
4
3
|
from orionis.luminate.console.base.command import BaseCommand
|
4
|
+
from orionis.luminate.console.exceptions.cli_exception import CLIOrionisRuntimeError
|
5
5
|
|
6
|
-
@register.command
|
7
6
|
class CacheClearCommand(BaseCommand):
|
8
7
|
"""
|
9
8
|
Clears Python bytecode caches (__pycache__) within the project directory.
|
@@ -48,9 +47,9 @@ class CacheClearCommand(BaseCommand):
|
|
48
47
|
shutil.rmtree(pycache_path)
|
49
48
|
|
50
49
|
# Log a success message once all caches are cleared
|
51
|
-
self.success(message='The application cache has been successfully cleared.'
|
50
|
+
self.success(message='The application cache has been successfully cleared.')
|
52
51
|
|
53
52
|
except Exception as e:
|
54
53
|
|
55
54
|
# Handle any unexpected error and display the error message
|
56
|
-
raise
|
55
|
+
raise CLIOrionisRuntimeError(f"An unexpected error occurred while clearing the cache: {e}") from e
|
@@ -1,8 +1,7 @@
|
|
1
|
-
from orionis.luminate.console.register import register
|
2
1
|
from orionis.luminate.console.base.command import BaseCommand
|
3
2
|
from orionis.luminate.cache.console.commands import CacheCommands
|
3
|
+
from orionis.luminate.console.exceptions.cli_exception import CLIOrionisRuntimeError
|
4
4
|
|
5
|
-
@register.command
|
6
5
|
class HelpCommand(BaseCommand):
|
7
6
|
"""
|
8
7
|
Command class to display the list of available commands in the Orionis application.
|
@@ -55,5 +54,5 @@ class HelpCommand(BaseCommand):
|
|
55
54
|
|
56
55
|
except Exception as e:
|
57
56
|
|
58
|
-
#
|
59
|
-
raise
|
57
|
+
# Handle any unexpected error and display the error message
|
58
|
+
raise CLIOrionisRuntimeError(f"An unexpected error occurred: {e}") from e
|
@@ -1,9 +1,8 @@
|
|
1
|
-
from orionis.luminate.console.register import register
|
2
1
|
from orionis.luminate.console.base.command import BaseCommand
|
2
|
+
from orionis.luminate.console.exceptions.cli_exception import CLIOrionisRuntimeError
|
3
3
|
from orionis.luminate.console.tasks.scheduler import Schedule
|
4
4
|
from orionis.luminate.contracts.console.task_manager_interface import ITaskManager
|
5
5
|
|
6
|
-
@register.command
|
7
6
|
class ScheduleWorkCommand(BaseCommand):
|
8
7
|
"""
|
9
8
|
Command class to handle scheduled tasks within the Orionis application.
|
@@ -46,5 +45,5 @@ class ScheduleWorkCommand(BaseCommand):
|
|
46
45
|
|
47
46
|
except Exception as e:
|
48
47
|
|
49
|
-
#
|
50
|
-
raise
|
48
|
+
# Handle any unexpected error and display the error message
|
49
|
+
raise CLIOrionisRuntimeError(f"An unexpected error occurred: {e}") from e
|
@@ -1,8 +1,7 @@
|
|
1
|
+
from orionis.luminate.console.exceptions.cli_exception import CLIOrionisRuntimeError
|
1
2
|
from orionis.luminate.facades.tests import UnitTests
|
2
|
-
from orionis.luminate.console.register import register
|
3
3
|
from orionis.luminate.console.base.command import BaseCommand
|
4
4
|
|
5
|
-
@register.command
|
6
5
|
class TestsCommand(BaseCommand):
|
7
6
|
"""
|
8
7
|
Command class to display the list of available commands in the Orionis application.
|
@@ -36,5 +35,5 @@ class TestsCommand(BaseCommand):
|
|
36
35
|
|
37
36
|
except Exception as e:
|
38
37
|
|
39
|
-
#
|
40
|
-
raise
|
38
|
+
# Handle any unexpected error and display the error message
|
39
|
+
raise CLIOrionisRuntimeError(f"An unexpected error occurred: {e}") from e
|
@@ -1,8 +1,7 @@
|
|
1
1
|
from orionis.framework import VERSION
|
2
|
-
from orionis.luminate.console.register import register
|
3
2
|
from orionis.luminate.console.base.command import BaseCommand
|
3
|
+
from orionis.luminate.console.exceptions.cli_exception import CLIOrionisRuntimeError
|
4
4
|
|
5
|
-
@register.command
|
6
5
|
class VersionCommand(BaseCommand):
|
7
6
|
"""
|
8
7
|
Command class to display the current version of the Orionis framework.
|
@@ -35,5 +34,5 @@ class VersionCommand(BaseCommand):
|
|
35
34
|
|
36
35
|
except Exception as e:
|
37
36
|
|
38
|
-
#
|
39
|
-
raise
|
37
|
+
# Handle any unexpected error and display the error message
|
38
|
+
raise CLIOrionisRuntimeError(f"An unexpected error occurred: {e}") from e
|
@@ -125,3 +125,46 @@ class CLIOrionisScheduleException(Exception):
|
|
125
125
|
A string containing the exception name and the response message.
|
126
126
|
"""
|
127
127
|
return f"[CLIOrionisScheduleException]: {self.args[0]}"
|
128
|
+
|
129
|
+
|
130
|
+
class CLIOrionisRuntimeError(RuntimeError):
|
131
|
+
"""
|
132
|
+
Custom exception raised when there is a runtime issue with Orionis processing.
|
133
|
+
|
134
|
+
Parameters
|
135
|
+
----------
|
136
|
+
message : str
|
137
|
+
The response message associated with the exception.
|
138
|
+
|
139
|
+
Attributes
|
140
|
+
----------
|
141
|
+
message : str
|
142
|
+
Stores the response message passed during initialization.
|
143
|
+
|
144
|
+
Methods
|
145
|
+
-------
|
146
|
+
__str__()
|
147
|
+
Returns a string representation of the exception, including the response message.
|
148
|
+
"""
|
149
|
+
|
150
|
+
def __init__(self, message: str):
|
151
|
+
"""
|
152
|
+
Initializes the CLIOrionisRuntimeError with the given response message.
|
153
|
+
|
154
|
+
Parameters
|
155
|
+
----------
|
156
|
+
message : str
|
157
|
+
The response message associated with the exception.
|
158
|
+
"""
|
159
|
+
super().__init__(message)
|
160
|
+
|
161
|
+
def __str__(self):
|
162
|
+
"""
|
163
|
+
Returns a string representation of the exception, including the response message.
|
164
|
+
|
165
|
+
Returns
|
166
|
+
-------
|
167
|
+
str
|
168
|
+
A string containing the exception name and the response message.
|
169
|
+
"""
|
170
|
+
return f"[CLIOrionisRuntimeError]: {self.args[0]}"
|
@@ -3,7 +3,7 @@ import sys
|
|
3
3
|
import getpass
|
4
4
|
import datetime
|
5
5
|
from orionis.luminate.console.output.styles import ANSIColors
|
6
|
-
from orionis.luminate.contracts.console.console_interface import IConsole
|
6
|
+
from orionis.luminate.contracts.console.output.console_interface import IConsole
|
7
7
|
|
8
8
|
class Console(IConsole):
|
9
9
|
"""
|
@@ -1,6 +1,6 @@
|
|
1
1
|
from datetime import datetime
|
2
2
|
from orionis.luminate.console.output.styles import ANSIColors
|
3
|
-
from orionis.luminate.contracts.console.executor_interface import IExecutor
|
3
|
+
from orionis.luminate.contracts.console.output.executor_interface import IExecutor
|
4
4
|
|
5
5
|
class Executor(IExecutor):
|
6
6
|
"""
|
@@ -1,7 +1,7 @@
|
|
1
1
|
from orionis.luminate.installer.setup import Setup
|
2
2
|
from orionis.luminate.installer.output import Output
|
3
3
|
from orionis.luminate.installer.upgrade import Upgrade
|
4
|
-
from orionis.luminate.contracts.console.management_interface import IManagement
|
4
|
+
from orionis.luminate.contracts.console.scripts.management_interface import IManagement
|
5
5
|
|
6
6
|
class Management(IManagement):
|
7
7
|
"""
|
@@ -8,7 +8,7 @@ from apscheduler.triggers.cron import CronTrigger
|
|
8
8
|
from orionis.luminate.console.command import Command
|
9
9
|
from apscheduler.triggers.interval import IntervalTrigger
|
10
10
|
from apscheduler.schedulers.background import BackgroundScheduler
|
11
|
-
from orionis.luminate.contracts.console.schedule_interface import ISchedule
|
11
|
+
from orionis.luminate.contracts.console.tasks.schedule_interface import ISchedule
|
12
12
|
from orionis.luminate.console.exceptions.cli_exception import CLIOrionisScheduleException
|
13
13
|
|
14
14
|
class Schedule(ISchedule):
|