orionis 0.197.0__py3-none-any.whl → 0.198.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 CHANGED
@@ -5,7 +5,7 @@
5
5
  NAME = "orionis"
6
6
 
7
7
  # Current version of the framework
8
- VERSION = "0.197.0"
8
+ VERSION = "0.198.0"
9
9
 
10
10
  # Full name of the author or maintainer of the project
11
11
  AUTHOR = "Raul Mauricio Uñate Castro"
@@ -23,15 +23,15 @@ class Application(metaclass=SingletonMeta):
23
23
  ----------
24
24
  _booted : bool
25
25
  Indicates whether the application has been booted.
26
- _custom_providers : List[Type[ServiceProvider]]
26
+ _custom_providers : List[Type[IServiceProvider]]
27
27
  Custom service providers defined by the developer.
28
- _service_providers : List[Type[ServiceProvider]]
28
+ _service_providers : List[Type[IServiceProvider]]
29
29
  Core application service providers.
30
- _config : dict
30
+ _config : Dict
31
31
  Configuration settings of the application.
32
- _commands : dict
32
+ _commands : Dict
33
33
  Registered console commands.
34
- _env : dict
34
+ _env : Dict
35
35
  Environment variables.
36
36
  _container : IContainer
37
37
  The service container instance.
@@ -41,8 +41,17 @@ class Application(metaclass=SingletonMeta):
41
41
 
42
42
  def __init__(self):
43
43
  """
44
- Initializes the application by setting up service providers, environment variables,
45
- configuration, and the service container.
44
+ Initializes the application by setting up the service container and preparing
45
+ lists for custom service providers, service providers, configuration, commands,
46
+ and environment variables.
47
+ Attributes:
48
+ _custom_providers (List[Type[IServiceProvider]]): List to store custom service providers.
49
+ _service_providers (List[Type[IServiceProvider]]): List to store service providers.
50
+ _config (Dict): Dictionary to store configuration settings.
51
+ _commands (Dict): Dictionary to store commands.
52
+ _env (Dict): Dictionary to store environment variables.
53
+ _container (IContainer): The service container instance.
54
+ Registers the application instance in the service container.
46
55
  """
47
56
  self._custom_providers: List[Type[IServiceProvider]] = []
48
57
  self._service_providers: List[Type[IServiceProvider]] = []
@@ -57,7 +66,7 @@ class Application(metaclass=SingletonMeta):
57
66
  @classmethod
58
67
  def boot(cls) -> None:
59
68
  """
60
- Marks the application as booted.
69
+ Marks the application as booted by setting the _booted class attribute to True.
61
70
  """
62
71
  cls._booted = True
63
72
 
@@ -69,7 +78,7 @@ class Application(metaclass=SingletonMeta):
69
78
  Returns
70
79
  -------
71
80
  bool
72
- True if the application is running, otherwise False.
81
+ True if the application has been booted, otherwise False.
73
82
  """
74
83
  return cls._booted
75
84
 
@@ -86,28 +95,38 @@ class Application(metaclass=SingletonMeta):
86
95
  Raises
87
96
  ------
88
97
  RuntimeError
89
- If the application has not been initialized yet.
98
+ If the application instance does not exist.
90
99
  """
91
100
  if cls not in SingletonMeta._instances:
92
- raise RuntimeError("Application has not been initialized yet. Please create an instance first.")
101
+ raise RuntimeError("Application instance does not exist. Please create an instance first.")
93
102
  return SingletonMeta._instances[cls]
94
103
 
95
104
  @classmethod
96
105
  def destroy(cls) -> None:
97
106
  """
98
- Destroys the singleton instance of the Application.
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
99
115
  """
100
116
  if cls in SingletonMeta._instances:
101
117
  del SingletonMeta._instances[cls]
102
118
 
103
119
  def withProviders(self, providers: List[Type[IServiceProvider]] = None) -> "Application":
