orionis 0.329.0__py3-none-any.whl → 0.331.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.
@@ -51,9 +51,8 @@ class _ImplementsAbstractMethods:
51
51
 
52
52
  not_implemented = []
53
53
  for method in abstract_methods:
54
- # Considera métodos renombrados en clases concretas (_Abstract.m → _Concrete.m)
55
54
  expected_method = str(method).replace(f"_{abstract_name}", f"_{target_name}")
56
- if not hasattr(target, expected_method):
55
+ if not expected_method in target_class.__dict__:
57
56
  not_implemented.append(method)
58
57
 
59
58
  if not_implemented:
@@ -22,6 +22,11 @@ class _IsValidAlias:
22
22
  OrionisContainerTypeError
23
23
  If the value is not of type str or contains invalid characters.
24
24
  """
25
+ if value is None or value == "" or str(value).isspace():
26
+ raise OrionisContainerTypeError(
27
+ "Alias cannot be None, empty, or whitespace only."
28
+ )
29
+
25
30
  if not isinstance(value, str):
26
31
  raise OrionisContainerTypeError(
27
32
  f"Expected a string type for alias, but got {type(value).__name__} instead."
@@ -0,0 +1,145 @@
1
+ from typing import Type, List
2
+ from orionis.container.container import Container
3
+ from orionis.container.contracts.service_provider import IServiceProvider
4
+
5
+ class App(Container):
6
+ """
7
+ Application container that manages service providers.
8
+
9
+ This class extends the base Container functionality by adding
10
+ a service provider registration and boot system.
11
+
12
+ Attributes
13
+ ----------
14
+ __providers : List[IServiceProvider]
15
+ List of registered service providers
16
+ __booted : bool
17
+ Flag indicating whether providers have been booted
18
+ """
19
+ @property
20
+ def isBooted(self) -> bool:
21
+ """
22
+ Check if the application providers have been booted.
23
+
24
+ Returns
25
+ -------
26
+ bool
27
+ True if providers are booted, False otherwise
28
+ """
29
+ return self.__booted
30
+
31
+ def __init__(self) -> None:
32
+ """
33
+ Initialize a new App instance.
34
+
35
+ Sets up the container and initializes the provider tracking system.
36
+ """
37
+ super().__init__()
38
+ self.__providers: List[IServiceProvider] = []
39
+ self.__booted: bool = False
40
+
41
+ def __registerProvider(
42
+ self,
43
+ provider_cls: Type[IServiceProvider]
44
+ ) -> IServiceProvider:
45
+ """
46
+ Register a service provider with the application.
47
+
48
+ Parameters
49
+ ----------
50
+ provider_cls : Type[IServiceProvider]
51
+ The service provider class to register
52
+
53
+ Returns
54
+ -------
55
+ IServiceProvider
56
+ The instantiated provider
57
+
58
+ Raises
59
+ ------
60
+ TypeError
61
+ If the provided class doesn't implement IServiceProvider
62
+ """
63
+ if not issubclass(provider_cls, IServiceProvider):
64
+ raise TypeError(f"Provider must implement IServiceProvider interface: {provider_cls.__name__}")
65
+
66
+ provider = provider_cls(self)
67
+ provider.register()
68
+ self.__providers.append(provider)
69
+ return provider
70
+
71
+ def __bootProviders(self) -> None:
72
+ """
73
+ Boot all registered service providers.
74
+
75
+ This method is idempotent - calling it multiple times will only
76
+ boot the providers once.
77
+
78
+ Raises
79
+ ------
80
+ TypeError
81
+ If any registered provider is not an instance of IServiceProvider
82
+ """
83
+ if self.__booted:
84
+ return
85
+
86
+ for provider in self.__providers:
87
+ if not isinstance(provider, IServiceProvider):
88
+ raise TypeError(f"Expected IServiceProvider, got {type(provider).__name__}")
89
+ provider.boot()
90
+
91
+ self.__booted = True
92
+
93
+ def __loadFrameworkProviders(self) -> None:
94
+ """
95
+ Load internal framework service providers.
96
+
97
+ This method should register core services required by the framework
98
+ before user-defined providers are loaded.
99
+ """
100
+ core_providers = [
101
+ #...
102
+ ]
103
+
104
+ for provider_cls in core_providers:
105
+ self.__registerProvider(provider_cls)
106
+
107
+
108
+ def load(self, providers: List[Type[IServiceProvider]]) -> None:
109
+ """
110
+ Load and boot a list of service providers.
111
+
112
+ This method registers each provider and then boots all providers.
113
+
114
+ Parameters
115
+ ----------
116
+ providers : List[Type[IServiceProvider]]
117
+ List of service provider classes to register and boot
118
+
119
+ Returns
120
+ -------
121
+ None
122
+ """
123
+
124
+ # Load internal framework providers first
125
+ self.__loadFrameworkProviders()
126
+
127
+ # Register and boot each provided service provider
128
+ for provider_cls in providers:
129
+ self.__registerProvider(provider_cls)
130
+
131
+ # Boot all registered providers
132
+ self.__bootProviders()
133
+
134
+ def getProviders(self) -> List[IServiceProvider]:
135
+ """
136
+ Get the list of registered providers.
137
+
138
+ Returns
139
+ -------
140
+ List[IServiceProvider]
141
+ The list of registered service providers
142
+ """
143
+
144
+ # Return a copy to prevent external modification
145
+ return self.__providers.copy()
@@ -0,0 +1,19 @@
1
+ class OrionisValueError(ValueError):
2
+
3
+ def __init__(self, msg: str):
4
+ """
5
+ Parameters
6
+ ----------
7
+ msg : str
8
+ Descriptive error message explaining the cause of the exception.
9
+ """
10
+ super().__init__(msg)
11
+
12
+ def __str__(self) -> str:
13
+ """
14
+ Returns
15
+ -------
16
+ str
17
+ Formatted string describing the exception.
18
+ """
19
+ return str(self.args[0])
@@ -5,7 +5,7 @@
5
5
  NAME = "orionis"
6
6
 
7
7
  # Current version of the framework
8
- VERSION = "0.329.0"
8
+ VERSION = "0.331.0"
9
9
 
10
10
  # Full name of the author or maintainer of the project
11
11
  AUTHOR = "Raul Mauricio Uñate Castro"
@@ -69,10 +69,14 @@ class ReflectionConcrete(IReflectionConcrete):
69
69
  if not isinstance(concrete, type):
70
70
  raise ReflectionTypeError(f"Expected a class type, got instance of '{type(concrete).__name__}'.")
71
71
 
72
- # Optionally, check for ABCMeta to catch interfaces
72
+ # Check for ABC inheritance to catch interfaces
73
73
  if abc.ABC in concrete.__bases__:
74
74
  raise ReflectionValueError(f"Class '{concrete.__name__}' is an interface and cannot be used.")
75
75
 
76
+ # Check if the class has any abstract methods
77
+ if inspect.isabstract(concrete):
78
+ raise ReflectionValueError(f"Class '{concrete.__name__}' is an abstract class and cannot be used.")
79
+
76
80
  return True
77
81
 
78
82
  def __init__(self, concrete: Type) -> None:
@@ -1,6 +1,5 @@
1
1
  import re
2
2
  from os import walk
3
- from dataclasses import fields
4
3
  from orionis.foundation.config.testing.entities.testing import Testing as Configuration
5
4
  from orionis.test.exceptions.test_config_exception import OrionisTestConfigException
6
5
  from orionis.test.suite.test_unit import UnitTest
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: orionis
3
- Version: 0.329.0
3
+ Version: 0.331.0
4
4
  Summary: Orionis Framework – Elegant, Fast, and Powerful.
5
5
  Home-page: https://github.com/orionis-framework/framework
6
6
  Author: Raul Mauricio Uñate Castro
@@ -1,6 +1,4 @@
1
1
  orionis/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- orionis/_application.py,sha256=dMjJ0nFcIIOBGb5zr-tHNzcgTOZ1vJ7iMdFAlqSQph0,9405
3
- orionis/application.py,sha256=Off5uOUj-IYvvR8DcqLUoBW_98opWa7MQrtqTr0SZGc,292
4
2
  orionis/unittesting.py,sha256=_NU3_sm3R6bUUH_Y-KSPgNVBajUGCtKo_CGgjB1YD5k,2094
5
3
  orionis/_contracts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
4
  orionis/_contracts/application.py,sha256=ltuDA1mN5P73l89jJto_A96ePJWE02OZ_B2NOPpfeWs,1061
@@ -17,8 +15,6 @@ orionis/_contracts/console/output/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeR
17
15
  orionis/_contracts/console/output/console.py,sha256=jISa955ZVOUuJUdm7UCo_r_Ft1j9vG7Tg5j5aDw3Bvc,10552
18
16
  orionis/_contracts/console/output/executor.py,sha256=MGMTTPSwF8dgCjHD3A4CKtYDaCcD-KU28dorC61Q04k,1411
19
17
  orionis/_contracts/console/output/progress_bar.py,sha256=sOkQzQsliFemqZHMyzs4fWhNJfXDTk5KH3aExReetSE,1760
20
- orionis/_contracts/container/container.py,sha256=rLOS1eYir1e1e06OVNTGESbR24rFOIU1CVni_8AbHgs,8802
21
- orionis/_contracts/container/container_integrity.py,sha256=xigWcyxLUaFoWXEI75ucJ50Ypw2NtOiRp_CgOY3Qk20,4408
22
18
  orionis/_contracts/facades/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
23
19
  orionis/_contracts/facades/facade.py,sha256=FqCnNBP6vKw94rMDr-fRoAyIJp83ZxC1iLsiubrH3ps,1507
24
20
  orionis/_contracts/facades/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -78,8 +74,6 @@ orionis/_services/commands/reactor_commands_service.py,sha256=cyARBmLVox8v-YHjo7
78
74
  orionis/_services/commands/scheduler_service.py,sha256=oUaSbX-CRnTlDWRqRkwQCFY0SGgxM9dYGXpZkEkEPuc,22466
79
75
  orionis/_services/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
80
76
  orionis/_services/config/config_service.py,sha256=iS5ftGd7VWCpOt9M5_rNNLHsCZaDcI-F8R2r3CCTM8g,2106
81
- orionis/_services/log/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
82
- orionis/_services/log/log_service.py,sha256=jnKIeTxy4p16SfKYYLpJ1p1CqAqpF1BIp7IBSOdSuJY,8295
83
77
  orionis/console/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
84
78
  orionis/console/command_filter.py,sha256=bn0fcWfQg13DrQBaV4NopNxdP-6up0G54Qmhg7r_BKA,1211
85
79
  orionis/console/kernel.py,sha256=M4Zc9x-1hrQP7Dq6Ons5UnGoq73XV1Fwa9cwY7zqWbw,883
@@ -121,16 +115,17 @@ orionis/container/facades/facade.py,sha256=vu71_uqXnSpCFyeswPgKIhTPmIBLEK3bsy5sk
121
115
  orionis/container/providers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
122
116
  orionis/container/providers/service_provider.py,sha256=9SHDzeuJbktRhrLq0zo2fZhRR4xOaYGOb2wKl7iBR4k,1923
123
117
  orionis/container/validators/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
124
- orionis/container/validators/implements.py,sha256=iSoDxxTalQKhyKjvsojFlkROhBFvAjvJxRvPJlmGrSg,2843
118
+ orionis/container/validators/implements.py,sha256=ErTHa0aJc0QlT1pJtqY4_uNZ8a04J3jN2fnxjWHAXf8,2755
125
119
  orionis/container/validators/is_abstract_class.py,sha256=Q-Lqyrrps6oj2XWI0KFRp-hDZf4_sgbZlEbfBXj5XT4,1169
126
120
  orionis/container/validators/is_callable.py,sha256=8Bi5AflNmXhpgtk1ieirE3xgCKzq3mcgyqokCU3GHN8,843
127
121
  orionis/container/validators/is_concrete_class.py,sha256=BMhJ7vCQ2ccBA3qrRJPlsYDTSqBpqLZFfrdEGO5mlr4,1215
128
122
  orionis/container/validators/is_instance.py,sha256=vUwWIMeG1zLMsGX9GyoOU-LZtCgqBDZ9hUNDj_KyuYo,999
129
123
  orionis/container/validators/is_not_subclass.py,sha256=-iZw5ZCYnQtlU-xPO-o7lUj5DxPkN0G67-bLbLVhwtw,1167
130
124
  orionis/container/validators/is_subclass.py,sha256=O2aF0KLg5ZnDutKQ1xDvet34kentftlqgEkRNvumCoM,1135
131
- orionis/container/validators/is_valid_alias.py,sha256=avm6uz-huVi_kRov4BksSToslIHQfz-MLynjkzhdSRM,1246
125
+ orionis/container/validators/is_valid_alias.py,sha256=DuQRfBeCeter6ppPSE4ORBnzRtHLWHQgeFCXz3MsmZA,1443
132
126
  orionis/container/validators/lifetime.py,sha256=78o7BHBCRReG8vnF0gW2RUf6m6wwMhr7w4VA6F2B46A,1865
133
127
  orionis/foundation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
128
+ orionis/foundation/application.py,sha256=LfWJUIrj7K3B_5mFoTMyAbRgkDFBpq5Y0amE1ejbjYY,4225
134
129
  orionis/foundation/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
135
130
  orionis/foundation/config/startup.py,sha256=JKAH2ZRhlAZgkD2w11LR1-TVktfjSH9cHo3PsZXOLrg,8275
136
131
  orionis/foundation/config/app/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -220,8 +215,9 @@ orionis/foundation/contracts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NM
220
215
  orionis/foundation/contracts/config.py,sha256=Rpz6U6t8OXHO9JJKSTnCimytXE-tfCB-1ithP2nG8MQ,628
221
216
  orionis/foundation/exceptions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
222
217
  orionis/foundation/exceptions/integrity.py,sha256=mc4pL1UMoYRHEmphnpW2oGk5URhu7DJRREyzHaV-cs8,472
218
+ orionis/foundation/exceptions/value_error.py,sha256=hQhXybXEnaa59ba7JxG65jceHt3mnql9MyekF-TChpM,465
223
219
  orionis/metadata/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
224
- orionis/metadata/framework.py,sha256=6IMHwxMeJT3k5KRdt1d8bLgypdJAGfgmqwLUz5qzmGw,4960
220
+ orionis/metadata/framework.py,sha256=xyHnBHp7isvGf3jdwdrxIS1mecl7PdPJzRrnTIesL7M,4960
225
221
  orionis/metadata/package.py,sha256=tqLfBRo-w1j_GN4xvzUNFyweWYFS-qhSgAEc-AmCH1M,5452
226
222
  orionis/patterns/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
227
223
  orionis/patterns/singleton/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -250,7 +246,7 @@ orionis/services/introspection/abstract/reflection_abstract.py,sha256=SPK2X11VvG
250
246
  orionis/services/introspection/callables/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
251
247
  orionis/services/introspection/callables/reflection_callable.py,sha256=0B2B6ZV-ql_aZk97W4Q12MVvi0gwErjekgWaMBxjfV0,6147
252
248
  orionis/services/introspection/concretes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
253
- orionis/services/introspection/concretes/reflection_concrete.py,sha256=SdE2IWEgt30eO9-f_VRNdIZ_OWWidauQzQZQVrXjcXY,51310
249
+ orionis/services/introspection/concretes/reflection_concrete.py,sha256=3qSGwk0GGCxjSvyIJIzqyRWF1Odq-YIAkNzR_16QumY,51518
254
250
  orionis/services/introspection/contracts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
255
251
  orionis/services/introspection/contracts/reflect_dependencies.py,sha256=5fdImZarC1ixoFM-1JSBx28RvYbY3GGZhDGjar7cvHc,1771
256
252
  orionis/services/introspection/contracts/reflection_abstract.py,sha256=-ugpFcAkGTlk0Md5ft8NrvupnlfVji8QZjGYqWBxqeY,22370
@@ -272,6 +268,8 @@ orionis/services/introspection/instances/__init__.py,sha256=47DEQpj8HBSa-_TImW-5
272
268
  orionis/services/introspection/instances/reflection_instance.py,sha256=DrPrzdm7FbnUj6h6970hJOyFfit-OpWskZ4FnxJMz6k,54053
273
269
  orionis/services/introspection/modules/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
274
270
  orionis/services/introspection/modules/reflection_module.py,sha256=1QB_853_ct5ehDNSxNQaaJDCeY9eXciXJwRYkNHgYd4,15632
271
+ orionis/services/log/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
272
+ orionis/services/log/log_service.py,sha256=jnKIeTxy4p16SfKYYLpJ1p1CqAqpF1BIp7IBSOdSuJY,8295
275
273
  orionis/services/parsers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
276
274
  orionis/services/parsers/serializer.py,sha256=mxWlzqgkoO7EeIr3MZ5gdzQUuSfjqWDMau85PEqlBQY,531
277
275
  orionis/services/parsers/contracts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -303,7 +301,7 @@ orionis/support/wrapper/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG
303
301
  orionis/support/wrapper/dicts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
304
302
  orionis/support/wrapper/dicts/dot_dict.py,sha256=VdAUH-DO6y86pl_9N6v-vU9mdLraWh5HjVzI5iC1dMs,5295
305
303
  orionis/test/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
306
- orionis/test/test_suite.py,sha256=qeQQ_OvgNAmJDuAHRTZntbbCujGl2NtR08bMXZOv-EQ,6001
304
+ orionis/test/test_suite.py,sha256=2lfaE3gPT5IG18p1GPtAZpEWCaPprcYLWJmdHux01sc,5969
307
305
  orionis/test/cases/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
308
306
  orionis/test/cases/test_async.py,sha256=YwycimGfUx9-kd_FFO8BZXyVayYwOBOzxbu3WZU_l5s,1927
309
307
  orionis/test/cases/test_case.py,sha256=GVN3cxYuE47uPOEqFUiMreLdXjTyqzHjjxfyEM5_D4w,1446
@@ -333,7 +331,7 @@ orionis/test/suite/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuF
333
331
  orionis/test/suite/test_unit.py,sha256=MWgW8dRCRyT1XZ5LsbXQ7-KVPReasoXwzEEL1EWWfE4,52190
334
332
  orionis/test/view/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
335
333
  orionis/test/view/render.py,sha256=jXZkbITBknbUwm_mD8bcTiwLDvsFkrO9qrf0ZgPwqxc,4903
336
- orionis-0.329.0.dist-info/licenses/LICENCE,sha256=-_4cF2EBKuYVS_SQpy1uapq0oJPUU1vl_RUWSy2jJTo,1111
334
+ orionis-0.331.0.dist-info/licenses/LICENCE,sha256=-_4cF2EBKuYVS_SQpy1uapq0oJPUU1vl_RUWSy2jJTo,1111
337
335
  tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
338
336
  tests/example/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
339
337
  tests/example/test_example.py,sha256=kvWgiW3ADEZf718dGsMPtDh_rmOSx1ypEInKm7_6ZPQ,601
@@ -434,8 +432,8 @@ tests/support/wrapper/test_services_wrapper_docdict.py,sha256=yeVwl-VcwkWSQYyxZu
434
432
  tests/testing/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
435
433
  tests/testing/test_testing_result.py,sha256=MrGK3ZimedL0b5Ydu69Dg8Iul017AzLTm7VPxpXlpfU,4315
436
434
  tests/testing/test_testing_unit.py,sha256=DjLBtvVn8B1KlVJNNkstBT8_csA1yeaMqnGrbanN_J4,7438
437
- orionis-0.329.0.dist-info/METADATA,sha256=XUCnPpXe0vygTWc_kwwC_IUsiWOVP4iXBDHdjlz1e5Y,4772
438
- orionis-0.329.0.dist-info/WHEEL,sha256=Nw36Djuh_5VDukK0H78QzOX-_FQEo6V37m3nkm96gtU,91
439
- orionis-0.329.0.dist-info/top_level.txt,sha256=2bdoHgyGZhOtLAXS6Om8OCTmL24dUMC_L1quMe_ETbk,14
440
- orionis-0.329.0.dist-info/zip-safe,sha256=frcCV1k9oG9oKj3dpUqdJg1PxRT2RSN_XKdLCPjaYaY,2
441
- orionis-0.329.0.dist-info/RECORD,,
435
+ orionis-0.331.0.dist-info/METADATA,sha256=VI8annoXwnRCTc0VP9072w4kDC4TwwhdXFPk0UhnnKM,4772
436
+ orionis-0.331.0.dist-info/WHEEL,sha256=Nw36Djuh_5VDukK0H78QzOX-_FQEo6V37m3nkm96gtU,91
437
+ orionis-0.331.0.dist-info/top_level.txt,sha256=2bdoHgyGZhOtLAXS6Om8OCTmL24dUMC_L1quMe_ETbk,14
438
+ orionis-0.331.0.dist-info/zip-safe,sha256=frcCV1k9oG9oKj3dpUqdJg1PxRT2RSN_XKdLCPjaYaY,2
439
+ orionis-0.331.0.dist-info/RECORD,,
orionis/_application.py DELETED
@@ -1,232 +0,0 @@
1
- from typing import Dict, List, Type
2
- from orionis._contracts.application import IApplication
3
- from orionis._contracts.container.container import IContainer
4
- from orionis._contracts.foundation.bootstraper import IBootstrapper
5
- from orionis._contracts.providers.service_provider import IServiceProvider
6
- from orionis._container.container import Container
7
- # from orionis._foundation.config.config_bootstrapper import ConfigBootstrapper
8
- from orionis._foundation.console.command_bootstrapper import CommandsBootstrapper
9
- from orionis._foundation.environment.environment_bootstrapper import EnvironmentBootstrapper
10
- from orionis._foundation.exceptions.exception_bootstrapper import BootstrapRuntimeError
11
- from orionis._foundation.providers.service_providers_bootstrapper import ServiceProvidersBootstrapper
12
- # from orionis.support.patterns.singleton import SingletonMeta
13
-
14
- class Application:
15
- """
16
- Main application class that follows the Singleton pattern.
17
-
18
- This class manages service providers, environment variables, configurations,
19
- and commands for the application lifecycle.
20
-
21
- Attributes
22
- ----------
23
- _booted : bool
24
- Indicates whether the application has been booted.
25
- _custom_providers : List[Type[IServiceProvider]]
26
- Custom service providers defined by the developer.
27
- _service_providers : List[Type[IServiceProvider]]
28
- Core application service providers.
29
- _config : Dict
30
- Configuration settings of the application.
31
- _commands : Dict
32
- Registered console commands.
33
- _env : Dict
34
- Environment variables.
35
- _container : IContainer
36
- The service container instance.
37
- """
38
-
39
- _booted: bool = False
40
-
41
- def __init__(self):
42
- """
43
- Initializes the application by setting up the service container and preparing
44
- lists for custom service providers, service providers, configuration, commands,
45
- and environment variables.
46
- Attributes:
47
- _custom_providers (List[Type[IServiceProvider]]): List to store custom service providers.
48
- _service_providers (List[Type[IServiceProvider]]): List to store service providers.
49
- _config (Dict): Dictionary to store configuration settings.
50
- _commands (Dict): Dictionary to store commands.
51
- _env (Dict): Dictionary to store environment variables.
52
- _container (IContainer): The service container instance.
53
- Registers the application instance in the service container.
54
- """
55
- self._custom_providers: List[Type[IServiceProvider]] = []
56
- self._service_providers: List[Type[IServiceProvider]] = []
57
- self._config: Dict = {}
58
- self._commands: Dict = {}
59
- self._env: Dict = {}
60
- self._container: IContainer = Container()
61
-
62
- # Register the application instance in the service container
63
- self._container.instance(IApplication, self)
64
-
65
- @classmethod
66
- def boot(cls) -> None:
67
- """
68
- Marks the application as booted by setting the _booted class attribute to True.
69
- """
70
- cls._booted = True
71
-
72
- @classmethod
73
- def isRunning(cls) -> bool:
74
- """
75
- Checks if the application has been booted.
76
-
77
- Returns
78
- -------
79
- bool
80
- True if the application has been booted, otherwise False.
81
- """
82
- return cls._booted
83
-
84
- @classmethod
85
- def getInstance(cls) -> "Application":
86
- """
87
- Retrieves the singleton instance of the Application.
88
-
89
- Returns
90
- -------
91
- Application
92
- The current application instance.
93
-
94
- Raises
95
- ------
96
- RuntimeError
97
- If the application instance does not exist.
98
- """
99
- pass
100
- # if cls not in SingletonMeta._instances:
101
- # raise RuntimeError("Application instance does not exist. Please create an instance first.")
102
- # return SingletonMeta._instances[cls]
103
-
104
- @classmethod
105
- def destroy(cls) -> None:
106
- """
107
- Destroys the singleton instance of the application if it exists.
108
-
109
- This method checks if the class has an instance in the SingletonMeta
110
- instances dictionary and deletes it if found.
111
-
112
- Returns
113
- -------
114
- None
115
- """
116
- pass
117
- # if cls in SingletonMeta._instances:
118
- # del SingletonMeta._instances[cls]
119
-
120
- def withProviders(self, providers: List[Type[IServiceProvider]] = None) -> "Application":
121
- """
122
- This method allows you to specify a list of custom service providers
123
- that will be used by the application. If no providers are specified,
124
- an empty list will be used by default.
125
- A list of service provider classes to be used by the application.
126
- If not provided, defaults to an empty list.
127
- Returns
128
- -------
129
- Application
130
- The instance of the Application with the custom service providers set.
131
- """
132
- self._custom_providers = providers or []
133
- return self
134
-
135
- def container(self) -> IContainer:
136
- """
137
- Returns the service container instance.
138
-
139
- Returns
140
- -------
141
- IContainer
142
- The service container.
143
- """
144
- return self._container
145
-
146
- def create(self) -> None:
147
- """
148
- Initializes and boots the application.
149
- This method performs the following steps:
150
- 1. Boots the application by calling the `_bootstrapping` method.
151
- 2. Loads commands and service providers by calling the `_loadCommands` method.
152
- 3. Boots service providers asynchronously using `AsyncExecutor.run` on the `_bootServiceProviders` method.
153
- 4. Changes the application status to booted by calling `Application.boot`.
154
- Returns
155
- -------
156
- None
157
- """
158
- self._bootstrapping()
159
- self._loadCommands()
160
- # AsyncExecutor.run(self._bootServiceProviders())
161
- Application.boot()
162
-
163
- async def _bootServiceProviders(self) -> None:
164
- """
165
- This method iterates over all registered service providers, registers them,
166
- and calls their `boot` method if it exists and is callable.
167
- Raises
168
- ------
169
- RuntimeError
170
- If an error occurs while booting a service provider, a RuntimeError is raised
171
- with a message indicating which service provider failed and the original exception.
172
- """
173
- for service in self._service_providers:
174
- provider: IServiceProvider = service(app=self._container)
175
- provider.register()
176
-
177
- if hasattr(provider, 'boot') and callable(provider.boot):
178
- try:
179
- await provider.boot()
180
- except Exception as e:
181
- raise RuntimeError(f"Error booting service provider {service.__name__}: {e}") from e
182
-
183
- def _bootstrapping(self) -> None:
184
- """
185
- Initializes and loads essential components for the application.
186
- This method sets up the environment variables, configurations, commands,
187
- and service providers by utilizing their respective bootstrappers. It
188
- iterates through a list of bootstrappers, updating or extending the
189
- corresponding properties with the data provided by each bootstrapper.
190
- Raises
191
- ------
192
- BootstrapRuntimeError
193
- If an error occurs during the bootstrapping process, an exception is
194
- raised with details about the specific bootstrapper that failed.
195
- """
196
- bootstrappers = [
197
- {'property': self._env, 'instance': EnvironmentBootstrapper()},
198
- # {'property': self._config, 'instance': ConfigBootstrapper()},
199
- {'property': self._commands, 'instance': CommandsBootstrapper()},
200
- {'property': self._service_providers, 'instance': ServiceProvidersBootstrapper(self._custom_providers)},
201
- ]
202
-
203
- for bootstrapper in bootstrappers:
204
- try:
205
- property_ref: Dict = bootstrapper["property"]
206
- bootstrapper_instance: IBootstrapper = bootstrapper["instance"]
207
- if isinstance(property_ref, dict):
208
- property_ref.update(bootstrapper_instance.get())
209
- elif isinstance(property_ref, list):
210
- property_ref.extend(bootstrapper_instance.get())
211
- else:
212
- property_ref = bootstrapper_instance.get()
213
- except Exception as e:
214
- raise BootstrapRuntimeError(f"Error bootstrapping {type(bootstrapper_instance).__name__}: {str(e)}") from e
215
-
216
- def _loadCommands(self) -> None:
217
- """
218
- This method iterates over the `_commands` dictionary and registers each command
219
- in the service container as a transient service. The command's signature and
220
- concrete implementation are retrieved from the dictionary and passed to the
221
- container's `transient` method.
222
-
223
- Parameters
224
- ----------
225
- None
226
-
227
- Returns
228
- -------
229
- None
230
- """
231
- for command, data_command in self._commands.items():
232
- self._container.transient(data_command.get('signature'), data_command.get('concrete'))
@@ -1,346 +0,0 @@
1
- from abc import ABC, abstractmethod
2
-
3
- class IContainer(ABC):
4
-
5
- @abstractmethod
6
- def bind(self, abstract, concrete, lifetime):
7
- """
8
- Binds an abstract type to a concrete implementation with a specified lifetime.
9
-
10
- Parameters
11
- ----------
12
- abstract : Callable[..., Any]
13
- The abstract base type or alias to be bound.
14
- concrete : Callable[..., Any]
15
- The concrete implementation to associate with the abstract type.
16
- lifetime : str
17
- The lifecycle of the binding. Must be one of 'transient', 'scoped', or 'singleton'.
18
-
19
- Raises
20
- ------
21
- OrionisContainerValueError
22
- If an invalid lifetime is provided or the concrete implementation is None.
23
-
24
- Examples
25
- --------
26
- >>> container.bind(MyService, MyServiceImplementation, "singleton")
27
- """
28
- pass
29
-
30
- @abstractmethod
31
- def transient(self, abstract, concrete):
32
- """
33
- Registers a service with a transient lifetime.
34
-
35
- Parameters
36
- ----------
37
- abstract : Callable[..., Any]
38
- The abstract base type or alias to be bound.
39
- concrete : Callable[..., Any]
40
- The concrete implementation to associate with the abstract type.
41
-
42
- Examples
43
- --------
44
- >>> container.transient(MyService, MyServiceImplementation)
45
- """
46
- pass
47
-
48
- @abstractmethod
49
- def scoped(self, abstract, concrete):
50
- """
51
- Registers a service with a scoped lifetime.
52
-
53
- Parameters
54
- ----------
55
- abstract : Callable[..., Any]
56
- The abstract base type or alias to be bound.
57
- concrete : Callable[..., Any]
58
- The concrete implementation to associate with the abstract type.
59
-
60
- Examples
61
- --------
62
- >>> container.scoped(MyService, MyServiceImplementation)
63
- """
64
- pass
65
-
66
- @abstractmethod
67
- def singleton(self, abstract, concrete):
68
- """
69
- Registers a service with a singleton lifetime.
70
-
71
- Parameters
72
- ----------
73
- abstract : Callable[..., Any]
74
- The abstract base type or alias to be bound.
75
- concrete : Callable[..., Any]
76
- The concrete implementation to associate with the abstract type.
77
-
78
- Examples
79
- --------
80
- >>> container.singleton(MyService, MyServiceImplementation)
81
- """
82
- pass
83
-
84
- @abstractmethod
85
- def instance(self, abstract, instance):
86
- """
87
- Registers an already instantiated object in the container.
88
-
89
- Parameters
90
- ----------
91
- abstract : Callable[..., Any]
92
- The abstract base type or alias to be bound.
93
- instance : Any
94
- The instance to be stored.
95
-
96
- Raises
97
- ------
98
- OrionisContainerValueError
99
- If the instance is None.
100
-
101
- Examples
102
- --------
103
- >>> container.instance(MyService, my_service_instance)
104
- """
105
- pass
106
-
107
- @abstractmethod
108
- def bound(self, abstract_or_alias):
109
- """
110
- Checks if a service or alias is bound in the container.
111
-
112
- Parameters
113
- ----------
114
- abstract_or_alias : Callable[..., Any]
115
- The abstract type or alias to check.
116
-
117
- Returns
118
- -------
119
- bool
120
- True if the service is bound, False otherwise.
121
-
122
- Examples
123
- --------
124
- >>> container.bound(MyService)
125
- True
126
- """
127
- pass
128
-
129
- @abstractmethod
130
- def has(self, abstract_or_alias):
131
- """
132
- Alias for `bound()` method.
133
-
134
- Parameters
135
- ----------
136
- abstract_or_alias : Callable[..., Any]
137
- The abstract type or alias to check.
138
-
139
- Returns
140
- -------
141
- bool
142
- True if the service is bound, False otherwise.
143
-
144
- Examples
145
- --------
146
- >>> container.has(MyService)
147
- True
148
- """
149
- pass
150
-
151
- @abstractmethod
152
- def alias(self, alias, abstract):
153
- """
154
- Creates an alias for an existing abstract binding.
155
-
156
- Parameters
157
- ----------
158
- alias : Callable[..., Any]
159
- The alias name.
160
- abstract : Callable[..., Any]
161
- The existing abstract type to alias.
162
-
163
- Raises
164
- ------
165
- OrionisContainerValueError
166
- If the abstract type is not registered or the alias is already in use.
167
-
168
- Examples
169
- --------
170
- >>> container.alias("DatabaseService", MyDatabaseService)
171
- """
172
- pass
173
-
174
- @abstractmethod
175
- def isAlias(self, name):
176
- """
177
- Checks if a given name is an alias.
178
-
179
- Parameters
180
- ----------
181
- name : str
182
- The name to check.
183
-
184
- Returns
185
- -------
186
- bool
187
- True if the name is an alias, False otherwise.
188
-
189
- Raises
190
- ------
191
- OrionisContainerTypeError
192
- If the name is not a string.
193
-
194
- Examples
195
- --------
196
- >>> container.isAlias("DatabaseService")
197
- True
198
- """
199
- pass
200
-
201
- @abstractmethod
202
- def getBindings(self):
203
- """
204
- Retrieves all registered service bindings.
205
-
206
- Returns
207
- -------
208
- dict
209
- A dictionary containing all instances, transient, scoped, singleton, and alias services.
210
-
211
- Examples
212
- --------
213
- >>> container.getBindings()
214
- """
215
- pass
216
-
217
- @abstractmethod
218
- def getAlias(self, name):
219
- """
220
- Retrieves the abstract type associated with an alias.
221
-
222
- Parameters
223
- ----------
224
- name : str
225
- The alias name.
226
-
227
- Returns
228
- -------
229
- Callable[..., Any]
230
- The abstract type associated with the alias.
231
-
232
- Raises
233
- ------
234
- OrionisContainerValueError
235
- If the alias is not registered.
236
-
237
- Examples
238
- --------
239
- >>> container.getAlias("DatabaseService")
240
- <class 'MyDatabaseService'>
241
- """
242
- pass
243
-
244
- @abstractmethod
245
- def forgetScopedInstances(self):
246
- """
247
- Clears all scoped instances.
248
-
249
- Examples
250
- --------
251
- >>> container.forgetScopedInstances()
252
- """
253
- pass
254
-
255
- @abstractmethod
256
- def newRequest(self):
257
- """
258
- Resets scoped instances to handle a new request.
259
-
260
- Examples
261
- --------
262
- >>> container.newRequest()
263
- """
264
- pass
265
-
266
- @abstractmethod
267
- async def make(self, abstract_or_alias):
268
- """
269
- Resolves and instantiates a service from the container.
270
-
271
- Parameters
272
- ----------
273
- abstract_or_alias : Callable[..., Any]
274
- The abstract type or alias to resolve.
275
-
276
- Returns
277
- -------
278
- Any
279
- The instantiated service.
280
-
281
- Raises
282
- ------
283
- OrionisContainerException
284
- If the service is not found.
285
-
286
- Examples
287
- --------
288
- >>> service = await container.make(MyService)
289
- """
290
- pass
291
-
292
- @abstractmethod
293
- def _resolve(self, concrete, resolving=None):
294
- """
295
- Resolves dependencies recursively and instantiates a class.
296
-
297
- Parameters
298
- ----------
299
- concrete : Callable[..., Any]
300
- The concrete implementation to instantiate.
301
- resolving : Optional[Deque[Type]], optional
302
- A queue to track resolving dependencies and prevent circular dependencies.
303
-
304
- Returns
305
- -------
306
- Any
307
- The instantiated object.
308
-
309
- Raises
310
- ------
311
- OrionisContainerException
312
- If circular dependencies are detected or instantiation fails.
313
-
314
- Examples
315
- --------
316
- >>> instance = container._resolve(MyClass)
317
- """
318
- pass
319
-
320
- @abstractmethod
321
- def _resolve_dependency(self, dep_type, resolving=None):
322
- """
323
- Resolves a dependency by instantiating or retrieving it from the container.
324
-
325
- Parameters
326
- ----------
327
- dep_type : Any
328
- The dependency type to resolve.
329
- resolving : Optional[Deque[Type]], optional
330
- A queue to track resolving dependencies.
331
-
332
- Returns
333
- -------
334
- Any
335
- The resolved dependency.
336
-
337
- Raises
338
- ------
339
- OrionisContainerException
340
- If the dependency cannot be resolved.
341
-
342
- Examples
343
- --------
344
- >>> dependency = container._resolve_dependency(MyDependency)
345
- """
346
- pass
@@ -1,168 +0,0 @@
1
- from abc import ABC, abstractmethod
2
- from typing import Any, Callable, Type
3
-
4
- class IContainerIntegrity(ABC):
5
-
6
- @abstractmethod
7
- def ensureImplementation(abstract: Type, concrete: Type) -> None:
8
- """
9
- Verify at runtime if `concrete` implements all methods of `abstract`.
10
-
11
- :param abstract: Abstract class or interface.
12
- :param concrete: Concrete class that should implement the abstract class.
13
- :raises TypeError: If `concrete` does not implement all methods of `abstract`.
14
- """
15
- pass
16
-
17
- @abstractmethod
18
- def ensureIsAbstract(abstract: Callable[..., Any]) -> None:
19
- """
20
- Ensure that the given abstract is a valid abstract class.
21
-
22
- :param abstract: Class to check
23
- :raises OrionisContainerValueError: If the class is not a valid abstract interface
24
- """
25
- pass
26
-
27
- @abstractmethod
28
- def ensureIsCallable(concrete: Callable[..., Any]) -> None:
29
- """
30
- Ensure that the given implementation is callable or instantiable.
31
-
32
- Parameters
33
- ----------
34
- concrete : Callable[..., Any]
35
- The implementation to check.
36
-
37
- Raises
38
- ------
39
- OrionisContainerTypeError
40
- If the implementation is not callable.
41
- """
42
- pass
43
-
44
- @abstractmethod
45
- def ensureIsInstance(instance: Any) -> None:
46
- """
47
- Ensure that the given instance is a valid object.
48
-
49
- Parameters
50
- ----------
51
- instance : Any
52
- The instance to check.
53
-
54
- Raises
55
- ------
56
- OrionisContainerValueError
57
- If the instance is not a valid object.
58
- """
59
- pass
60
-
61
- @abstractmethod
62
- def ensureNotMain(concrete: Callable[..., Any]) -> str:
63
- """
64
- Ensure that a class is not defined in the main script.
65
-
66
- Parameters
67
- ----------
68
- concrete : Callable[..., Any]
69
- The class or function to check.
70
-
71
- Returns
72
- -------
73
- str
74
- The fully qualified name of the class.
75
-
76
- Raises
77
- ------
78
- OrionisContainerValueError
79
- If the class is defined in the main module.
80
- """
81
- pass
82
-
83
- @abstractmethod
84
- def ensureIsAlias(name: str) -> bool:
85
- """
86
- Ensure that the given alias name is a valid string, with no special characters or spaces,
87
- and it is not a primitive type.
88
-
89
- Parameters
90
- ----------
91
- name : str
92
- The alias name to check.
93
-
94
- Raises
95
- ------
96
- OrionisContainerValueError
97
- If the alias is invalid.
98
- """
99
- pass
100
-
101
- @abstractmethod
102
- def isAlias(name: str) -> bool:
103
- """
104
- Check if the given alias name is a valid string, with no special characters or spaces,
105
- and it is not a primitive type.
106
-
107
- Parameters
108
- ----------
109
- name : str
110
- The alias name to check.
111
-
112
- Returns
113
- -------
114
- bool
115
- True if the alias is valid, False otherwise.
116
- """
117
- pass
118
-
119
- @abstractmethod
120
- def isCallable(concrete: Callable[..., Any]) -> bool:
121
- """
122
- Check if the given implementation is callable or instantiable.
123
-
124
- Parameters
125
- ----------
126
- concrete : Callable[..., Any]
127
- The implementation to check.
128
-
129
- Returns
130
- -------
131
- bool
132
- True if the implementation is callable, False otherwise.
133
- """
134
- pass
135
-
136
- @abstractmethod
137
- def isInstance(instance: Any) -> bool:
138
- """
139
- Check if the given instance is a valid object.
140
-
141
- Parameters
142
- ----------
143
- instance : Any
144
- The instance to check.
145
-
146
- Returns
147
- -------
148
- bool
149
- True if the instance is valid, False otherwise.
150
- """
151
- pass
152
-
153
- @abstractmethod
154
- def isAbstract(abstract: Callable[..., Any]) -> bool:
155
- """
156
- Check if the given abstract is a valid abstract class.
157
-
158
- Parameters
159
- ----------
160
- abstract : Callable[..., Any]
161
- The class to check.
162
-
163
- Returns
164
- -------
165
- bool
166
- True if the class is a valid abstract interface, False otherwise.
167
- """
168
- pass
orionis/application.py DELETED
@@ -1,10 +0,0 @@
1
- from orionis.foundation.config.startup import Configuration
2
- from orionis.patterns.singleton.meta_class import Singleton
3
-
4
- class Orionis(metaclass=Singleton):
5
-
6
- def __init__(
7
- self,
8
- config: Configuration = None
9
- ):
10
- self.__config = config or Configuration()
File without changes
File without changes