orionis 0.47.0__tar.gz → 0.52.0__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (166) hide show
  1. {orionis-0.47.0/orionis.egg-info → orionis-0.52.0}/PKG-INFO +1 -1
  2. orionis-0.47.0/orionis/contracts/support/i_environment.py → orionis-0.52.0/orionis/contracts/facades/environment/i_environment_facade.py +1 -1
  3. {orionis-0.47.0 → orionis-0.52.0}/orionis/framework.py +1 -1
  4. {orionis-0.47.0 → orionis-0.52.0}/orionis/installer/installer_output.py +3 -10
  5. orionis-0.52.0/orionis/luminate/app.py +19 -0
  6. orionis-0.47.0/orionis/luminate/support/environment.py → orionis-0.52.0/orionis/luminate/facades/environment/environment_facade.py +52 -15
  7. {orionis-0.47.0 → orionis-0.52.0}/orionis/luminate/facades/files/path_facade.py +1 -4
  8. {orionis-0.47.0 → orionis-0.52.0}/orionis/luminate/services/files/path_service.py +37 -17
  9. orionis-0.52.0/orionis/static/ascii/icon.ascii +12 -0
  10. orionis-0.52.0/orionis/static/ascii/info.ascii +14 -0
  11. {orionis-0.47.0 → orionis-0.52.0/orionis.egg-info}/PKG-INFO +1 -1
  12. {orionis-0.47.0 → orionis-0.52.0}/orionis.egg-info/SOURCES.txt +0 -5
  13. orionis-0.47.0/orionis/contracts/facades/environment/i_environment_facade.py +0 -40
  14. orionis-0.47.0/orionis/luminate/app.py +0 -103
  15. orionis-0.47.0/orionis/luminate/config/helpers.py +0 -20
  16. orionis-0.47.0/orionis/luminate/facades/environment/environment_facade.py +0 -68
  17. orionis-0.47.0/orionis/luminate/providers/files/path_service_provider.py +0 -26
  18. orionis-0.47.0/orionis/static/ascii/icon.ascii +0 -11
  19. orionis-0.47.0/orionis/static/ascii/info.ascii +0 -13
  20. orionis-0.47.0/tests/tools/__init__.py +0 -0
  21. {orionis-0.47.0 → orionis-0.52.0}/LICENCE +0 -0
  22. {orionis-0.47.0 → orionis-0.52.0}/MANIFEST.in +0 -0
  23. {orionis-0.47.0 → orionis-0.52.0}/README.md +0 -0
  24. {orionis-0.47.0 → orionis-0.52.0}/orionis/__init__.py +0 -0
  25. {orionis-0.47.0 → orionis-0.52.0}/orionis/cli_manager.py +0 -0
  26. {orionis-0.47.0 → orionis-0.52.0}/orionis/contracts/__init__.py +0 -0
  27. {orionis-0.47.0 → orionis-0.52.0}/orionis/contracts/bootstrap/i_command_bootstrapper.py +0 -0
  28. {orionis-0.47.0 → orionis-0.52.0}/orionis/contracts/bootstrap/i_config_bootstrapper.py +0 -0
  29. {orionis-0.47.0 → orionis-0.52.0}/orionis/contracts/bootstrap/i_environment_bootstrapper.py +0 -0
  30. {orionis-0.47.0 → orionis-0.52.0}/orionis/contracts/config/__init__.py +0 -0
  31. {orionis-0.47.0 → orionis-0.52.0}/orionis/contracts/config/i_config.py +0 -0
  32. {orionis-0.47.0 → orionis-0.52.0}/orionis/contracts/console/__init__.py +0 -0
  33. {orionis-0.47.0 → orionis-0.52.0}/orionis/contracts/console/base/__init__.py +0 -0
  34. {orionis-0.47.0 → orionis-0.52.0}/orionis/contracts/console/base/i_command.py +0 -0
  35. {orionis-0.47.0 → orionis-0.52.0}/orionis/contracts/console/i_command_filter.py +0 -0
  36. {orionis-0.47.0 → orionis-0.52.0}/orionis/contracts/console/i_kernel.py +0 -0
  37. {orionis-0.47.0 → orionis-0.52.0}/orionis/contracts/console/i_parser.py +0 -0
  38. {orionis-0.47.0 → orionis-0.52.0}/orionis/contracts/console/i_task_manager.py +0 -0
  39. {orionis-0.47.0 → orionis-0.52.0}/orionis/contracts/console/output/__init__.py +0 -0
  40. {orionis-0.47.0 → orionis-0.52.0}/orionis/contracts/console/output/i_console.py +0 -0
  41. {orionis-0.47.0 → orionis-0.52.0}/orionis/contracts/console/output/i_executor.py +0 -0
  42. {orionis-0.47.0 → orionis-0.52.0}/orionis/contracts/console/output/i_progress_bar.py +0 -0
  43. {orionis-0.47.0 → orionis-0.52.0}/orionis/contracts/console/tasks/__init__.py +0 -0
  44. {orionis-0.47.0 → orionis-0.52.0}/orionis/contracts/console/tasks/i_schedule.py +0 -0
  45. {orionis-0.47.0 → orionis-0.52.0}/orionis/contracts/container/i_container.py +0 -0
  46. {orionis-0.47.0 → orionis-0.52.0}/orionis/contracts/container/i_types.py +0 -0
  47. {orionis-0.47.0 → orionis-0.52.0}/orionis/contracts/facades/__init__.py +0 -0
  48. {orionis-0.47.0 → orionis-0.52.0}/orionis/contracts/facades/config/__init__.py +0 -0
  49. {orionis-0.47.0 → orionis-0.52.0}/orionis/contracts/facades/config/i_config_facade.py +0 -0
  50. {orionis-0.47.0 → orionis-0.52.0}/orionis/contracts/facades/environment/__init__.py +0 -0
  51. {orionis-0.47.0 → orionis-0.52.0}/orionis/contracts/facades/files/__init__.py +0 -0
  52. {orionis-0.47.0 → orionis-0.52.0}/orionis/contracts/facades/files/i_path_facade.py +0 -0
  53. {orionis-0.47.0 → orionis-0.52.0}/orionis/contracts/facades/log/__init__.py +0 -0
  54. {orionis-0.47.0 → orionis-0.52.0}/orionis/contracts/facades/log/i_log_facade.py +0 -0
  55. {orionis-0.47.0 → orionis-0.52.0}/orionis/contracts/facades/tests/__init__.py +0 -0
  56. {orionis-0.47.0 → orionis-0.52.0}/orionis/contracts/facades/tests/i_tests_facade.py +0 -0
  57. {orionis-0.47.0 → orionis-0.52.0}/orionis/contracts/installer/__init__.py +0 -0
  58. {orionis-0.47.0 → orionis-0.52.0}/orionis/contracts/installer/i_installer_manager.py +0 -0
  59. {orionis-0.47.0 → orionis-0.52.0}/orionis/contracts/installer/i_installer_output.py +0 -0
  60. {orionis-0.47.0 → orionis-0.52.0}/orionis/contracts/installer/i_installer_setup.py +0 -0
  61. {orionis-0.47.0 → orionis-0.52.0}/orionis/contracts/providers/__init__.py +0 -0
  62. {orionis-0.47.0 → orionis-0.52.0}/orionis/contracts/providers/i_service_provider.py +0 -0
  63. {orionis-0.47.0 → orionis-0.52.0}/orionis/contracts/services/__init__.py +0 -0
  64. {orionis-0.47.0 → orionis-0.52.0}/orionis/contracts/services/config/__init__.py +0 -0
  65. {orionis-0.47.0 → orionis-0.52.0}/orionis/contracts/services/config/i_config_service.py +0 -0
  66. {orionis-0.47.0 → orionis-0.52.0}/orionis/contracts/services/files/__init__.py +0 -0
  67. {orionis-0.47.0 → orionis-0.52.0}/orionis/contracts/services/files/i_path_service.py +0 -0
  68. {orionis-0.47.0 → orionis-0.52.0}/orionis/contracts/services/log/__init__.py +0 -0
  69. {orionis-0.47.0 → orionis-0.52.0}/orionis/contracts/services/log/i_log_service.py +0 -0
  70. {orionis-0.47.0 → orionis-0.52.0}/orionis/contracts/support/i_exception_to_dict.py +0 -0
  71. {orionis-0.47.0 → orionis-0.52.0}/orionis/contracts/support/i_reflection.py +0 -0
  72. {orionis-0.47.0 → orionis-0.52.0}/orionis/contracts/support/i_std.py +0 -0
  73. {orionis-0.47.0 → orionis-0.52.0}/orionis/installer/__init__.py +0 -0
  74. {orionis-0.47.0 → orionis-0.52.0}/orionis/installer/installer_manager.py +0 -0
  75. {orionis-0.47.0 → orionis-0.52.0}/orionis/installer/installer_setup.py +0 -0
  76. {orionis-0.47.0 → orionis-0.52.0}/orionis/luminate/__init__.py +0 -0
  77. {orionis-0.47.0 → orionis-0.52.0}/orionis/luminate/app_context.py +0 -0
  78. {orionis-0.47.0 → orionis-0.52.0}/orionis/luminate/bootstrap/__init__.py +0 -0
  79. {orionis-0.47.0 → orionis-0.52.0}/orionis/luminate/bootstrap/command_bootstrapper.py +0 -0
  80. {orionis-0.47.0 → orionis-0.52.0}/orionis/luminate/bootstrap/config_bootstrapper.py +0 -0
  81. {orionis-0.47.0 → orionis-0.52.0}/orionis/luminate/bootstrap/environment_bootstrapper.py +0 -0
  82. {orionis-0.47.0 → orionis-0.52.0}/orionis/luminate/bootstrap/exception_bootstrapper.py +0 -0
  83. {orionis-0.47.0 → orionis-0.52.0}/orionis/luminate/config/__init__.py +0 -0
  84. {orionis-0.47.0 → orionis-0.52.0}/orionis/luminate/config/app.py +0 -0
  85. {orionis-0.47.0 → orionis-0.52.0}/orionis/luminate/config/auth.py +0 -0
  86. {orionis-0.47.0 → orionis-0.52.0}/orionis/luminate/config/cache.py +0 -0
  87. {orionis-0.47.0 → orionis-0.52.0}/orionis/luminate/config/cors.py +0 -0
  88. {orionis-0.47.0 → orionis-0.52.0}/orionis/luminate/config/database.py +0 -0
  89. {orionis-0.47.0 → orionis-0.52.0}/orionis/luminate/config/filesystems.py +0 -0
  90. {orionis-0.47.0 → orionis-0.52.0}/orionis/luminate/config/logging.py +0 -0
  91. {orionis-0.47.0 → orionis-0.52.0}/orionis/luminate/config/mail.py +0 -0
  92. {orionis-0.47.0 → orionis-0.52.0}/orionis/luminate/config/queue.py +0 -0
  93. {orionis-0.47.0 → orionis-0.52.0}/orionis/luminate/config/session.py +0 -0
  94. {orionis-0.47.0 → orionis-0.52.0}/orionis/luminate/console/__init__.py +0 -0
  95. {orionis-0.47.0 → orionis-0.52.0}/orionis/luminate/console/base/__init__.py +0 -0
  96. {orionis-0.47.0 → orionis-0.52.0}/orionis/luminate/console/base/command.py +0 -0
  97. {orionis-0.47.0 → orionis-0.52.0}/orionis/luminate/console/command_filter.py +0 -0
  98. {orionis-0.47.0 → orionis-0.52.0}/orionis/luminate/console/commands/__init__.py +0 -0
  99. {orionis-0.47.0 → orionis-0.52.0}/orionis/luminate/console/commands/cache_clear.py +0 -0
  100. {orionis-0.47.0 → orionis-0.52.0}/orionis/luminate/console/commands/help.py +0 -0
  101. {orionis-0.47.0 → orionis-0.52.0}/orionis/luminate/console/commands/schedule_work.py +0 -0
  102. {orionis-0.47.0 → orionis-0.52.0}/orionis/luminate/console/commands/tests.py +0 -0
  103. {orionis-0.47.0 → orionis-0.52.0}/orionis/luminate/console/commands/version.py +0 -0
  104. {orionis-0.47.0 → orionis-0.52.0}/orionis/luminate/console/exceptions/__init__.py +0 -0
  105. {orionis-0.47.0 → orionis-0.52.0}/orionis/luminate/console/exceptions/cli_exception.py +0 -0
  106. {orionis-0.47.0 → orionis-0.52.0}/orionis/luminate/console/kernel.py +0 -0
  107. {orionis-0.47.0 → orionis-0.52.0}/orionis/luminate/console/output/__init__.py +0 -0
  108. {orionis-0.47.0 → orionis-0.52.0}/orionis/luminate/console/output/console.py +0 -0
  109. {orionis-0.47.0 → orionis-0.52.0}/orionis/luminate/console/output/executor.py +0 -0
  110. {orionis-0.47.0 → orionis-0.52.0}/orionis/luminate/console/output/progress_bar.py +0 -0
  111. {orionis-0.47.0 → orionis-0.52.0}/orionis/luminate/console/output/styles.py +0 -0
  112. {orionis-0.47.0 → orionis-0.52.0}/orionis/luminate/console/parser.py +0 -0
  113. {orionis-0.47.0 → orionis-0.52.0}/orionis/luminate/console/runner.py +0 -0
  114. {orionis-0.47.0 → orionis-0.52.0}/orionis/luminate/console/tasks/__init__.py +0 -0
  115. {orionis-0.47.0 → orionis-0.52.0}/orionis/luminate/console/tasks/scheduler.py +0 -0
  116. {orionis-0.47.0 → orionis-0.52.0}/orionis/luminate/container/container.py +0 -0
  117. {orionis-0.47.0 → orionis-0.52.0}/orionis/luminate/container/exception.py +0 -0
  118. {orionis-0.47.0 → orionis-0.52.0}/orionis/luminate/container/types.py +0 -0
  119. {orionis-0.47.0 → orionis-0.52.0}/orionis/luminate/facades/__init__.py +0 -0
  120. {orionis-0.47.0 → orionis-0.52.0}/orionis/luminate/facades/config/__init__.py +0 -0
  121. {orionis-0.47.0 → orionis-0.52.0}/orionis/luminate/facades/config/config_facade.py +0 -0
  122. {orionis-0.47.0 → orionis-0.52.0}/orionis/luminate/facades/environment/__init__.py +0 -0
  123. {orionis-0.47.0 → orionis-0.52.0}/orionis/luminate/facades/files/__init__.py +0 -0
  124. {orionis-0.47.0 → orionis-0.52.0}/orionis/luminate/facades/log/__init__.py +0 -0
  125. {orionis-0.47.0 → orionis-0.52.0}/orionis/luminate/facades/log/log_facade.py +0 -0
  126. {orionis-0.47.0 → orionis-0.52.0}/orionis/luminate/facades/tests/__init__.py +0 -0
  127. {orionis-0.47.0 → orionis-0.52.0}/orionis/luminate/facades/tests/tests_facade.py +0 -0
  128. {orionis-0.47.0 → orionis-0.52.0}/orionis/luminate/patterns/__init__.py +0 -0
  129. {orionis-0.47.0 → orionis-0.52.0}/orionis/luminate/patterns/singleton.py +0 -0
  130. {orionis-0.47.0 → orionis-0.52.0}/orionis/luminate/pipelines/__init__.py +0 -0
  131. {orionis-0.47.0 → orionis-0.52.0}/orionis/luminate/pipelines/cli_pipeline.py +0 -0
  132. {orionis-0.47.0 → orionis-0.52.0}/orionis/luminate/providers/__init__.py +0 -0
  133. {orionis-0.47.0 → orionis-0.52.0}/orionis/luminate/providers/config/__init__.py +0 -0
  134. {orionis-0.47.0 → orionis-0.52.0}/orionis/luminate/providers/config/config_service_provider.py +0 -0
  135. {orionis-0.47.0/orionis/luminate/providers/files → orionis-0.52.0/orionis/luminate/providers/log}/__init__.py +0 -0
  136. {orionis-0.47.0 → orionis-0.52.0}/orionis/luminate/providers/log/log_service_provider.py +0 -0
  137. {orionis-0.47.0/orionis/luminate/providers/log → orionis-0.52.0/orionis/luminate/services}/__init__.py +0 -0
  138. {orionis-0.47.0/orionis/luminate/services → orionis-0.52.0/orionis/luminate/services/config}/__init__.py +0 -0
  139. {orionis-0.47.0 → orionis-0.52.0}/orionis/luminate/services/config/config_service.py +0 -0
  140. {orionis-0.47.0/orionis/luminate/services/config → orionis-0.52.0/orionis/luminate/services/files}/__init__.py +0 -0
  141. {orionis-0.47.0/orionis/luminate/services/files → orionis-0.52.0/orionis/luminate/services/log}/__init__.py +0 -0
  142. {orionis-0.47.0 → orionis-0.52.0}/orionis/luminate/services/log/log_service.py +0 -0
  143. {orionis-0.47.0 → orionis-0.52.0}/orionis/luminate/support/dot_dict.py +0 -0
  144. {orionis-0.47.0 → orionis-0.52.0}/orionis/luminate/support/exception_to_dict.py +0 -0
  145. {orionis-0.47.0 → orionis-0.52.0}/orionis/luminate/support/reflection.py +0 -0
  146. {orionis-0.47.0 → orionis-0.52.0}/orionis/luminate/support/std.py +0 -0
  147. {orionis-0.47.0/orionis/luminate/services/log → orionis-0.52.0/orionis/luminate/test}/__init__.py +0 -0
  148. {orionis-0.47.0 → orionis-0.52.0}/orionis/luminate/test/exception.py +0 -0
  149. {orionis-0.47.0 → orionis-0.52.0}/orionis/luminate/test/unit_test.py +0 -0
  150. {orionis-0.47.0 → orionis-0.52.0}/orionis/static/bg/galaxy.jpg +0 -0
  151. {orionis-0.47.0 → orionis-0.52.0}/orionis/static/favicon/OrionisFrameworkFavicon.png +0 -0
  152. {orionis-0.47.0 → orionis-0.52.0}/orionis/static/logos/OrionisFramework.jpg +0 -0
  153. {orionis-0.47.0 → orionis-0.52.0}/orionis/static/logos/OrionisFramework.png +0 -0
  154. {orionis-0.47.0 → orionis-0.52.0}/orionis/static/logos/OrionisFramework.psd +0 -0
  155. {orionis-0.47.0 → orionis-0.52.0}/orionis/static/logos/OrionisFramework2.png +0 -0
  156. {orionis-0.47.0 → orionis-0.52.0}/orionis/static/logos/OrionisFramework3.png +0 -0
  157. {orionis-0.47.0 → orionis-0.52.0}/orionis.egg-info/dependency_links.txt +0 -0
  158. {orionis-0.47.0 → orionis-0.52.0}/orionis.egg-info/entry_points.txt +0 -0
  159. {orionis-0.47.0 → orionis-0.52.0}/orionis.egg-info/requires.txt +0 -0
  160. {orionis-0.47.0 → orionis-0.52.0}/orionis.egg-info/top_level.txt +0 -0
  161. {orionis-0.47.0 → orionis-0.52.0}/setup.cfg +0 -0
  162. {orionis-0.47.0 → orionis-0.52.0}/setup.py +0 -0
  163. {orionis-0.47.0/orionis/luminate/test → orionis-0.52.0/tests}/__init__.py +0 -0
  164. {orionis-0.47.0/tests → orionis-0.52.0/tests/tools}/__init__.py +0 -0
  165. {orionis-0.47.0 → orionis-0.52.0}/tests/tools/class_example.py +0 -0
  166. {orionis-0.47.0 → orionis-0.52.0}/tests/tools/test_reflection.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: orionis
