orionis 0.24.0__py3-none-any.whl → 0.25.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/app.py +6 -0
- orionis/luminate/bootstrap/config/bootstrapper.py +19 -52
- orionis/luminate/contracts/bootstrap/config/bootstrapper_interface.py +0 -24
- {orionis-0.24.0.dist-info → orionis-0.25.0.dist-info}/METADATA +1 -1
- {orionis-0.24.0.dist-info → orionis-0.25.0.dist-info}/RECORD +10 -10
- {orionis-0.24.0.dist-info → orionis-0.25.0.dist-info}/LICENCE +0 -0
- {orionis-0.24.0.dist-info → orionis-0.25.0.dist-info}/WHEEL +0 -0
- {orionis-0.24.0.dist-info → orionis-0.25.0.dist-info}/entry_points.txt +0 -0
- {orionis-0.24.0.dist-info → orionis-0.25.0.dist-info}/top_level.txt +0 -0
orionis/framework.py
CHANGED
orionis/luminate/app.py
CHANGED
@@ -1,6 +1,5 @@
|
|
1
|
-
import ast
|
2
1
|
import importlib
|
3
|
-
import
|
2
|
+
import pathlib
|
4
3
|
from orionis.luminate.bootstrap.config.register import Register
|
5
4
|
from orionis.luminate.contracts.bootstrap.config.bootstrapper_interface import IBootstrapper
|
6
5
|
|
@@ -23,9 +22,6 @@ class Bootstrapper(IBootstrapper):
|
|
23
22
|
__init__(register: Register) -> None
|
24
23
|
Initializes the `Bootstrapper` with a `Register` instance.
|
25
24
|
|
26
|
-
_findClasses(file_path: str) -> List[str]
|
27
|
-
Parses a Python file to extract and return all defined class names.
|
28
|
-
|
29
25
|
_autoload(directory: str) -> None
|
30
26
|
Scans a directory for Python files, imports them, finds configuration classes,
|
31
27
|
and registers them using the `Register` instance.
|
@@ -43,34 +39,6 @@ class Bootstrapper(IBootstrapper):
|
|
43
39
|
self.register = register
|
44
40
|
self._autoload()
|
45
41
|
|
46
|
-
def _definitions(self, file_path: str):
|
47
|
-
"""
|
48
|
-
Parses a Python file to extract and return all defined class names.
|
49
|
-
|
50
|
-
This method opens the file at the given path, parses it using the Abstract
|
51
|
-
Syntax Tree (AST) module to extract class definitions, and returns a
|
52
|
-
list of class names found within the file.
|
53
|
-
|
54
|
-
Parameters
|
55
|
-
----------
|
56
|
-
file_path : str
|
57
|
-
The path to the Python file to parse.
|
58
|
-
|
59
|
-
Returns
|
60
|
-
-------
|
61
|
-
List[str]
|
62
|
-
A list of class names defined in the provided Python file.
|
63
|
-
"""
|
64
|
-
classes = []
|
65
|
-
with open(file_path, "r", encoding="utf-8") as file:
|
66
|
-
tree = ast.parse(file.read())
|
67
|
-
|
68
|
-
for node in ast.walk(tree):
|
69
|
-
if isinstance(node, ast.ClassDef):
|
70
|
-
classes.append(node.name)
|
71
|
-
|
72
|
-
return classes
|
73
|
-
|
74
42
|
def _autoload(self, directory: str = 'config') -> None:
|
75
43
|
"""
|
76
44
|
Automatically registers configuration classes found in a given directory.
|
@@ -90,22 +58,21 @@ class Bootstrapper(IBootstrapper):
|
|
90
58
|
FileNotFoundError
|
91
59
|
If the provided directory does not exist.
|
92
60
|
"""
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
self.register.config(class_obj)
|
61
|
+
base_path = pathlib.Path(directory).resolve()
|
62
|
+
|
63
|
+
if not base_path.exists():
|
64
|
+
raise FileNotFoundError(f"Directory {directory} does not exist.")
|
65
|
+
|
66
|
+
for file_path in base_path.rglob("*.py"):
|
67
|
+
if file_path.name == "__init__.py":
|
68
|
+
continue
|
69
|
+
|
70
|
+
module_path = ".".join(file_path.relative_to(base_path).with_suffix("").parts)
|
71
|
+
|
72
|
+
try:
|
73
|
+
module = importlib.import_module(f"{directory}.{module_path}")
|
74
|
+
if hasattr(module, "Config"):
|
75
|
+
self.register.config(getattr(module, "Config"))
|
76
|
+
except Exception as e:
|
77
|
+
raise RuntimeError(f"Error loading module {module_path}") from e
|
78
|
+
|
@@ -12,35 +12,11 @@ class IBootstrapper(ABC):
|
|
12
12
|
|
13
13
|
Methods
|
14
14
|
-------
|
15
|
-
findClasses(file_path: str) -> List[str]
|
16
|
-
Parses a Python file to extract and return all defined class names.
|
17
|
-
|
18
15
|
autoload(directory: str) -> None
|
19
16
|
Scans a directory for Python files, imports them, finds configuration classes,
|
20
17
|
and registers them using the `Register` instance.
|
21
18
|
"""
|
22
19
|
|
23
|
-
@abstractmethod
|
24
|
-
def _definitions(self, file_path: str):
|
25
|
-
"""
|
26
|
-
Parses a Python file to extract and return all defined class names.
|
27
|
-
|
28
|
-
This method opens the file at the given path, parses it using the Abstract
|
29
|
-
Syntax Tree (AST) module to extract class definitions, and returns a
|
30
|
-
list of class names found within the file.
|
31
|
-
|
32
|
-
Parameters
|
33
|
-
----------
|
34
|
-
file_path : str
|
35
|
-
The path to the Python file to parse.
|
36
|
-
|
37
|
-
Returns
|
38
|
-
-------
|
39
|
-
List[str]
|
40
|
-
A list of class names defined in the provided Python file.
|
41
|
-
"""
|
42
|
-
pass
|
43
|
-
|
44
20
|
@abstractmethod
|
45
21
|
def _autoload(self, directory: str) -> None:
|
46
22
|
"""
|
@@ -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=JL7FniIVyW5QSVrlB6akv6ab_R3Dg9VMrjitULOWw1U,1386
|
4
4
|
orionis/luminate/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
5
|
-
orionis/luminate/app.py,sha256=
|
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/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
8
|
-
orionis/luminate/bootstrap/config/bootstrapper.py,sha256=
|
8
|
+
orionis/luminate/bootstrap/config/bootstrapper.py,sha256=LKLBAKkawuJq7r0dGvhuox0PxicEuLVA0tvlDjf9lL8,2886
|
9
9
|
orionis/luminate/bootstrap/config/parser.py,sha256=Ay8dh3aax9xhVgeLSHT71ubtZJiKAJAP85dLFF7djyA,1950
|
10
10
|
orionis/luminate/bootstrap/config/register.py,sha256=uX0XGEWdo3iJou5B96vxvhZEjliTGC1HBaT8w9enMmk,2760
|
11
11
|
orionis/luminate/cache/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -57,7 +57,7 @@ orionis/luminate/container/container.py,sha256=O4AKaRQK2XfN0es70lIxUGkP0mxxemSsH
|
|
57
57
|
orionis/luminate/container/exception.py,sha256=ap1SqYEjQEEHXJJTNmL7V1jrmRjgT5_7geZ95MYkhMA,1691
|
58
58
|
orionis/luminate/container/types.py,sha256=PbPNOJ8e4SGzCmu-zOmCQmDzt1b9I73v3fw_xzLq9RU,932
|
59
59
|
orionis/luminate/contracts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
60
|
-
orionis/luminate/contracts/bootstrap/config/bootstrapper_interface.py,sha256=
|
60
|
+
orionis/luminate/contracts/bootstrap/config/bootstrapper_interface.py,sha256=NQgPgm_vlZna1nPvOaEWWeJC1uzUvoGM8fjVHVE8EtY,1480
|
61
61
|
orionis/luminate/contracts/bootstrap/config/parser_interface.py,sha256=7DLnp7yB7edayVkSm-piTi8JSf0QKaYYI82qDZudgM0,1641
|
62
62
|
orionis/luminate/contracts/bootstrap/config/register_interface.py,sha256=7kMW04ptvQ51PnprtCIR-iLHljVSGiH58GN493igeuw,1506
|
63
63
|
orionis/luminate/contracts/cache/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -140,9 +140,9 @@ tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
140
140
|
tests/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
141
141
|
tests/tools/class_example.py,sha256=dIPD997Y15n6WmKhWoOFSwEldRm9MdOHTZZ49eF1p3c,1056
|
142
142
|
tests/tools/test_reflection.py,sha256=dNN5p_xAosyEf0ddAElmmmTfhcTtBd4zBNl7qzgnsc0,5242
|
143
|
-
orionis-0.
|
144
|
-
orionis-0.
|
145
|
-
orionis-0.
|
146
|
-
orionis-0.
|
147
|
-
orionis-0.
|
148
|
-
orionis-0.
|
143
|
+
orionis-0.25.0.dist-info/LICENCE,sha256=-_4cF2EBKuYVS_SQpy1uapq0oJPUU1vl_RUWSy2jJTo,1111
|
144
|
+
orionis-0.25.0.dist-info/METADATA,sha256=s7HOpnk0ZRCx-o1hYhXR3FMsACDTJIWTev4Wm6A12cM,2978
|
145
|
+
orionis-0.25.0.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
146
|
+
orionis-0.25.0.dist-info/entry_points.txt,sha256=eef1_CVewfokKjrGBynXa06KabSJYo7LlDKKIKvs1cM,53
|
147
|
+
orionis-0.25.0.dist-info/top_level.txt,sha256=2bdoHgyGZhOtLAXS6Om8OCTmL24dUMC_L1quMe_ETbk,14
|
148
|
+
orionis-0.25.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|