orionis 0.197.0__py3-none-any.whl → 0.199.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.199.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'))
@@ -34,7 +34,6 @@ class App:
34
34
  custom : dict
35
35
  A dictionary for storing additional custom properties. Defaults to an empty dictionary.
36
36
  """
37
-
38
37
  name: str
39
38
  debug: bool
40
39
  bytecode: bool
@@ -45,6 +44,4 @@ class App:
45
44
  reload: bool
46
45
  cipher: str
47
46
  key: str
48
-
49
- # Holds additional custom properties, initialized as an empty dictionary
50
47
  custom: Dict[str, any] = field(default_factory=dict)
@@ -12,6 +12,4 @@ class Auth:
12
12
  A dictionary to store any additional custom properties.
13
13
  This field is initialized with an empty dictionary by default.
14
14
  """
15
-
16
- # Custom dictionary to hold dynamic or extra properties, initialized as an empty dict
17
15
  custom: Dict[str, any] = field(default_factory=dict)
@@ -201,6 +201,4 @@ class Database:
201
201
  """
202
202
  default: str
203
203
  connections: Connections
204
-
205
- # Holds additional custom properties, initialized as an empty dictionary
206
204
  custom: Dict[str, any] = field(default_factory=dict)
@@ -13,7 +13,6 @@ class Local:
13
13
  """
14
14
  path: str
15
15
 
16
-
17
16
  @dataclass
18
17
  class Public:
19
18
  """
@@ -29,7 +28,6 @@ class Public:
29
28
  path: str
30
29
  slug: str
31
30
 
32
-
33
31
  @dataclass
34
32
  class AWSS3:
35
33
  """
@@ -65,7 +63,6 @@ class AWSS3:
65
63
  use_path_style_endpoint: bool = False
66
64
  throw: bool = False
67
65
 
68
-
69
66
  @dataclass
70
67
  class Disks:
71
68
  """
@@ -84,7 +81,6 @@ class Disks:
84
81
  public: Public
85
82
  s3: AWSS3
86
83
 
87
-
88
84
  @dataclass
89
85
  class Filesystems:
90
86
  """
@@ -97,9 +93,6 @@ class Filesystems:
97
93
  disks : Disks
98
94
  A collection of configured storage disks.
99
95
  """
100
-
101
96
  default: str
102
97
  disks: Disks
103
-
104
- # Holds additional custom properties, initialized as an empty dictionary
105
98
  custom: Dict[str, any] = field(default_factory=dict)
@@ -19,7 +19,6 @@ class Stack:
19
19
  path: str
20
20
  level: str
21
21
 
22
-
23
22
  @dataclass
24
23
  class Hourly:
25
24
  """
@@ -38,7 +37,6 @@ class Hourly:
38
37
  level: str
39
38
  retention_hours: int
40
39
 
41
-
42
40
  @dataclass
43
41
  class Daily:
44
42
  """
@@ -60,7 +58,6 @@ class Daily:
60
58
  retention_days: int
61
59
  at: time
62
60
 
63
-
64
61
  @dataclass
65
62
  class Weekly:
66
63
  """
@@ -79,7 +76,6 @@ class Weekly:
79
76
  level: str
80
77
  retention_weeks: int
81
78
 
82
-
83
79
  @dataclass
84
80
  class Monthly:
85
81
  """
@@ -98,7 +94,6 @@ class Monthly:
98
94
  level: str
99
95
  retention_months: int
100
96
 
101
-
102
97
  @dataclass
103
98
  class Chunked:
104
99
  """
@@ -124,7 +119,6 @@ class Chunked:
124
119
  mb_size: Union[int, str]
125
120
  files: int
126
121
 
127
-
128
122
  @dataclass
129
123
  class Channels:
130
124
  """
@@ -146,7 +140,6 @@ class Channels:
146
140
  monthly : Monthly
147
141
  chunked : Chunked
148
142
 
149
-
150
143
  @dataclass
151
144
  class Logging:
152
145
  """