3
- Version: 0.47.0
3
+ Version: 0.52.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
  from abc import ABC, abstractmethod
2
2
 
3
- class IEnvironment(ABC):
3
+ class IEnv(ABC):
4
4
 
5
5
  @abstractmethod
6
6
  def _initialize(self, path: str = None):
@@ -5,7 +5,7 @@
5
5
  NAME = "orionis"
6
6
 
7
7
  # Current version of the framework
8
- VERSION = "0.47.0"
8
+ VERSION = "0.52.0"
9
9
 
10
10
  # Full name of the author or maintainer of the project
11
11
  AUTHOR = "Raul Mauricio Uñate Castro"
@@ -56,7 +56,6 @@ class InstallerOutput(IInstallerOutput):
56
56
 
57
57
  If the ASCII art file is found, placeholders are replaced with dynamic content such as version, docs, and year.
58
58
  """
59
- print("\n")
60
59
 
61
60
  try:
62
61
  # Try loading and printing ASCII art from the file
@@ -80,8 +79,6 @@ class InstallerOutput(IInstallerOutput):
80
79
  print(f"Version: {VERSION}")
81
80
  print(f"Docs: {DOCS}")
82
81
 
83
- print("\n")
84
-
85
82
  @staticmethod
86
83
  def asciiInfo():
87
84
  """
