orionis 0.32.0__py3-none-any.whl → 0.34.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.32.0"
8
+ VERSION = "0.34.0"
9
9
 
10
10
  # Full name of the author or maintainer of the project
11
11
  AUTHOR = "Raul Mauricio Uñate Castro"
orionis/luminate/app.py CHANGED
@@ -2,8 +2,9 @@ from orionis.luminate.container.container import Container
2
2
  from orionis.luminate.cache.app.config import CacheConfig
3
3
  from orionis.luminate.bootstrap.config.register import Register
4
4
  from orionis.luminate.bootstrap.config.bootstrapper import Bootstrapper
5
+ from orionis.luminate.patterns.singleton import SingletonMeta
5
6
 
6
- class App:
7
+ class App(metaclass=SingletonMeta):
7
8
 
8
9
  def __init__(self):
9
10
  self.container = Container()
@@ -5,6 +5,7 @@ from typing import Callable, Any, Dict
5
5
  from orionis.luminate.container.exception import OrionisContainerException, OrionisContainerValueError, OrionisContainerTypeError
6
6
  from orionis.luminate.container.types import Types
7
7
  from orionis.luminate.contracts.container.container_interface import IContainer
8
+ from orionis.luminate.patterns.singleton import SingletonMeta
8
9
 
9
10
  BINDING = 'binding'
10
11
  TRANSIENT = 'transient'
@@ -12,7 +13,7 @@ SINGLETON = 'singleton'
12
13
  SCOPED = 'scoped'
13
14
  INSTANCE = 'instance'
14
15
 
15
- class Container(IContainer):
16
+ class Container(IContainer, metaclass=SingletonMeta):
16
17
  """
17
18
  Service container and dependency injection manager.
18
19
 
@@ -20,23 +21,15 @@ class Container(IContainer):
20
21
  and different lifecycle types such as transient, singleton, and scoped.
21
22
  """
22
23
 
23
- _instance = None
24
- _lock = Lock()
25
-
26
- def __new__(cls):
27
- if cls._instance is None:
28
- with cls._lock:
29
- if cls._instance is None:
30
- cls._instance = super().__new__(cls)
31
- cls._instance._bindings = {}
32
- cls._instance._transients = {}
33
- cls._instance._singletons = {}
34
- cls._instance._scoped_services = {}
35
- cls._instance._instances = {}
36
- cls._instance._aliases = {}
37
- cls._instance._scoped_instances = {}
38
- cls._instance._validate_types = Types()
39
- return cls._instance
24
+ def __init__(self):
25
+ self._bindings = {}
26
+ self._transients = {}
27
+ self._singletons = {}
28
+ self._scoped_services = {}
29
+ self._instances = {}
30
+ self._aliases = {}
31
+ self._scoped_instances = {}
32
+ self._validate_types = Types()
40
33
 
41
34
  def _newRequest(self) -> None:
42
35
  """
@@ -1,7 +1,8 @@
1
1
  import traceback
2
2
  from orionis.luminate.app import App
3
+ from orionis.luminate.patterns.singleton import SingletonMeta
3
4
 
4
- class OrionisContext:
5
+ class Orionis(metaclass=SingletonMeta):
5
6
  """
6
7
  Context manager for the Orionis application that handles startup and cleanup.
7
8
 
@@ -87,7 +88,7 @@ class OrionisContext:
87
88
  self.error_info = (exc_val, traceback.format_exc())
88
89
  return False
89
90
 
90
- def is_active(self):
91
+ def isStarted(self):
91
92
  """
92
93
  Check if the application is currently active.
93
94
 
@@ -98,7 +99,7 @@ class OrionisContext:
98
99
  """
99
100
  return self.is_started
100
101
 
