orionis 0.389.0__py3-none-any.whl → 0.390.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.
@@ -6,18 +6,18 @@ from orionis.foundation.contracts.application import IApplication
6
6
 
7
7
  class Application(Container, IApplication):
8
8
  """
9
- Application container that manages service providers.
9
+ Application container that manages service providers and application lifecycle.
10
10
 
11
- This class extends the base Container functionality by adding
12
- a service provider registration and boot system.
11
+ This class extends Container to provide application-level functionality including
12
+ service provider management, kernel loading, and application bootstrapping.
13
+ It implements a fluent interface pattern allowing method chaining.
13
14
 
14
15
  Attributes
15
16
  ----------
16
- __providers : List[IServiceProvider]
17
- List of registered service providers
18
- __booted : bool
19
- Flag indicating whether providers have been booted
17
+ isBooted : bool
18
+ Read-only property indicating if the application has been booted
20
19
  """
20
+
21
21
  @property
22
22
  def isBooted(
23
23
  self
@@ -32,82 +32,45 @@ class Application(Container, IApplication):
32
32
  """
33
33
  return self.__booted
34
34
 
35
- @property
36
- def path(
37
- self,
38
- name: str = None
39
- ) -> Paths:
40
-
41
- if name is None:
42
- return self.__paths
43
-
44
- if hasattr(self.__paths, name):
45
- return getattr(self.__paths, name)
46
-
47
- raise AttributeError(f"Path '{name}' not found in application paths")
48
-
49
35
  def __init__(
50
36
  self
51
37
  ) -> None:
52
38
  """
53
- Initialize a new App instance.
39
+ Initialize the Application container.
54
40
 
55
- Sets up the container and initializes the provider tracking system.
56
- This method ensures that initialization only happens once per instance,
57
- even in a singleton context.
41
+ Sets up initial state including empty providers list and booted flag.
42
+ Uses singleton pattern to prevent multiple initializations.
58
43
  """
59
-
60
- # Call parent constructor first
44
+ # Initialize base container with application paths
61
45
  super().__init__()
62
46
 
63
- # Check if this specific instance has already been initialized
47
+ # Singleton pattern - prevent multiple initializations
64
48
  if not hasattr(self, '_Application__initialized'):
65
-
66
- # Initialize provider-specific attributes
67
49
  self.__providers: List[IServiceProvider] = []
68
50
  self.__booted: bool = False
69
-
70
- # List of paths for the application
71
- self.__paths: Paths = None
72
-
73
- # Mark this instance as initialized
74
51
  self.__initialized = True
75
52
 
76
- # Bootstrap core services
77
- self.__bootFramework()
78
-
79
- def __bootFramework(
80
- self
81
- ) -> None:
82
- """
83
- Bootstrap the application by loading internal framework providers.
84
-
85
- This method should be called once to ensure that core services
86
- required by the framework are registered before user-defined
87
- providers are loaded.
88
- """
89
- if not self.__booted:
90
- self.__loadFrameworkProviders()
91
- self.__loadFrameworksKernel()
92
-
93
53
  def __loadFrameworkProviders(
94
54
  self
95
55
  ) -> None:
96
56
  """
97
- Load internal framework service providers.
57
+ Load core framework service providers.
98
58
 
99
- This method should register core services required by the framework
100
- before user-defined providers are loaded.
59
+ Registers essential providers required for framework operation:
60
+ - ConsoleProvider: Console output management
61
+ - DumperProvider: Data dumping utilities
62
+ - PathResolverProvider: Path resolution services
63
+ - ProgressBarProvider: Progress bar functionality
64
+ - WorkersProvider: Worker management
101
65
  """
102
-
103
- # Import core provider classes
66
+ # Import core framework providers
104
67
  from orionis.foundation.providers.console_provider import ConsoleProvider
105
68
  from orionis.foundation.providers.dumper_provider import DumperProvider
106
69
  from orionis.foundation.providers.path_resolver_provider import PathResolverProvider
107
70
  from orionis.foundation.providers.progress_bar_provider import ProgressBarProvider
108
71
  from orionis.foundation.providers.workers_provider import WorkersProvider
109
72
 
110
- # List of core providers to register
73
+ # Core framework providers
111
74
  core_providers = [
112
75
  ConsoleProvider,
113
76
  DumperProvider,
@@ -116,61 +79,42 @@ class Application(Container, IApplication):
116
79
  WorkersProvider
117
80
  ]
118
81
 
119
- # Register each core provider with the application
82
+ # Register each core provider
120
83
  for provider_cls in core_providers:
121
- self.__registerProvider(provider_cls)
84
+ self.addProvider(provider_cls)
122
85
 
123
86
  def __loadFrameworksKernel(
124
87
  self
125
88
  ) -> None:
126
89
  """
127
- Load the core framework kernel.
90
+ Load and register core framework kernels.
128
91
 
129
- This method is responsible for loading the core kernel of the framework,
130
- which is essential for the application to function correctly.
92
+ Instantiates and registers kernel components:
93
+ - TestKernel: Testing framework kernel
131
94
  """
132
-
133
- # Import Kernel classes
95
+ # Import core framework kernels
134
96
  from orionis.test.kernel import TestKernel, ITestKernel
135
97
 
136
- # List of core kernels to register
98
+ # Core framework kernels
137
99
  core_kernels = {
138
100
  ITestKernel: TestKernel
139
101
  }
140
102
 
141
- # Register each core kernel with the application
103
+ # Register each kernel instance
142
104
  for kernel_name, kernel_cls in core_kernels.items():
143
105
  self.instance(kernel_name, kernel_cls(self))
144
106
 
145
- def __registerProvider(
146
- self,
147
- provider_cls: Type[IServiceProvider]
148
- ) -> IServiceProvider:
107
+ def __registerProviders(
108
+ self
109
+ ) -> None:
149
110
  """
150
- Register a service provider with the application.
151
-
152
- Parameters
153
- ----------
154
- provider_cls : Type[IServiceProvider]
155
- The service provider class to register
111
+ Register all added service providers.
156
112
 
157
- Returns
158
- -------
159
- IServiceProvider
160
- The instantiated provider
161
-
162
- Raises
163
- ------
164
- TypeError
165
- If the provided class doesn't implement IServiceProvider
113
+ Calls the register method on each provider to bind services
114
+ into the container.
166
115
  """
167
- if not issubclass(provider_cls, IServiceProvider):
168
- raise TypeError(f"Provider must implement IServiceProvider interface: {provider_cls.__name__}")
169
-
170
- provider = provider_cls(self)
171
- provider.register()
172
- self.__providers.append(provider)
173
- return provider
116
+ for provider in self.__providers:
117
+ provider.register()
174
118
 
175
119
  def __bootProviders(
176
120
  self
@@ -178,99 +122,91 @@ class Application(Container, IApplication):
178
122
  """
179
123
  Boot all registered service providers.
180
124
 
181
- This method is idempotent - calling it multiple times will only
182
- boot the providers once.
183
-
184
- Raises
185
- ------
186
- TypeError
187
- If any registered provider is not an instance of IServiceProvider
125
+ Calls the boot method on each provider to initialize services
126
+ after all providers have been registered.
188
127
  """
189
- if self.__booted:
190
- return
191
-
192
128
  for provider in self.__providers:
193
- if not isinstance(provider, IServiceProvider):
194
- raise TypeError(f"Expected IServiceProvider, got {type(provider).__name__}")
195
129
  provider.boot()
196
130
 
197
- self.__booted = True
198
-
199
- def load(
131
+ def withProviders(
200
132
  self,
201
133
  providers: List[Type[IServiceProvider]] = []
202
- ) -> None:
134
+ ) -> 'Application':
203
135
  """
204
- Load and boot a list of service providers.
205
-
206
- This method registers each provider and then boots all providers.
136
+ Add multiple service providers to the application.
207
137
 
208
138
  Parameters
209
139
  ----------
210
- providers : List[Type[IServiceProvider]]
211
- List of service provider classes to register and boot
140
+ providers : List[Type[IServiceProvider]], optional
141
+ List of provider classes to add to the application
212
142
 
213
143
  Returns
214
144
  -------
215
- None
216
- """
145
+ Application
146
+ The application instance for method chaining
217
147
 
218
- # Register and boot each provided service provider
148
+ Examples
149
+ --------
150
+ >>> app.withProviders([CustomProvider, AnotherProvider])
151
+ """
152
+ # Add each provider class
219
153
  for provider_cls in providers:
220
- self.__registerProvider(provider_cls)
154
+ self.addProvider(provider_cls)
155
+ return self
221
156
 
222
- # Boot all registered providers
223
- self.__bootProviders()
224
-
225
- def paths(
157
+ def addProvider(
226
158
  self,
227
- paths: dict|Paths = None,
228
- **kwargs
229
- ) -> Paths:
159
+ provider: Type[IServiceProvider]
160
+ ) -> 'Application':
230
161
  """
231
- Configure or retrieve the application paths.
232
-
233
- This method configures the application's path settings using
234
- the provided parameters or returns the current paths if no
235
- parameters are provided.
162
+ Add a single service provider to the application.
236
163
 
237
164
  Parameters
238
165
  ----------
239
- paths : dict or Paths, optional
240
- Dictionary of paths or a Paths instance to use as the
241
- application's path configuration
242
- **kwargs
243
- Key-value pairs to create a Paths instance if a dict
244
- or Paths object is not provided
166
+ provider : Type[IServiceProvider]
167
+ The provider class to add to the application
245
168
 
246
169
  Returns
247
170
  -------
248
- Paths
249
- The current application Paths instance
171
+ Application
172
+ The application instance for method chaining
250
173
 
251
174
  Raises
252
175
  ------
253
- ValueError
254
- If the provided parameters cannot be used to create a valid Paths instance
176
+ TypeError
177
+ If provider is not a subclass of IServiceProvider
178
+ """
179
+ # Validate provider type
180
+ if not isinstance(provider, type) or not issubclass(provider, IServiceProvider):
181
+ raise TypeError(f"Expected IServiceProvider class, got {type(provider).__name__}")
182
+
183
+ # Instantiate and add provider
184
+ self.__providers.append(provider(self))
185
+ return self
186
+
187
+ def create(
188
+ self
189
+ ) -> 'Application':
190
+ """
191
+ Bootstrap the application by loading providers and kernels.
192
+
193
+ Returns
194
+ -------
195
+ Application
196
+ The application instance for method chaining
255
197
  """
256
- # Return existing paths if no arguments provided
257
- if paths is None and not kwargs:
258
- if self.__paths is None:
259
- self.__paths = Paths()
260
- return self.__paths
261
-
262
- # Configure paths based on input type
263
- try:
264
- if isinstance(paths, Paths):
265
- self.__paths = paths
266
- elif isinstance(paths, dict):
267
- self.__paths = Paths(**paths)
268
- elif kwargs:
269
- self.__paths = Paths(**kwargs)
270
- else:
271
- raise ValueError("Invalid paths configuration: must provide a Paths object, dictionary, or keyword arguments")
272
- except Exception as e:
273
- raise ValueError(f"Failed to configure application paths: {str(e)}")
274
-
275
- # Return the configured paths
276
- return self.__paths
198
+ # Check if already booted
199
+ if not self.__booted:
200
+
201
+ # Load core framework components
202
+ self.__loadFrameworkProviders()
203
+ self.__loadFrameworksKernel()
204
+
205
+ # Register and boot all providers
206
+ self.__registerProviders()
207
+ self.__bootProviders()
208
+
209
+ # Mark as booted
210
+ self.__booted = True
211
+
212
+ return self
@@ -28,19 +28,47 @@ class IApplication(IContainer):
28
28
  pass
29
29
 
30
30
  @abstractmethod
31
- def load(self, providers: List[Type[IServiceProvider]] = []) -> None:
31
+ def withProviders(self, providers: List[Type[IServiceProvider]] = []) -> 'IApplication':
32
32
  """
33
- Load and boot a list of service providers.
34
-
35
- This method registers each provider and then boots all providers.
33
+ Add multiple service providers to the application.
34
+
35
+ Parameters
36
+ ----------
37
+ providers : List[Type[IServiceProvider]], optional
38
+ List of provider classes to add to the application
39
+
40
+ Returns
41
+ -------
42
+ IApplication
43
+ The application instance for method chaining
44
+ """
45
+ pass
36
46
 
47
+ @abstractmethod
48
+ def addProvider(self, provider: Type[IServiceProvider]) -> 'IApplication':
49
+ """
50
+ Add a single service provider to the application.
51
+
37
52
  Parameters
38
53
  ----------
39
- providers : List[Type[IServiceProvider]]
40
- List of service provider classes to register and boot
54
+ provider : Type[IServiceProvider]
55
+ The provider class to add to the application
56
+
57
+ Returns
58
+ -------
59
+ IApplication
60
+ The application instance for method chaining
61
+ """
62
+ pass
41
63
 
64
+ @abstractmethod
65
+ def create(self) -> 'IApplication':
66
+ """
67
+ Bootstrap the application by loading providers and kernels.
68
+
42
69
  Returns
43
70
  -------
44
- None
71
+ IApplication
72
+ The application instance for method chaining
45
73
  """
46
74
  pass
@@ -5,7 +5,7 @@
5
5
  NAME = "orionis"
6
6
 
7
7
  # Current version of the framework
8
- VERSION = "0.389.0"
8
+ VERSION = "0.390.0"
9
9
 
10
10
  # Full name of the author or maintainer of the project
11
11
  AUTHOR = "Raul Mauricio Uñate Castro"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: orionis
3
- Version: 0.389.0
3
+ Version: 0.390.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
@@ -146,7 +146,7 @@ orionis/container/validators/is_subclass.py,sha256=4sBaGLoRs8nUhuWjlP0VJqyTwVHYq
146
146
  orionis/container/validators/is_valid_alias.py,sha256=4uAYcq8xov7jZbXnpKpjNkxcZtlTNnL5RRctVPMwJes,1424
147
147
  orionis/container/validators/lifetime.py,sha256=IQ43fDNrxYHMlZH2zlYDJnlkLO_eS4U7Fs3UJgQBidI,1844
148
148
  orionis/foundation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
149
- orionis/foundation/application.py,sha256=W10L3pRPq9LdQZivp5yMEUqfP5lHoLbwOdUhoxufST0,8598
149
+ orionis/foundation/application.py,sha256=HicY1ZiFLLPVSD21Pd3PofrvO_3tmRldQGuaMvlAZuA,6620
150
150
  orionis/foundation/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
151
151
  orionis/foundation/config/startup.py,sha256=zutF-34DkW68bpiTxH9xrmIe1iJdXCF9Y6wueXS6qys,8265
152
152
  orionis/foundation/config/app/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -235,7 +235,7 @@ orionis/foundation/config/testing/entities/testing.py,sha256=keU7dSuRv0rgaG-T4Vo
235
235
  orionis/foundation/config/testing/enums/__init__.py,sha256=tCHed6wBzqHx8o3kWBGm8tZYkYOKdSAx8TvgC-Eauv0,75
236
236
  orionis/foundation/config/testing/enums/test_mode.py,sha256=IbFpauu7J-iSAfmC8jDbmTEYl8eZr-AexL-lyOh8_74,337
237
237
  orionis/foundation/contracts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
238
- orionis/foundation/contracts/application.py,sha256=pfAngQvnnVjVZH2GhH2Bt8-540EOxWybVQa7dyeHGtg,1404
238
+ orionis/foundation/contracts/application.py,sha256=AR1SlIu6aUChLNx2PbZk1ZQgX9vgDrS51wMPaiF05O4,2217
239
239
  orionis/foundation/contracts/config.py,sha256=Rpz6U6t8OXHO9JJKSTnCimytXE-tfCB-1ithP2nG8MQ,628
240
240
  orionis/foundation/exceptions/__init__.py,sha256=XtG3MJ_MFNY_dU5mmTyz_N_4QG1jYrcv5RegBso7wuY,163
241
241
  orionis/foundation/exceptions/integrity.py,sha256=mc4pL1UMoYRHEmphnpW2oGk5URhu7DJRREyzHaV-cs8,472
@@ -247,7 +247,7 @@ orionis/foundation/providers/path_resolver_provider.py,sha256=rXvaVc5sSqmDgRzWJo
247
247
  orionis/foundation/providers/progress_bar_provider.py,sha256=75Jr4iEgUOUGl8Di1DioeP5_HRQlR-1lVzPmS96sWjA,737
248
248
  orionis/foundation/providers/workers_provider.py,sha256=WWlji3C69_-Y0c42aZDbR_bmcE_qZEh2SaA_cNkCivI,702
249
249
  orionis/metadata/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
250
- orionis/metadata/framework.py,sha256=Nv5FuKmTL1DZWOQ2wHYrB0EpKqEnMbeopiaiHAMu454,4960
250
+ orionis/metadata/framework.py,sha256=4IaQW9cQElsqCRrzC5h3HRoeIleA_458JLSI8_OwCzg,4960
251
251
  orionis/metadata/package.py,sha256=tqLfBRo-w1j_GN4xvzUNFyweWYFS-qhSgAEc-AmCH1M,5452
252
252
  orionis/services/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
253
253
  orionis/services/asynchrony/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -384,7 +384,7 @@ orionis/test/records/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hS
384
384
  orionis/test/records/logs.py,sha256=EOQcloMVdhlNl2lU9igQz8H4b-OtKtiwh2pgr_QZWOI,13186
385
385
  orionis/test/view/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
386
386
  orionis/test/view/render.py,sha256=zd7xDvVfmQ2HxZamDTzL2-z2PpyL99EaolbbM7wTah4,5014
387
- orionis-0.389.0.dist-info/licenses/LICENCE,sha256=-_4cF2EBKuYVS_SQpy1uapq0oJPUU1vl_RUWSy2jJTo,1111
387
+ orionis-0.390.0.dist-info/licenses/LICENCE,sha256=-_4cF2EBKuYVS_SQpy1uapq0oJPUU1vl_RUWSy2jJTo,1111
388
388
  tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
389
389
  tests/example/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
390
390
  tests/example/test_example.py,sha256=8G7kp74PZZ0Tdnw8WkheZ7lvZVFpdx_9ShOZBN9GEF0,25582
@@ -485,8 +485,8 @@ tests/support/wrapper/test_services_wrapper_docdict.py,sha256=nTNrvJkMSPx_aopEQ9
485
485
  tests/testing/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
486
486
  tests/testing/test_testing_result.py,sha256=fnH7hjumNSErAFGITJgq2LHxSzvPF2tdtmHL9kyAv-Y,4409
487
487
  tests/testing/test_testing_unit.py,sha256=d3CRGo6608fMzYcZKIKapjx_af2aigqWiKSiuK9euIY,7600
488
- orionis-0.389.0.dist-info/METADATA,sha256=oYUguE2hLj97apwuPA7C8ky9x-OSA3lrXxsxdzsMj9Q,4772
489
- orionis-0.389.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
490
- orionis-0.389.0.dist-info/top_level.txt,sha256=2bdoHgyGZhOtLAXS6Om8OCTmL24dUMC_L1quMe_ETbk,14
491
- orionis-0.389.0.dist-info/zip-safe,sha256=frcCV1k9oG9oKj3dpUqdJg1PxRT2RSN_XKdLCPjaYaY,2
492
- orionis-0.389.0.dist-info/RECORD,,
488
+ orionis-0.390.0.dist-info/METADATA,sha256=1ShLkVPP1VxI_7rCb6tiPjJlE1LqzB17JANoSQOV6FY,4772
489
+ orionis-0.390.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
490
+ orionis-0.390.0.dist-info/top_level.txt,sha256=2bdoHgyGZhOtLAXS6Om8OCTmL24dUMC_L1quMe_ETbk,14
491
+ orionis-0.390.0.dist-info/zip-safe,sha256=frcCV1k9oG9oKj3dpUqdJg1PxRT2RSN_XKdLCPjaYaY,2
492
+ orionis-0.390.0.dist-info/RECORD,,