@@ -91,8 +88,6 @@ class InstallerOutput(IInstallerOutput):
91
88
 
92
89
  Similar to `asciiIco()`, but with different ASCII art.
93
90
  """
94
- print("\n")
95
-
96
91
  try:
97
92
  # Try loading and printing ASCII art from the file
98
93
  dir_path = os.path.dirname(__file__)
@@ -125,8 +120,6 @@ class InstallerOutput(IInstallerOutput):
125
120
  print(f"Version: {VERSION}")
126
121
  print(f"Docs: {DOCS}")
127
122
 
128
- print("\n")
129
-
130
123
  @staticmethod
131
124
  def startInstallation():
132
125
  """
@@ -134,7 +127,7 @@ class InstallerOutput(IInstallerOutput):
134
127
  This includes a welcoming message and the ASCII art.
135
128
  """
136
129
  InstallerOutput.asciiIco()
137
- print(f'\u001b[32m{NAME}\u001b[0m: Thank you for using the framework!')
130
+ print(f'\u001b[32mThank you for using the framework!\u001b[0m')
138
131
 
139
132
  @staticmethod
140
133
  def endInstallation():
@@ -142,8 +135,8 @@ class InstallerOutput(IInstallerOutput):
142
135
  Displays the ending message after the installation is complete.
143
136
  Provides a message of encouragement to start using the framework.
144
137
  """
