orionis 0.26.0__py3-none-any.whl → 0.28.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.
- orionis/framework.py +1 -1
- orionis/luminate/bootstrap/commands/bootstrapper.py +4 -2
- orionis/luminate/console/cache.py +87 -0
- {orionis-0.26.0.dist-info → orionis-0.28.0.dist-info}/METADATA +1 -1
- {orionis-0.26.0.dist-info → orionis-0.28.0.dist-info}/RECORD +9 -8
- {orionis-0.26.0.dist-info → orionis-0.28.0.dist-info}/LICENCE +0 -0
- {orionis-0.26.0.dist-info → orionis-0.28.0.dist-info}/WHEEL +0 -0
- {orionis-0.26.0.dist-info → orionis-0.28.0.dist-info}/entry_points.txt +0 -0
- {orionis-0.26.0.dist-info → orionis-0.28.0.dist-info}/top_level.txt +0 -0
orionis/framework.py
CHANGED
@@ -65,7 +65,7 @@ class Bootstrapper(IBootstrapper):
|
|
65
65
|
# Define the command directories to search
|
66
66
|
command_dirs = [
|
67
67
|
base_path / "app" / "console" / "commands",
|
68
|
-
pathlib.Path(__file__).resolve().parent.parent / "console" / "commands"
|
68
|
+
pathlib.Path(__file__).resolve().parent.parent.parent / "console" / "commands"
|
69
69
|
]
|
70
70
|
|
71
71
|
# Iterate over each command directory
|
@@ -84,10 +84,12 @@ class Bootstrapper(IBootstrapper):
|
|
84
84
|
|
85
85
|
# Convert file path to a Python module import path
|
86
86
|
module_path = ".".join(file_path.relative_to(base_path).with_suffix("").parts)
|
87
|
+
if 'site-packages.' in module_path:
|
88
|
+
module_path = module_path.split('site-packages.')[1]
|
87
89
|
|
88
90
|
try:
|
89
91
|
# Dynamically import the module
|
90
|
-
module = importlib.import_module(module_path)
|
92
|
+
module = importlib.import_module(module_path.strip())
|
91
93
|
|
92
94
|
# Find classes that inherit from `BaseCommand`
|
93
95
|
for name, obj in inspect.getmembers(module, inspect.isclass):
|
@@ -0,0 +1,87 @@
|
|
1
|
+
import os
|
2
|
+
from orionis.luminate.tools.reflection import Reflection
|
3
|
+
|
4
|
+
class CLICache:
|
5
|
+
"""
|
6
|
+
Class responsible for managing the loading and execution of commands within the framework.
|
7
|
+
|
8
|
+
This class ensures that commands are loaded only once and are accessible for execution.
|
9
|
+
|
10
|
+
Attributes
|
11
|
+
----------
|
12
|
+
paths : list
|
13
|
+
List of directories where commands are located.
|
14
|
+
|
15
|
+
Methods
|
16
|
+
-------
|
17
|
+
__init__ :
|
18
|
+
Initializes the CLICache instance, loading commands if not already initialized.
|
19
|
+
_load_commands :
|
20
|
+
Loads command modules from predefined directories and imports them dynamically.
|
21
|
+
"""
|
22
|
+
|
23
|
+
|
24
|
+
def __init__(self) -> None:
|
25
|
+
"""
|
26
|
+
Initializes the CLICache instance by loading commands if not already initialized.
|
27
|
+
|
28
|
+
This method will load command modules only once, ensuring that the commands are available for execution
|
29
|
+
across the application. It should not be called directly multiple times.
|
30
|
+
|
31
|
+
Attributes
|
32
|
+
----------
|
33
|
+
paths : list
|
34
|
+
List of directories containing command files to be loaded.
|
35
|
+
"""
|
36
|
+
self.paths = []
|
37
|
+
self._load_commands()
|
38
|
+
|
39
|
+
def _load_commands(self):
|
40
|
+
"""
|
41
|
+
Dynamically loads command modules from predefined directories.
|
42
|
+
|
43
|
+
This method traverses the specified directories, locates Python files, and imports them as modules.
|
44
|
+
It ensures that only the main directories are iterated over, avoiding subdirectories.
|
45
|
+
|
46
|
+
Directories searched:
|
47
|
+
---------------------
|
48
|
+
- app/console/commands (relative to the base path)
|
49
|
+
- Current directory of the module (this file's directory)
|
50
|
+
"""
|
51
|
+
paths = []
|
52
|
+
|
53
|
+
# Define the base path of the application
|
54
|
+
base_path = os.getcwd()
|
55
|
+
|
56
|
+
# Define command directories to be searched
|
57
|
+
command_dirs = [
|
58
|
+
os.path.join(base_path, 'app', 'console', 'commands'),
|
59
|
+
os.path.join(os.path.dirname(__file__), 'commands')
|
60
|
+
]
|
61
|
+
|
62
|
+
# Add valid directories to paths list
|
63
|
+
for command_dir in command_dirs:
|
64
|
+
if os.path.isdir(command_dir):
|
65
|
+
paths.append(command_dir)
|
66
|
+
|
67
|
+
# Iterate over each valid directory
|
68
|
+
for path in paths:
|
69
|
+
for current_directory, _, files in os.walk(path):
|
70
|
+
# Ensure to only iterate through the top-level directories
|
71
|
+
if current_directory == path:
|
72
|
+
pre_module = current_directory.replace(base_path, '').replace(os.sep, '.').lstrip('.')
|
73
|
+
for file in files:
|
74
|
+
if file.endswith('.py'):
|
75
|
+
|
76
|
+
# Remove the '.py' extension
|
77
|
+
module_name = file[:-3]
|
78
|
+
|
79
|
+
# Construct the full module path
|
80
|
+
module_path = f"{pre_module}.{module_name}"
|
81
|
+
|
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]
|
85
|
+
|
86
|
+
# Use Reflection to load the module dynamically
|
87
|
+
Reflection(module=module_path)
|
@@ -1,11 +1,11 @@
|
|
1
1
|
orionis/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
2
|
orionis/cli_manager.py,sha256=9wNVJxB0HyqUbNesUvkwlsqTyUbZwK6R46iVLE5WVBQ,1715
|
3
|
-
orionis/framework.py,sha256=
|
3
|
+
orionis/framework.py,sha256=WHstU04TC0Eu1ERcwcS3aezpOkpNEpwej2zUM870jns,1386
|
4
4
|
orionis/luminate/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
5
5
|
orionis/luminate/app.py,sha256=fh5p0w5VBb0zJ6qKNHOCs2vxIix6AborENZFW_GCvrw,152
|
6
6
|
orionis/luminate/bootstrap/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
7
7
|
orionis/luminate/bootstrap/cli_exception.py,sha256=wDKfEW295c7-bavr7YUHK2CLYcTSZgjT9ZRSBne6GOE,1356
|
8
|
-
orionis/luminate/bootstrap/commands/bootstrapper.py,sha256=
|
8
|
+
orionis/luminate/bootstrap/commands/bootstrapper.py,sha256=TuXuQUzeaiDL8sJyZNdqnFl2h2MfxcnSU045IeIKVQE,4016
|
9
9
|
orionis/luminate/bootstrap/commands/register.py,sha256=YonMvfe1TQBVPLxqM7o7_mYaXPKoXvZNRSsW365uVtM,3734
|
10
10
|
orionis/luminate/bootstrap/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
11
11
|
orionis/luminate/bootstrap/config/bootstrapper.py,sha256=PtmZJIH8sHVOdGIogLlqTuPD0XZvR2DgOnPZDgSng9o,2971
|
@@ -30,6 +30,7 @@ orionis/luminate/config/dataclass/mail.py,sha256=3iYXG72bXiVns4sEPZ_A3-cGcFjGEGD
|
|
30
30
|
orionis/luminate/config/dataclass/queue.py,sha256=DYjP5zD09ISsIX117wtOfjiG_iQrcrPoQVeeftmuO3c,1739
|
31
31
|
orionis/luminate/config/dataclass/session.py,sha256=7mOC_DfGIBDqAClSiewHoTA9Kht_zdHApvALcZc7cfY,1861
|
32
32
|
orionis/luminate/console/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
33
|
+
orionis/luminate/console/cache.py,sha256=K6imeTG0sWjBHjIt3Zs1O6j9xEN2KUtcqymfUo7OuJA,3316
|
33
34
|
orionis/luminate/console/command.py,sha256=bSFFniZds1L_GKPcotfQZlt8m-GKByvfZR1deTMLPb8,1381
|
34
35
|
orionis/luminate/console/command_filter.py,sha256=kSyIn2WMKsHdXfOS4EfUVO_sn0LSSU75YXeoIGgI3uk,1352
|
35
36
|
orionis/luminate/console/kernel.py,sha256=6WeCLB42dN_vHmvJxX_XdUWPj2tD23oSXJh5DzdivDo,994
|
@@ -142,9 +143,9 @@ tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
142
143
|
tests/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
143
144
|
tests/tools/class_example.py,sha256=dIPD997Y15n6WmKhWoOFSwEldRm9MdOHTZZ49eF1p3c,1056
|
144
145
|
tests/tools/test_reflection.py,sha256=dNN5p_xAosyEf0ddAElmmmTfhcTtBd4zBNl7qzgnsc0,5242
|
145
|
-
orionis-0.
|
146
|
-
orionis-0.
|
147
|
-
orionis-0.
|
148
|
-
orionis-0.
|
149
|
-
orionis-0.
|
150
|
-
orionis-0.
|
146
|
+
orionis-0.28.0.dist-info/LICENCE,sha256=-_4cF2EBKuYVS_SQpy1uapq0oJPUU1vl_RUWSy2jJTo,1111
|
147
|
+
orionis-0.28.0.dist-info/METADATA,sha256=jepvvgXCSy0qQh6y-8GLj4k4dAWirOX7Xq8SxrmFBjQ,2978
|
148
|
+
orionis-0.28.0.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
149
|
+
orionis-0.28.0.dist-info/entry_points.txt,sha256=eef1_CVewfokKjrGBynXa06KabSJYo7LlDKKIKvs1cM,53
|
150
|
+
orionis-0.28.0.dist-info/top_level.txt,sha256=2bdoHgyGZhOtLAXS6Om8OCTmL24dUMC_L1quMe_ETbk,14
|
151
|
+
orionis-0.28.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|