@@ -161,6 +154,4 @@ class Logging:
161
154
  """
162
155
  default: str
163
156
  channels: Channels
164
-
165
- # Holds additional custom properties, initialized as an empty dictionary
166
157
  custom: Dict[str, any] = field(default_factory=dict)
@@ -23,7 +23,6 @@ class Smtp:
23
23
  timeout : Optional[int], default=None
24
24
  The connection timeout duration in seconds. If None, defaults to the system setting.
25
25
  """
26
-
27
26
  url: str
28
27
  host: str
29
28
  port: int
@@ -32,7 +31,6 @@ class Smtp:
32
31
  password: str
33
32
  timeout: Optional[int] = None
34
33
 
35
-
36
34
  @dataclass
37
35
  class File:
38
36
  """
@@ -43,7 +41,6 @@ class File:
43
41
  path : str
44
42
  The file path where outgoing emails are stored instead of being sent.
45
43
  """
46
-
47
44
  path: str
48
45
 
49
46
 
@@ -59,11 +56,9 @@ class Mailers:
59
56
  file : File
60
57
  The file-based mail transport configuration (used for local development/testing).
61
58
  """
62
-
63
59
  smtp: Smtp
64
60
  file: File
65
61
 
66
-
67
62
  @dataclass
68
63
  class Mail:
69
64
  """
@@ -76,9 +71,6 @@ class Mail:
76
71
  mailers : Mailers
77
72
  The available mail transport configurations.
78
73
  """
79
-
80
74
  default: str
81
75
  mailers: Mailers
82
-
83
- # Holds additional custom properties, initialized as an empty dictionary
84
76
  custom: Dict[str, any] = field(default_factory=dict)
@@ -33,7 +33,6 @@ class Database:
33
33
  retry_after: int
34
34
  after_commit: bool
35
35
 
36
-
37
36
  @dataclass
38
37
  class Connections:
39
38
  """
@@ -44,7 +43,6 @@ class Connections:
44
43
  database : DatabaseQueue
45
44
  The configuration for the database-backed queue.
46
45
  """
47
-
48
46
  database: Database
49
47
 
50
48
  @dataclass
@@ -59,9 +57,6 @@ class Queue:
59
57
  connections : QueueConnections
60
58
  The available queue connection configurations.
61
59
  """
62
-
63
60
  default: str
64
61
  connections: Connections
65
-
66
- # Holds additional custom properties, initialized as an empty dictionary
67
62
  custom: Dict[str, any] = field(default_factory=dict)
@@ -1,5 +1,6 @@
1
1
  from dataclasses import dataclass, field
2
2
  from typing import Dict, Optional
3
+ from orionis.framework import NAME
3
4
 
4
5
  @dataclass
5
6
  class Cookie:
@@ -21,15 +22,13 @@ class Cookie:
21
22
  same_site : str
22
23
  The SameSite policy for the session cookie ('lax', 'strict', or 'none').
23
24
  """
24
-
25
- name: str = "orionis_session"
25
+ name: str = f"{NAME}_session"
26
26
  path: str = "/"
27
27
  domain: Optional[str] = None
28
28
  secure: Optional[bool] = None
29
29
  http_only: bool = True
30
30
  same_site: str = "lax"
31
31
 
32
-
33
32
  @dataclass
34
33
  class Session:
35
34
  """
@@ -50,13 +49,10 @@ class Session:
50
49
  cookie : SessionCookie
51
50
  The configuration settings for the session cookie.