145
- print(f'\u001b[32m{NAME}\u001b[0m: Welcome aboard, the journey starts now. Let your imagination soar!')
146
- print("\n")
138
+ print(f'\u001b[32mWelcome aboard, the journey starts now. Let your imagination soar!\u001b[0m')
139
+ print("-------------------------------------------")
147
140
 
148
141
  @staticmethod
149
142
  def info(message: str = ''):
@@ -0,0 +1,19 @@
1
+ import traceback
2
+ from orionis.luminate.container.container import Container
3
+ from orionis.luminate.bootstrap.config_bootstrapper import ConfigBootstrapper
4
+ from orionis.luminate.patterns.singleton import SingletonMeta
5
+
6
+ class Application(metaclass=SingletonMeta):
7
+
8
+ def __init__(self):
9
+ self.container = Container()
10
+ self.container.instance(self.container)
11
+ self._bootstraping()
12
+
13
+ def _bootstraping(self):
14
+ config_bootstrapper = self.container.singleton(ConfigBootstrapper)
15
+ config = self.container.make(config_bootstrapper)
16
+ print(config)
17
+
18
+ def isBooted(self):
19
+ return True
@@ -1,19 +1,61 @@
1
1
  import os
2
+ import threading
2
3
  from pathlib import Path
3
4
  from dotenv import set_key, unset_key, dotenv_values