104
120
  """
105
- Sets custom service providers.
106
-
107
- Parameters
108
- ----------
109
- providers : List[Type[IServiceProvider]], optional
110
- List of service providers, by default None.
121
+ This method allows you to specify a list of custom service providers
122
+ that will be used by the application. If no providers are specified,
123
+ an empty list will be used by default.
124
+ A list of service provider classes to be used by the application.
125
+ If not provided, defaults to an empty list.
126
+ Returns
127
+ -------
128
+ Application
129
+ The instance of the Application with the custom service providers set.
111
130
  """
112
131
  self._custom_providers = providers or []
113
132
  return self
@@ -125,25 +144,30 @@ class Application(metaclass=SingletonMeta):
125
144
 
126
145
  def create(self) -> None:
127
146
  """
128
- Initializes and boots the application, including loading commands
129
- and service providers.
147
+ Initializes and boots the application.
148
+ This method performs the following steps:
149
+ 1. Boots the application by calling the `_bootstrapping` method.
150
+ 2. Loads commands and service providers by calling the `_loadCommands` method.
151
+ 3. Boots service providers asynchronously using `AsyncExecutor.run` on the `_bootServiceProviders` method.
152
+ 4. Changes the application status to booted by calling `Application.boot`.
153
+ Returns
154
+ -------
155
+ None
130
156
  """
131
-
132
- # Boot the application
133
157
  self._bootstrapping()
134
-
135
- # Load commands and service providers
136
158
  self._loadCommands()
137
-
138
- # Boot service providers
139
159
  AsyncExecutor.run(self._bootServiceProviders())
140
-
141
- # Change the application status to booted
142
160
  Application.boot()
143
161
 
144
162
  async def _bootServiceProviders(self) -> None:
145
163
  """
146
- Boots all registered service providers.
164
+ This method iterates over all registered service providers, registers them,
165
+ and calls their `boot` method if it exists and is callable.
166
+ Raises
167
+ ------
168
+ RuntimeError
169
+ If an error occurs while booting a service provider, a RuntimeError is raised
170
+ with a message indicating which service provider failed and the original exception.
147
171
  """
148
172
  for service in self._service_providers:
149
173
  provider: IServiceProvider = service(app=self._container)
@@ -157,8 +181,16 @@ class Application(metaclass=SingletonMeta):
157
181
 
158
182
  def _bootstrapping(self) -> None:
159
183
  """
160
- Loads essential components such as environment variables,
161
- configurations, commands, and service providers.
184
+ Initializes and loads essential components for the application.
185
+ This method sets up the environment variables, configurations, commands,
186
+ and service providers by utilizing their respective bootstrappers. It
187
+ iterates through a list of bootstrappers, updating or extending the
188
+ corresponding properties with the data provided by each bootstrapper.
189
+ Raises
190
+ ------
191
+ BootstrapRuntimeError
192
+ If an error occurs during the bootstrapping process, an exception is
193
+ raised with details about the specific bootstrapper that failed.
162
194
  """