52
51
  """
53
-
54
52
  driver: str
55
53
  lifetime: int
56
54
  expire_on_close: bool
57
55
  encrypt: bool
58
56
  files: str
59
57
  cookie: Cookie
60
-
61
- # Holds additional custom properties, initialized as an empty dictionary
62
- custom: Dict[str, any] = field(default_factory=dict)
58
+ custom: Dict[str, any] = field(default_factory=dict)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: orionis
3
- Version: 0.197.0
3
+ Version: 0.199.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=BAnlpo7g1gISfmflc0pRttKYURNxvSlkqTsfX4Ph7jg,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,18 +10,18 @@ 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
- orionis/luminate/config/app.py,sha256=7teuVPuaV2ao0M5Bv-jhSgjEwb9DtVwde2saTRmYru4,1737
16
- orionis/luminate/config/auth.py,sha256=CG8F0pfVjKz4DY3d1Wi7gscdhnp4TT-Q8SJ2sdsHh18,523
15
+ orionis/luminate/config/app.py,sha256=o-Ons0LMp77_E18e_dx_DqGVbjaY2l-5RdVSCILxgfg,1655
16
+ orionis/luminate/config/auth.py,sha256=ivAUgoEYEtfdC49vDwOl_MXFUVAQnUJTc8iG3Lu0Stc,430
17
17
  orionis/luminate/config/cache.py,sha256=nBKmDFDb91sbBriEsVLjMhrNb__j7YsRzZGQRDdALtA,1338
18
18
  orionis/luminate/config/cors.py,sha256=zWKUylPiaUzGXTJM3eLmwY0HcAD7iOLp9QiAoTyAL08,2275
19
- orionis/luminate/config/database.py,sha256=oj-FQWtbwIYrJAQktSGBl96EZu78fr6IBcQxHbWDVBM,5619
20
- orionis/luminate/config/filesystems.py,sha256=fAn4Wx6naIb8E4U2TXJhVnx0Ipxpxc_Ee2w_FWfwlHI,2444
21
- orionis/luminate/config/logging.py,sha256=s3QTCZtshRuMdWWpEKuM2Z-gT9Lf29Or7o_mJKfU8Ig,4047
22
- orionis/luminate/config/mail.py,sha256=3iYXG72bXiVns4sEPZ_A3-cGcFjGEGDXkuLKkk-hKtY,2102
23
- orionis/luminate/config/queue.py,sha256=DYjP5zD09ISsIX117wtOfjiG_iQrcrPoQVeeftmuO3c,1739
24
- orionis/luminate/config/session.py,sha256=7mOC_DfGIBDqAClSiewHoTA9Kht_zdHApvALcZc7cfY,1861
19
+ orionis/luminate/config/database.py,sha256=9PrAOIcM4QrkYCIm7g-gN3p-yZn9JuolLlyjxLPkTJ0,5539
20
+ orionis/luminate/config/filesystems.py,sha256=yr_bB4jQbk3yAU-tqcAPII4nUQpwR31sY_MTzyy1fSw,2354
21
+ orionis/luminate/config/logging.py,sha256=aKfM8Get5G4k-N7MtyPuTg8Lt4-I206PFE6JEiP9ms4,3953
22
+ orionis/luminate/config/mail.py,sha256=i7von352c0hujaIATEvlNBHlpWRZYNAeT3lbwA59dxk,2010
23
+ orionis/luminate/config/queue.py,sha256=4ww3OA4V0nCO93llKW3J3aeV29JSsWoi5lqA_sFLUUY,1653
24
+ orionis/luminate/config/session.py,sha256=xppot_rPAajfGR9o-wfMDwRyWMDSnI2Q7PDyutyEVcI,1809
25
25
  orionis/luminate/console/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
26
26
  orionis/luminate/console/command_filter.py,sha256=fmqjQZFwhsEMKWuTtt4dIQF-souVSJk1ksO3UqV7sis,1274
27
27
  orionis/luminate/console/kernel.py,sha256=knzOpbsHJJpAbCSrnFXgRHK9Uk4OisEW_jiylaR-PLA,891
@@ -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.199.0.dist-info/LICENCE,sha256=-_4cF2EBKuYVS_SQpy1uapq0oJPUU1vl_RUWSy2jJTo,1111
185
+ orionis-0.199.0.dist-info/METADATA,sha256=cht6x2f35drPQK6eR9h798rnVN0v9KULguOi8jHL3jg,3003
186
+ orionis-0.199.0.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
187
+ orionis-0.199.0.dist-info/entry_points.txt,sha256=a_e0faeSqyUCVZd0MqljQ2oaHHdlsz6g9sU_bMqi5zQ,49
188
+ orionis-0.199.0.dist-info/top_level.txt,sha256=2bdoHgyGZhOtLAXS6Om8OCTmL24dUMC_L1quMe_ETbk,14
189
+ orionis-0.199.0.dist-info/RECORD,,