4
- from orionis.contracts.support.i_environment import IEnvironment
5
- from orionis.luminate.patterns.singleton import SingletonMeta
6
-
7
- class Environment(IEnvironment, metaclass=SingletonMeta):
8
-
9
- def __init__(self, path: str = None):
5
+ from orionis.contracts.facades.environment.i_environment_facade import IEnv
6
+
7
+ def env(key: str, default=None) -> str:
8
+ """
9
+ Retrieves the value of an environment variable.
10
+
11
+ This function provides a convenient way to access environment variables
12
+ stored in the application context. If the variable does not exist, it
13
+ returns the specified default value.
14
+
15
+ Parameters
16
+ ----------
17
+ key : str
18
+ The name of the environment variable to retrieve.
19
+ default : Any, optional
20
+ The default value to return if the environment variable does not exist.
21
+ Defaults to None.
22
+
23
+ Returns
24
+ -------
25
+ str
26
+ The value of the environment variable, or the default value if the variable
27
+ does not exist.
28
+ """
29
+ return Environment().get(key, default)
30
+
31
+ class Environment(IEnv):
32
+ """
33
+ A thread-safe singleton class that manages environment variables from a .env file.
34
+ """
35
+
36
+ _instance = None
37
+ _lock = threading.Lock()
38
+
39
+ def __new__(cls, path: str = None):
10
40
  """
11
- Initialize the environment configuration.
41
+ Override the __new__ method to ensure only one instance of the class is created.
12
42
 
13
- Args:
14
- path (str, optional): The path to the configuration file. Defaults to None.
43
+ Parameters
44
+ ----------
45
+ path : str, optional
46
+ The path to the .env file. Defaults to None.
47
+
48
+ Returns
49
+ -------
50
+ Environment
51
+ The singleton instance of the Environment class.
15
52
  """
16
- self._initialize(path)
53
+ # Use the lock to ensure thread-safe instantiation
54
+ with cls._lock:
55
+ if cls._instance is None:
56
+ cls._instance = super().__new__(cls)
57
+ cls._instance._initialize(path)
58
+ return cls._instance
17
59
 
18
60
  def _initialize(self, path: str = None):
19
61
  """
@@ -25,7 +67,6 @@ class Environment(IEnvironment, metaclass=SingletonMeta):
25
67
  path : str, optional
26
68
  Path to the .env file. Defaults to None.
27
69
  """
28
-
29
70
  # Set the path to the .env file
30
71
  self.path = Path(path) if path else Path(os.getcwd()) / ".env"
31
72
 
@@ -50,7 +91,6 @@ class Environment(IEnvironment, metaclass=SingletonMeta):
50
91
  str
51
92
  The value of the environment variable or the default value.
52
93
  """
53
-
54
94
  # Get the value from the .env file
55
95
  value = dotenv_values(self.path).get(key)
56
96
 
@@ -68,7 +108,6 @@ class Environment(IEnvironment, metaclass=SingletonMeta):
68
108
  value : str
69
109
  The value to set.
70
110
  """
71
-
72
111
  # Set the value in the .env file
73
112
  set_key(str(self.path), key, value)
74
113
 
@@ -81,7 +120,6 @@ class Environment(IEnvironment, metaclass=SingletonMeta):
81
120
  key : str
