orionis 0.15.0__py3-none-any.whl → 0.17.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/config/bootstrapper.py +6 -5
- orionis/luminate/bootstrap/config/register.py +5 -15
- orionis/luminate/contracts/bootstrap/bootstrapper_interface.py +2 -2
- {orionis-0.15.0.dist-info → orionis-0.17.0.dist-info}/METADATA +1 -1
- {orionis-0.15.0.dist-info → orionis-0.17.0.dist-info}/RECORD +10 -10
- {orionis-0.15.0.dist-info → orionis-0.17.0.dist-info}/LICENCE +0 -0
- {orionis-0.15.0.dist-info → orionis-0.17.0.dist-info}/WHEEL +0 -0
- {orionis-0.15.0.dist-info → orionis-0.17.0.dist-info}/entry_points.txt +0 -0
- {orionis-0.15.0.dist-info → orionis-0.17.0.dist-info}/top_level.txt +0 -0
orionis/framework.py
CHANGED
@@ -23,10 +23,10 @@ class Bootstrapper(IBootstrapper):
|
|
23
23
|
__init__(register: Register) -> None
|
24
24
|
Initializes the `Bootstrapper` with a `Register` instance.
|
25
25
|
|
26
|
-
|
26
|
+
_findClasses(file_path: str) -> List[str]
|
27
27
|
Parses a Python file to extract and return all defined class names.
|
28
28
|
|
29
|
-
|
29
|
+
_autoload(directory: str) -> None
|
30
30
|
Scans a directory for Python files, imports them, finds configuration classes,
|
31
31
|
and registers them using the `Register` instance.
|
32
32
|
"""
|
@@ -41,8 +41,9 @@ class Bootstrapper(IBootstrapper):
|
|
41
41
|
An instance of the `Register` class used to register configuration classes.
|
42
42
|
"""
|
43
43
|
self.register = register
|
44
|
+
self._autoload()
|
44
45
|
|
45
|
-
def
|
46
|
+
def _definitions(self, file_path: str):
|
46
47
|
"""
|
47
48
|
Parses a Python file to extract and return all defined class names.
|
48
49
|
|
@@ -70,7 +71,7 @@ class Bootstrapper(IBootstrapper):
|
|
70
71
|
|
71
72
|
return classes
|
72
73
|
|
73
|
-
def
|
74
|
+
def _autoload(self, directory: str = 'config') -> None:
|
74
75
|
"""
|
75
76
|
Automatically registers configuration classes found in a given directory.
|
76
77
|
|
@@ -97,7 +98,7 @@ class Bootstrapper(IBootstrapper):
|
|
97
98
|
if file.endswith(".py") and file != "__init__.py":
|
98
99
|
file_path = os.path.join(root, file)
|
99
100
|
# Get the class names defined in the file
|
100
|
-
classes = self.
|
101
|
+
classes = self._definitions(file_path)
|
101
102
|
|
102
103
|
if classes:
|
103
104
|
for class_name in classes:
|
@@ -1,5 +1,4 @@
|
|
1
1
|
from orionis.luminate.bootstrap.config.parser import Parser
|
2
|
-
from orionis.luminate.config.sections import SECTIONS
|
3
2
|
from orionis.luminate.container.container import Container
|
4
3
|
from orionis.luminate.contracts.bootstrap.register_interface import IRegister
|
5
4
|
from orionis.luminate.contracts.config.config_interface import IConfig
|
@@ -12,25 +11,20 @@ class Register(IRegister):
|
|
12
11
|
This class ensures that only valid configuration classes are registered
|
13
12
|
while enforcing structure and type safety.
|
14
13
|
|
15
|
-
Attributes
|
16
|
-
----------
|
17
|
-
cache_config : CacheConfig
|
18
|
-
An instance of `CacheConfig` used to store registered configurations.
|
19
|
-
|
20
14
|
Methods
|
21
15
|
-------
|
22
16
|
config(config_class: type) -> type
|
23
17
|
Registers a configuration class and ensures it meets the necessary criteria.
|
24
18
|
"""
|
25
19
|
|
26
|
-
def __init__(self, container
|
20
|
+
def __init__(self, container = Container()) -> None:
|
27
21
|
"""
|
28
22
|
Initializes the Register instance with a cache configuration.
|
29
23
|
|
30
24
|
Parameters
|
31
25
|
----------
|
32
|
-
|
33
|
-
The
|
26
|
+
container : Container
|
27
|
+
The container instance to be used for configuration registration.
|
34
28
|
"""
|
35
29
|
self.container = container
|
36
30
|
|
@@ -60,21 +54,17 @@ class Register(IRegister):
|
|
60
54
|
If `config_class` does not have a `config` attribute or is already registered.
|
61
55
|
"""
|
62
56
|
|
57
|
+
# Validate input type
|
63
58
|
if not isinstance(config_class, type):
|
64
59
|
raise TypeError(f"Expected a class, but got {type(config_class).__name__}.")
|
65
60
|
|
61
|
+
# Validate config attribute
|
66
62
|
if not hasattr(config_class, 'config'):
|
67
63
|
raise ValueError(f"Class {config_class.__name__} must have a 'config' attribute.")
|
68
64
|
|
69
65
|
# Extract module name
|
70
66
|
section = Reflection(config_class).getFileName(remove_extension=True)
|
71
67
|
|
72
|
-
# Validate section
|
73
|
-
if section not in SECTIONS:
|
74
|
-
raise ValueError(
|
75
|
-
f"Invalid configuration section '{section}'. Allowed sections: {SECTIONS}"
|
76
|
-
)
|
77
|
-
|
78
68
|
# Validate inheritance
|
79
69
|
if not issubclass(config_class, IConfig):
|
80
70
|
raise TypeError(f"Class {config_class.__name__} must inherit from 'IConfig'.")
|
@@ -21,7 +21,7 @@ class IBootstrapper(ABC):
|
|
21
21
|
"""
|
22
22
|
|
23
23
|
@abstractmethod
|
24
|
-
def
|
24
|
+
def _definitions(self, file_path: str):
|
25
25
|
"""
|
26
26
|
Parses a Python file to extract and return all defined class names.
|
27
27
|
|
@@ -42,7 +42,7 @@ class IBootstrapper(ABC):
|
|
42
42
|
pass
|
43
43
|
|
44
44
|
@abstractmethod
|
45
|
-
def
|
45
|
+
def _autoload(self, directory: str) -> None:
|
46
46
|
"""
|
47
47
|
Automatically registers configuration classes found in a given directory.
|
48
48
|
|
@@ -1,13 +1,13 @@
|
|
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=C5GnVUX8PefCRdP7ek6lXjfDyrIzpRkmbxbckLFRSVI,1386
|
4
4
|
orionis/luminate/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
5
5
|
orionis/luminate/app.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
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=lAtLiylGlpBYrMYazx0KC6M_6aXsoiLxomv1lbZjEKY,4220
|
9
9
|
orionis/luminate/bootstrap/config/parser.py,sha256=Ez8HsMdSMMZ_5a842ZCFjkSLqbIvUrKnXGxeVP92eRo,1943
|
10
|
-
orionis/luminate/bootstrap/config/register.py,sha256=
|
10
|
+
orionis/luminate/bootstrap/config/register.py,sha256=iwVAjGz4oiTex03ZVKz-td-8ydxWO51YXxuxEkylQU0,2768
|
11
11
|
orionis/luminate/cache/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
12
12
|
orionis/luminate/cache/app/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
13
13
|
orionis/luminate/cache/app/config.py,sha256=4V-E-jkBurc0imqCZedsEO3KmKz9hfK-XQjuBVbmHRg,2777
|
@@ -58,7 +58,7 @@ orionis/luminate/container/container.py,sha256=rgUQ1fJslFR-0nxzpubAGEMXAiZZlVd_T
|
|
58
58
|
orionis/luminate/container/exception.py,sha256=Tf7KdfbEtr0YldhZ1WrKfkBlI5W_KvZO61xWAGFdF0A,1156
|
59
59
|
orionis/luminate/container/types.py,sha256=PbPNOJ8e4SGzCmu-zOmCQmDzt1b9I73v3fw_xzLq9RU,932
|
60
60
|
orionis/luminate/contracts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
61
|
-
orionis/luminate/contracts/bootstrap/bootstrapper_interface.py,sha256=
|
61
|
+
orionis/luminate/contracts/bootstrap/bootstrapper_interface.py,sha256=De6nKQcZpN1dWsubXWUO229ZH4IbCoUaGtP5HOUw2Ps,2251
|
62
62
|
orionis/luminate/contracts/bootstrap/parser_interface.py,sha256=7DLnp7yB7edayVkSm-piTi8JSf0QKaYYI82qDZudgM0,1641
|
63
63
|
orionis/luminate/contracts/bootstrap/register_interface.py,sha256=600rNNM9SaYlVuDTSirfNpwEVHODdu_ZMj_dOx_vJkU,1506
|
64
64
|
orionis/luminate/contracts/cache/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -141,9 +141,9 @@ tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
141
141
|
tests/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
142
142
|
tests/tools/class_example.py,sha256=dIPD997Y15n6WmKhWoOFSwEldRm9MdOHTZZ49eF1p3c,1056
|
143
143
|
tests/tools/test_reflection.py,sha256=dNN5p_xAosyEf0ddAElmmmTfhcTtBd4zBNl7qzgnsc0,5242
|
144
|
-
orionis-0.
|
145
|
-
orionis-0.
|
146
|
-
orionis-0.
|
147
|
-
orionis-0.
|
148
|
-
orionis-0.
|
149
|
-
orionis-0.
|
144
|
+
orionis-0.17.0.dist-info/LICENCE,sha256=-_4cF2EBKuYVS_SQpy1uapq0oJPUU1vl_RUWSy2jJTo,1111
|
145
|
+
orionis-0.17.0.dist-info/METADATA,sha256=E2IsLR_nHrlwDjwjqARD2fF8BfQJVqmyfn4cCv22a-8,2978
|
146
|
+
orionis-0.17.0.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
147
|
+
orionis-0.17.0.dist-info/entry_points.txt,sha256=eef1_CVewfokKjrGBynXa06KabSJYo7LlDKKIKvs1cM,53
|
148
|
+
orionis-0.17.0.dist-info/top_level.txt,sha256=2bdoHgyGZhOtLAXS6Om8OCTmL24dUMC_L1quMe_ETbk,14
|
149
|
+
orionis-0.17.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|