101
- def get_error(self):
102
+ def getError(self):
102
103
  """
103
104
  Retrieve the stored error information.
104
105
 
@@ -0,0 +1,44 @@
1
+ import threading
2
+
3
+ class SingletonMeta(type):
4
+ """
5
+ A thread-safe metaclass for implementing the Singleton pattern.
6
+
7
+ This metaclass ensures that only one instance of a class is created,
8
+ even in a multithreaded environment, by using a lock to synchronize
9
+ instance creation.
10
+
11
+ Attributes
12
+ ----------
13
+ _instances : dict
14
+ A dictionary that holds the single instances of the classes using this metaclass.
15
+ _lock : threading.Lock
16
+ A lock to ensure thread-safe instance creation.
17
+ """
18
+ _instances = {}
19
+ _lock = threading.Lock()
20
+
21
+ def __call__(cls, *args, **kwargs):
22
+ """
23
+ Return the singleton instance of the class in a thread-safe manner.
24
+
25
+ If an instance does not already exist, it is created under the protection
26
+ of a lock; otherwise, the existing instance is returned.
27
+
28
+ Parameters
29
+ ----------
30
+ *args : list
31
+ Positional arguments for the class constructor.
32
+ **kwargs : dict
33
+ Keyword arguments for the class constructor.
34
+
35
+ Returns
36
+ -------
37
+ object
38
+ The singleton instance of the class.
39
+ """
40
+ if cls not in cls._instances:
41
+ with cls._lock:
42
+ if cls not in cls._instances:
43
+ cls._instances[cls] = super().__call__(*args, **kwargs)
44
+ return cls._instances[cls]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: orionis
3
- Version: 0.32.0
3
+ Version: 0.34.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,9 +1,9 @@
1
1
  orionis/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
2
  orionis/cli_manager.py,sha256=9wNVJxB0HyqUbNesUvkwlsqTyUbZwK6R46iVLE5WVBQ,1715
3
- orionis/framework.py,sha256=7BvUPSkuApEQtQjzVFrEMf14oReuvJrgWe5iD9ZWiNY,1386
3
+ orionis/framework.py,sha256=lievfimHcqj63V6oBF1kmjmPa9BXOfh5FGYVnhzjS6M,1386
4
4
  orionis/luminate/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
- orionis/luminate/app.py,sha256=ZFMyWWMuQUtG0B9sWmCibnL_AiCp78yziqLGJTbP6IE,811
6
- orionis/luminate/orionis.py,sha256=VM6YgIBZBu6WU7Tv5i22wbuIhWVJsDrtDxokBP169o8,3512
5
+ orionis/luminate/app.py,sha256=d_p--jxfOMbO2inEwWVTQONJxLKan0OaC5tOFu4SRg8,899
6
+ orionis/luminate/orionis.py,sha256=qIuXGlM1lvoOAF0kLzoukk3aY3h-Etr1stbKEWqnUpY,3592
7
7
  orionis/luminate/bootstrap/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
8
  orionis/luminate/bootstrap/cli_exception.py,sha256=wDKfEW295c7-bavr7YUHK2CLYcTSZgjT9ZRSBne6GOE,1356
9
9
  orionis/luminate/bootstrap/commands/bootstrapper.py,sha256=TuXuQUzeaiDL8sJyZNdqnFl2h2MfxcnSU045IeIKVQE,4016
@@ -56,7 +56,7 @@ orionis/luminate/console/scripts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRk
56
56
  orionis/luminate/console/scripts/management.py,sha256=J5gLXtvX8I1zdNk6sa23njR18D5s4LJXZK7ElK0sFzI,2868
57
57
  orionis/luminate/console/tasks/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
58
58
  orionis/luminate/console/tasks/scheduler.py,sha256=CUmv9ap7zq3IWVTPtpPBZ-x166jsj1e0lTvw3didUQM,22692
59
- orionis/luminate/container/container.py,sha256=5VvFiX4Keprk9nBszwtoJyFE6Mq-i4vulKJNLtFox8w,16417
59
+ orionis/luminate/container/container.py,sha256=NcwlVswd_fbj9WUGVufS7HqBO06vJ6r1_MTaKDyI2VA,16100
60
60
  orionis/luminate/container/exception.py,sha256=ap1SqYEjQEEHXJJTNmL7V1jrmRjgT5_7geZ95MYkhMA,1691
61
61
  orionis/luminate/container/types.py,sha256=PbPNOJ8e4SGzCmu-zOmCQmDzt1b9I73v3fw_xzLq9RU,932
62
62
  orionis/luminate/contracts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -123,6 +123,7 @@ orionis/luminate/installer/setup.py,sha256=1hpU4nO2e2AeHb9hNYyvhruiYk9fHVNNc5OSp
123
123
  orionis/luminate/installer/upgrade.py,sha256=kJT6p2j_2nHNihlSBIm--fL-yQpqX8MtOdmuaqAmkVM,1421
124
124
  orionis/luminate/log/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
125
125
  orionis/luminate/log/logger.py,sha256=9s_zYIa7b388WRlDl1WdMW_lzIEsBOROA2YlWq_C02E,3651
126
+ orionis/luminate/patterns/singleton.py,sha256=b3U0nubKSQWyal5wTXADVPtOztkaTk-M8Zwy-bje1L0,1425
126
127
  orionis/luminate/pipelines/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
127
128
  orionis/luminate/pipelines/cli_pipeline.py,sha256=UpEWClNSxeDnFEpryrBSQZ6z2SFpXrW0GazEQ6ejoEM,3809
128
129
  orionis/luminate/publisher/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -146,9 +147,9 @@ tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
146
147
  tests/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
147
148
  tests/tools/class_example.py,sha256=dIPD997Y15n6WmKhWoOFSwEldRm9MdOHTZZ49eF1p3c,1056
148
149
  tests/tools/test_reflection.py,sha256=dNN5p_xAosyEf0ddAElmmmTfhcTtBd4zBNl7qzgnsc0,5242
149
- orionis-0.32.0.dist-info/LICENCE,sha256=-_4cF2EBKuYVS_SQpy1uapq0oJPUU1vl_RUWSy2jJTo,1111
150
- orionis-0.32.0.dist-info/METADATA,sha256=RUCn_kjyqY52AQ6r-GvYhiAZGwgIRu7DxAdMXfsSjmE,2978
151
- orionis-0.32.0.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
152
- orionis-0.32.0.dist-info/entry_points.txt,sha256=eef1_CVewfokKjrGBynXa06KabSJYo7LlDKKIKvs1cM,53
153
- orionis-0.32.0.dist-info/top_level.txt,sha256=2bdoHgyGZhOtLAXS6Om8OCTmL24dUMC_L1quMe_ETbk,14
154
- orionis-0.32.0.dist-info/RECORD,,
150
+ orionis-0.34.0.dist-info/LICENCE,sha256=-_4cF2EBKuYVS_SQpy1uapq0oJPUU1vl_RUWSy2jJTo,1111
151
+ orionis-0.34.0.dist-info/METADATA,sha256=73kpkJv6oLnEREnoDXJTYBo9RN9y0GmrVT-rJPrW1yM,2978
152
+ orionis-0.34.0.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
153
+ orionis-0.34.0.dist-info/entry_points.txt,sha256=eef1_CVewfokKjrGBynXa06KabSJYo7LlDKKIKvs1cM,53
154
+ orionis-0.34.0.dist-info/top_level.txt,sha256=2bdoHgyGZhOtLAXS6Om8OCTmL24dUMC_L1quMe_ETbk,14
155
+ orionis-0.34.0.dist-info/RECORD,,