82
121
  The key of the environment variable to remove.
83
122
  """
84
-
85
123
  # Remove the key from the .env file
86
124
  unset_key(str(self.path), key)
87
125
 
@@ -94,6 +132,5 @@ class Environment(IEnvironment, metaclass=SingletonMeta):
94
132
  dict
95
133
  A dictionary of all environment variables and their values.
96
134
  """
97
-
98
135
  # Return all environment variables
99
136
  return dotenv_values(self.path)
@@ -1,6 +1,5 @@
1
1
  import os
2
2
  from orionis.contracts.facades.files.i_path_facade import IPath
3
- from orionis.luminate.app_context import AppContext
4
3
  from orionis.luminate.services.files.path_service import PathService
5
4
 
6
5
  class Path(IPath):
@@ -66,9 +65,7 @@ class Path(IPath):
66
65
  route = os.path.normpath(route)
67
66
 
68
67
  # Obtain the path service from the container
69
- with AppContext() as app:
70
- path_service : PathService = app.container.make(PathService)
71
- return path_service.resolve(route)
68
+ PathService().resolve(route)
72
69
 
73
70
  @staticmethod
74
71
  def app(file: str = None):
@@ -1,10 +1,11 @@
1
1
  import os
2
+ import threading
2
3
  from pathlib import Path
3
4
  from orionis.contracts.services.files.i_path_service import IPathService
4
5
 
5
6
  class PathService(IPathService):
6
7
  """
7
- A service class for resolving and validating absolute paths.
8
+ A thread-safe singleton class for resolving and validating absolute paths.
8
9
 
9
10
  This class resolves the absolute path for a given relative directory or file path
10
11
  based on the script's execution directory. It ensures that the requested path is valid
@@ -12,29 +13,37 @@ class PathService(IPathService):
12
13
 
13
14
  Attributes
14
15
  ----------
16
+ base_path : Path
17
+ The base path (current working directory) used for resolving relative paths.
15
18
  route : str
16
19
  The resolved absolute path to the directory or file.
17
-
18
- Methods
19
- -------
20
- __init__(route: str)
21
- Initializes the `PathService` and resolves the absolute path.
22
- resolve() -> str
23
- Returns the resolved absolute path as a string.
24
- __str__() -> str
25
- Returns the resolved absolute path as a string (dunder method).
26
20
  """
27
21
 
28
- def __init__(self) -> None:
22
+ _instance = None
23
+ _lock = threading.Lock()
24
+
25
+ def __new__(cls):
26
+ """
27
+ Override the __new__ method to ensure only one instance of the class is created.
28
+
29
+ Returns
30
+ -------
31
+ PathService
32
+ The singleton instance of the PathService class.
29
33
  """
30
- Initializes the `PathService` and resolves the absolute path for a given relative path.
34
+ # Use the lock to ensure thread-safe instantiation
35
+ with cls._lock:
36
+ if cls._instance is None:
37
+ cls._instance = super().__new__(cls)
38
+ cls._instance._initialize()
39
+ return cls._instance
31
40
 
32
- The path is resolved relative to the script's execution directory. It validates
33
- that the resolved path exists and is either a directory or a file.
41
+ def _initialize(self):
42
+ """
43
+ Initializes the instance by setting the base path to the current working directory.
34
44
  """
35
45
  self.base_path = Path(os.getcwd())
36
46
 
37
-
38
47
  def resolve(self, route: str) -> str:
39
48
  """
40
49
  Resolves and returns the absolute path as a string.
@@ -58,7 +67,6 @@ class PathService(IPathService):
58
67
  ValueError
59
68
  If the resolved path does not exist or is neither a directory nor a file.
60
69
  """
61
-
62
70
  # Combine base path with the relative route
63
71
  real_path = (self.base_path / route).resolve()
64
72
 
@@ -68,4 +76,16 @@ class PathService(IPathService):
68
76
  if not (real_path.is_dir() or real_path.is_file()):
69
77
  raise ValueError(f"The requested path is neither a directory nor a file: {real_path}")
70
78
 
71
- self.route = str(real_path)
79
+ self.route = str(real_path)
80
+ return self.route
81
+
82
+ def __str__(self) -> str:
83
+ """
84
+ Returns the resolved absolute path as a string (dunder method).
85
+
86
+ Returns
87
+ -------
88
+ str
89
+ The absolute path to the directory or file.
90
+ """
91
+ return self.route
@@ -0,0 +1,12 @@
1
+ ___________________________________________
2
+ ___ _ _
3
+ / _ \ _ __(_) ___ _ __ (_)___
4
+ | | | | '__| |/ _ \| '_ \| / __|
5
+ | |_| | | | | (_) | | | | \__ \
6
+ \___/|_| |_|\___/|_| |_|_|___/
7
+ {{message}}
8
+ -------------------------------------------
9
+ Orionis Team © 2023 - {{year}}
10
+ Version: {{version}}
11
+ Docs: {{docs}}
12
+ -------------------------------------------
@@ -0,0 +1,14 @@
1
+ ___________________________________________
2
+ ___ _ _
3
+ / _ \ _ __(_) ___ _ __ (_)___
4
+ | | | | '__| |/ _ \| '_ \| / __|
5
+ | |_| | | | | (_) | | | | \__ \
6
+ \___/|_| |_|\___/|_| |_|_|___/
7
+ {{message}}
8
+ -------------------------------------------
9
+ {{commands}}
10
+ -------------------------------------------
11
+ Orionis Team © 2023 - {{year}}
12
+ Version: {{version}}
13
+ Docs: {{docs}}
14
+ -------------------------------------------
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: orionis
3
- Version: 0.47.0
3
+ Version: 0.52.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
@@ -56,7 +56,6 @@ orionis/contracts/services/files/__init__.py
56
56
  orionis/contracts/services/files/i_path_service.py