163
195
  bootstrappers = [
164
196
  {'property': self._env, 'instance': EnvironmentBootstrapper()},
@@ -182,7 +214,18 @@ class Application(metaclass=SingletonMeta):
182
214
 
183
215
  def _loadCommands(self) -> None:
184
216
  """
185
- Registers application commands in the service container.
217
+ This method iterates over the `_commands` dictionary and registers each command
218
+ in the service container as a transient service. The command's signature and
219
+ concrete implementation are retrieved from the dictionary and passed to the
220
+ container's `transient` method.
221
+
222
+ Parameters
223
+ ----------
224
+ None
225
+
226
+ Returns
227
+ -------
228
+ None
186
229
  """
187
230
  for command, data_command in self._commands.items():
188
231
  self._container.transient(data_command.get('signature'), data_command.get('concrete'))
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: orionis
3
- Version: 0.197.0
3
+ Version: 0.198.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,6 @@
1
1
  orionis/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
2
  orionis/console.py,sha256=4gYWxf0fWYgJ4RKwARvnTPh06FL3GJ6SAZ7R2NzOICw,1342
3
- orionis/framework.py,sha256=qRf3MBqE0BJyfxQWiCeS5RknzvE007hmit6b1ki-WsU,1469
3
+ orionis/framework.py,sha256=SNv_C3vMiGA9gfXNiAV_N1H4a4Ib7DNhq64blJGNTuM,1469
4
4
  orionis/installer/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
5
  orionis/installer/manager.py,sha256=Li4TVziRXWfum02xNG4JHwbnLk-u8xzHjdqKz-D894k,2755
6
6
  orionis/installer/output.py,sha256=7O9qa2xtXMB_4ZvVi-Klneom9YazwygAd_4uYAoxhbU,8548
@@ -10,7 +10,7 @@ orionis/installer/contracts/manager.py,sha256=Zfndhuyu0JaTKo3PsGsKmVsvotQMw8Pmt4
10
10
  orionis/installer/contracts/output.py,sha256=t1KLw610-hHy63UbFFE2BYwWHWRbW8_ofuEvRLx_IUE,983
11
11
  orionis/installer/contracts/setup.py,sha256=aWYkCv-z48bXXZynYapc3uMIE1gyO6XnkTw3b4MTBq4,784
12
12
  orionis/luminate/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
- orionis/luminate/application.py,sha256=AzVepXMIzA23NMWMCzZw9F-B-XIV4ik8aZA5rcPBsbE,6966
13
+ orionis/luminate/application.py,sha256=bpZeV8NEHLNm8MkS6suCX3nd7LYB4dOTIgaIivKl2xI,9526
14
14
  orionis/luminate/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
15
15
  orionis/luminate/config/app.py,sha256=7teuVPuaV2ao0M5Bv-jhSgjEwb9DtVwde2saTRmYru4,1737
16
16
  orionis/luminate/config/auth.py,sha256=CG8F0pfVjKz4DY3d1Wi7gscdhnp4TT-Q8SJ2sdsHh18,523
@@ -181,9 +181,9 @@ tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
181
181
  tests/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
182
182
  tests/tools/class_example.py,sha256=dIPD997Y15n6WmKhWoOFSwEldRm9MdOHTZZ49eF1p3c,1056
183
183
  tests/tools/test_reflection.py,sha256=bhLQ7VGVod4B8sv-rW9AjnOumvaBVsoxieA3sdoM2yM,5244
184
- orionis-0.197.0.dist-info/LICENCE,sha256=-_4cF2EBKuYVS_SQpy1uapq0oJPUU1vl_RUWSy2jJTo,1111
185
- orionis-0.197.0.dist-info/METADATA,sha256=SiKzS2G5mQZoaRMQ0ByvKZ4DRcVmvBMrE15rBcmg1HQ,3003
186
- orionis-0.197.0.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
187
- orionis-0.197.0.dist-info/entry_points.txt,sha256=a_e0faeSqyUCVZd0MqljQ2oaHHdlsz6g9sU_bMqi5zQ,49
188
- orionis-0.197.0.dist-info/top_level.txt,sha256=2bdoHgyGZhOtLAXS6Om8OCTmL24dUMC_L1quMe_ETbk,14
189
- orionis-0.197.0.dist-info/RECORD,,
184
+ orionis-0.198.0.dist-info/LICENCE,sha256=-_4cF2EBKuYVS_SQpy1uapq0oJPUU1vl_RUWSy2jJTo,1111
185
+ orionis-0.198.0.dist-info/METADATA,sha256=ZnVjxNFfxxQL4cjfoNa9vYE5AymnYuB2I5Q7lFJMebU,3003
186
+ orionis-0.198.0.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
187
+ orionis-0.198.0.dist-info/entry_points.txt,sha256=a_e0faeSqyUCVZd0MqljQ2oaHHdlsz6g9sU_bMqi5zQ,49
188
+ orionis-0.198.0.dist-info/top_level.txt,sha256=2bdoHgyGZhOtLAXS6Om8OCTmL24dUMC_L1quMe_ETbk,14
189
+ orionis-0.198.0.dist-info/RECORD,,