57
57
  orionis/contracts/services/log/__init__.py
58
58
  orionis/contracts/services/log/i_log_service.py
59
- orionis/contracts/support/i_environment.py
60
59
  orionis/contracts/support/i_exception_to_dict.py
61
60
  orionis/contracts/support/i_reflection.py
62
61
  orionis/contracts/support/i_std.py
@@ -79,7 +78,6 @@ orionis/luminate/config/cache.py
79
78
  orionis/luminate/config/cors.py
80
79
  orionis/luminate/config/database.py
81
80
  orionis/luminate/config/filesystems.py
82
- orionis/luminate/config/helpers.py
83
81
  orionis/luminate/config/logging.py
84
82
  orionis/luminate/config/mail.py
85
83
  orionis/luminate/config/queue.py
@@ -127,8 +125,6 @@ orionis/luminate/pipelines/cli_pipeline.py
127
125
  orionis/luminate/providers/__init__.py
128
126
  orionis/luminate/providers/config/__init__.py
129
127
  orionis/luminate/providers/config/config_service_provider.py
130
- orionis/luminate/providers/files/__init__.py
131
- orionis/luminate/providers/files/path_service_provider.py
132
128
  orionis/luminate/providers/log/__init__.py
133
129
  orionis/luminate/providers/log/log_service_provider.py
134
130
  orionis/luminate/services/__init__.py
@@ -139,7 +135,6 @@ orionis/luminate/services/files/path_service.py
139
135
  orionis/luminate/services/log/__init__.py
140
136
  orionis/luminate/services/log/log_service.py
141
137
  orionis/luminate/support/dot_dict.py
142
- orionis/luminate/support/environment.py
143
138
  orionis/luminate/support/exception_to_dict.py
144
139
  orionis/luminate/support/reflection.py
145
140
  orionis/luminate/support/std.py
@@ -1,40 +0,0 @@
1
-
2
- from abc import ABC, abstractmethod
3
-
4
- class IEnv(ABC):
5
- """
6
- A facade class for accessing environment variables.
7
-
8
- This class provides a static method to retrieve environment variables
9
- stored in the application context. It implements the `IEnv` interface.
10
-
11
- Methods
12
- -------
13
- get(key: str, default=None) -> str
14
- Retrieves the value of an environment variable.
15
- """
16
-
17
- @abstractmethod
18
- def get(key: str, default=None) -> str:
19
- """
20
- Retrieves the value of an environment variable.
21
-
22
- This method provides a convenient way to access environment variables
23
- stored in the application context. If the variable does not exist, it
24
- returns the specified default value.
25
-
26
- Parameters
27
- ----------
28
- key : str
29
- The name of the environment variable to retrieve.
30
- default : Any, optional
31
- The default value to return if the environment variable does not exist.
32
- Defaults to None.
33
-
34
- Returns
35
- -------
36
- str
37
- The value of the environment variable, or the default value if the variable
38
- does not exist.
39
- """
40
- pass
@@ -1,103 +0,0 @@
1
- import traceback
2
- from orionis.luminate.container.container import Container
3
- from orionis.luminate.bootstrap.config_bootstrapper import Bootstrapper as BootstrapperConfig
4
- from orionis.luminate.patterns.singleton import SingletonMeta
5
-
6
- class Application(metaclass=SingletonMeta):
7
- """
8
- The main service container for the Orionis Framework, ensuring persistent dependency resolution.
9
-
10
- This class acts as a singleton service container, similar to Laravel's Application class.
11
- It maintains service bindings, ensures proper initialization, and prevents unnecessary re-instantiation.
12
-
13
- Attributes
14
- ----------
15
- container : Container
16
- The IoC container that holds all service bindings.
17
- booted : bool
18
- Indicates whether the application has been initialized.
19
- error_info : tuple or None
20
- Stores error information if an exception occurs during boot.
21
-
22
- Methods
23
- -------
24
- boot()
25
- Initializes the application and registers all necessary dependencies.
26
- isBooted()
27
- Checks if the application is currently running.
28
- getError()
29
- Retrieves stored error information, if any.
30
- """
31
-
32
- def __init__(self):
33
- """Initializes the application with an empty dependency container."""
34
- self.container = Container()
35
- self.booted = False
36
- self.error_info = None
37
-
38
- self._config = {}
39
-
40
- def register(self):
41
- """
42
- Registers all necessary service bindings with the application container.
43
-
44
- This method is intended to be overridden by the user to define custom service bindings.
45
- """
46
- pass
47
-
48
- def boot(self):
49
- """
50
- Boots the application and registers necessary dependencies.
51
-
52
- This method ensures that all required services are bound to the container and instantiated.
53
- If the application is already booted, it returns immediately.
54
-
55
- Returns
56
- -------
57
- Application
58
- The current instance of the application.
59
-
60
- Raises
61
- ------
62
- Exception
63
- If an error occurs during the boot process.
64
- """
65
- if self.booted:
66
- return self
67
-
68
- try:
69
- # Config Bootstrapper and retrieve application configuration
70
- boot_config = self.container.singleton(BootstrapperConfig)
71
- app_config = self.container.make(boot_config)
72
- self._config = app_config.get()
73
-
74
- self.booted = True
75
- return self
76
-
77
- except Exception as e:
78
- # Capture and store exception details
79
- self.error_info = (e, traceback.format_exc())
80
- raise
81
-
82
- def isBooted(self):
83
- """
84
- Checks if the application has been successfully initialized.
85
-
86
- Returns
87
- -------
88
- bool
89
- True if the application has been booted, False otherwise.
90
- """
91
- return self.booted
92
-
93
- def getError(self):
94
- """
95
- Retrieves the last stored error details.
96
-
97
- Returns
98
- -------
99
- tuple or None
100
- A tuple containing the exception instance and its formatted traceback if an error occurred;
101
- otherwise, None.
102
- """
103
- return self.error_info
@@ -1,20 +0,0 @@
1
- from orionis.luminate.support.environment import Environment
2
-
3
- def env(key: str, default=None) -> str:
4
- """
5
- Retrieves the value of an environment variable from the .env file
6
- or from system environment variables if not found.
7
-
8
- Parameters
9
- ----------
10
- key : str
11
- The key of the environment variable.
12
- default : optional
13
- Default value if the key does not exist. Defaults to None.
14
-
15
- Returns
16
- -------
17
- str
18
- The value of the environment variable or the default value.
19
- """
20
- return Environment().get(key, default)
@@ -1,68 +0,0 @@
1
- from orionis.contracts.facades.environment.i_environment_facade import IEnv
2
- from orionis.luminate.app_context import AppContext
3
-
4
- def env(key: str, default=None) -> str:
5
- """
6
- Retrieves the value of an environment variable.
7
-
8
- This function provides a convenient way to access environment variables
9
- stored in the application context. If the variable does not exist, it
10
- returns the specified default value.
11
-
12
- Parameters
13
- ----------
14
- key : str
15
- The name of the environment variable to retrieve.
16
- default : Any, optional
17
- The default value to return if the environment variable does not exist.
18
- Defaults to None.
19
-
20
- Returns
21
- -------
22
- str
23
- The value of the environment variable, or the default value if the variable
24
- does not exist.
25
- """
26
- with AppContext() as app:
27
- env : dict = app._environment_vars
28
- return env.get(key, default)
29
-
30
- class Env(IEnv):
31
- """
32
- A facade class for accessing environment variables.
33
-
34
- This class provides a static method to retrieve environment variables
35
- stored in the application context. It implements the `IEnv` interface.
36
-
37
- Methods
38
- -------
39
- get(key: str, default=None) -> str
40
- Retrieves the value of an environment variable.
41
- """
42
-
43
- @staticmethod
44
- def get(key: str, default=None) -> str:
45
- """
46
- Retrieves the value of an environment variable.
47
-
48
- This method provides a convenient way to access environment variables
49
- stored in the application context. If the variable does not exist, it
50
- returns the specified default value.
51
-
52
- Parameters
53
- ----------
54
- key : str
55
- The name of the environment variable to retrieve.
56
- default : Any, optional
57
- The default value to return if the environment variable does not exist.
58
- Defaults to None.
59
-
60
- Returns
61
- -------
62
- str
63
- The value of the environment variable, or the default value if the variable
64
- does not exist.
65
- """
66
- with AppContext() as app:
67
- env : dict = app._environment_vars
68
- return env.get(key, default)
@@ -1,26 +0,0 @@
1
- from orionis.contracts.providers.i_service_provider import IServiceProvider
2
- from orionis.luminate.container.container import Container
3
- from orionis.luminate.services.files.path_service import PathService
4
-
5
- class PathServiceProvider(IServiceProvider):
6
-
7
- def register(self, container: Container) -> None:
8
- """
9
- Registers services or bindings into the given container.
10
-
11
- Args:
12
- container (Container): The container to register services or bindings into.
13
- """
14
- self.key_sp = container.singleton(PathService)
15
-
16
- def boot(self, container: Container) -> None:
17
- """
18
- Boot the service provider.
19
-
20
- This method is intended to be overridden by subclasses to perform
21
- any necessary bootstrapping or initialization tasks.
22
-
23
- Args:
24
- container (Container): The service container instance.
25
- """
26
- container.make(self.key_sp)
@@ -1,11 +0,0 @@
1
- -------------------------------------------
2
- ██████ ██████ ██ ██████ ███ ██ ██ ███████
3
- ██ ██ ██ ██ ██ ██ ██ ████ ██ ██ ██
4
- ██ ██ ██████ ██ ██ ██ ██ ██ ██ ██ ███████
5
- ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
6
- ██████ ██ ██ ██ ██████ ██ ████ ██ ███████
7
- {{message}}
8
- -------------------------------------------
9
- Orionis Team © 2023 - {{year}}
10
- Version: {{version}}
11
- Docs: {{docs}}
@@ -1,13 +0,0 @@
1
- -------------------------------------------
2
- ██████ ██████ ██ ██████ ███ ██ ██ ███████
3
- ██ ██ ██ ██ ██ ██ ██ ████ ██ ██ ██
4
- ██ ██ ██████ ██ ██ ██ ██ ██ ██ ██ ███████
5
- ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
6
- ██████ ██ ██ ██ ██████ ██ ████ ██ ███████
7
- {{message}}
8
- -------------------------------------------
9
- {{commands}}
10
- -------------------------------------------
11
- Orionis Team © 2023 - {{year}}
12
- Version: {{version}}
13
- Docs: {{docs}}