orionis 0.64.0__tar.gz → 0.68.0__tar.gz

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.
Files changed (170) hide show
  1. {orionis-0.64.0/orionis.egg-info → orionis-0.68.0}/PKG-INFO +1 -1
  2. orionis-0.68.0/orionis/contracts/services/environment/i_environment_service.py +74 -0
  3. orionis-0.64.0/orionis/contracts/services/files/i_path_service.py → orionis-0.68.0/orionis/contracts/services/files/i_path_resolver_service.py +1 -3
  4. {orionis-0.64.0 → orionis-0.68.0}/orionis/framework.py +1 -1
  5. orionis-0.68.0/orionis/luminate/bootstrap/service_providers_bootstrapper.py +10 -0
  6. orionis-0.68.0/orionis/luminate/facades/app.py +41 -0
  7. {orionis-0.64.0 → orionis-0.68.0}/orionis/luminate/facades/config/config_facade.py +5 -7
  8. orionis-0.68.0/orionis/luminate/facades/environment/environment_facade.py +93 -0
  9. {orionis-0.64.0 → orionis-0.68.0}/orionis/luminate/facades/files/path_facade.py +4 -3
  10. {orionis-0.64.0 → orionis-0.68.0}/orionis/luminate/facades/log/log_facade.py +11 -6
  11. orionis-0.68.0/orionis/luminate/providers/config/config_service_provider.py +19 -0
  12. orionis-0.68.0/orionis/luminate/providers/environment/environment_provider.py +19 -0
  13. orionis-0.68.0/orionis/luminate/providers/log/log_service_provider.py +19 -0
  14. orionis-0.68.0/orionis/luminate/providers/service_provider.py +51 -0
  15. orionis-0.64.0/orionis/luminate/facades/environment/environment_facade.py → orionis-0.68.0/orionis/luminate/services/environment/environment_service.py +8 -48
  16. orionis-0.68.0/orionis/luminate/services/files/path_resolver_service.py +59 -0
  17. orionis-0.68.0/orionis/luminate/test/__init__.py +0 -0
  18. {orionis-0.64.0 → orionis-0.68.0/orionis.egg-info}/PKG-INFO +1 -1
  19. {orionis-0.64.0 → orionis-0.68.0}/orionis.egg-info/SOURCES.txt +11 -2
  20. orionis-0.68.0/tests/__init__.py +0 -0
  21. orionis-0.68.0/tests/tools/__init__.py +0 -0
  22. orionis-0.64.0/orionis/luminate/providers/config/config_service_provider.py +0 -26
  23. orionis-0.64.0/orionis/luminate/providers/log/log_service_provider.py +0 -26
  24. orionis-0.64.0/orionis/luminate/services/files/path_service.py +0 -91
  25. {orionis-0.64.0 → orionis-0.68.0}/LICENCE +0 -0
  26. {orionis-0.64.0 → orionis-0.68.0}/MANIFEST.in +0 -0
  27. {orionis-0.64.0 → orionis-0.68.0}/README.md +0 -0
  28. {orionis-0.64.0 → orionis-0.68.0}/orionis/__init__.py +0 -0
  29. {orionis-0.64.0 → orionis-0.68.0}/orionis/cli_manager.py +0 -0
  30. {orionis-0.64.0 → orionis-0.68.0}/orionis/contracts/__init__.py +0 -0
  31. {orionis-0.64.0 → orionis-0.68.0}/orionis/contracts/bootstrap/i_command_bootstrapper.py +0 -0
  32. {orionis-0.64.0 → orionis-0.68.0}/orionis/contracts/bootstrap/i_config_bootstrapper.py +0 -0
  33. {orionis-0.64.0 → orionis-0.68.0}/orionis/contracts/bootstrap/i_environment_bootstrapper.py +0 -0
  34. {orionis-0.64.0 → orionis-0.68.0}/orionis/contracts/config/__init__.py +0 -0
  35. {orionis-0.64.0 → orionis-0.68.0}/orionis/contracts/config/i_config.py +0 -0
  36. {orionis-0.64.0 → orionis-0.68.0}/orionis/contracts/console/__init__.py +0 -0
  37. {orionis-0.64.0 → orionis-0.68.0}/orionis/contracts/console/base/__init__.py +0 -0
  38. {orionis-0.64.0 → orionis-0.68.0}/orionis/contracts/console/base/i_command.py +0 -0
  39. {orionis-0.64.0 → orionis-0.68.0}/orionis/contracts/console/i_command_filter.py +0 -0
  40. {orionis-0.64.0 → orionis-0.68.0}/orionis/contracts/console/i_kernel.py +0 -0
  41. {orionis-0.64.0 → orionis-0.68.0}/orionis/contracts/console/i_parser.py +0 -0
  42. {orionis-0.64.0 → orionis-0.68.0}/orionis/contracts/console/i_task_manager.py +0 -0
  43. {orionis-0.64.0 → orionis-0.68.0}/orionis/contracts/console/output/__init__.py +0 -0
  44. {orionis-0.64.0 → orionis-0.68.0}/orionis/contracts/console/output/i_console.py +0 -0
  45. {orionis-0.64.0 → orionis-0.68.0}/orionis/contracts/console/output/i_executor.py +0 -0
  46. {orionis-0.64.0 → orionis-0.68.0}/orionis/contracts/console/output/i_progress_bar.py +0 -0
  47. {orionis-0.64.0 → orionis-0.68.0}/orionis/contracts/console/tasks/__init__.py +0 -0
  48. {orionis-0.64.0 → orionis-0.68.0}/orionis/contracts/console/tasks/i_schedule.py +0 -0
  49. {orionis-0.64.0 → orionis-0.68.0}/orionis/contracts/container/i_container.py +0 -0
  50. {orionis-0.64.0 → orionis-0.68.0}/orionis/contracts/container/i_types.py +0 -0
  51. {orionis-0.64.0 → orionis-0.68.0}/orionis/contracts/facades/__init__.py +0 -0
  52. {orionis-0.64.0 → orionis-0.68.0}/orionis/contracts/facades/config/__init__.py +0 -0
  53. {orionis-0.64.0 → orionis-0.68.0}/orionis/contracts/facades/config/i_config_facade.py +0 -0
  54. {orionis-0.64.0 → orionis-0.68.0}/orionis/contracts/facades/environment/__init__.py +0 -0
  55. {orionis-0.64.0 → orionis-0.68.0}/orionis/contracts/facades/environment/i_environment_facade.py +0 -0
  56. {orionis-0.64.0 → orionis-0.68.0}/orionis/contracts/facades/files/__init__.py +0 -0
  57. {orionis-0.64.0 → orionis-0.68.0}/orionis/contracts/facades/files/i_path_facade.py +0 -0
  58. {orionis-0.64.0 → orionis-0.68.0}/orionis/contracts/facades/log/__init__.py +0 -0
  59. {orionis-0.64.0 → orionis-0.68.0}/orionis/contracts/facades/log/i_log_facade.py +0 -0
  60. {orionis-0.64.0 → orionis-0.68.0}/orionis/contracts/facades/tests/__init__.py +0 -0
  61. {orionis-0.64.0 → orionis-0.68.0}/orionis/contracts/facades/tests/i_tests_facade.py +0 -0
  62. {orionis-0.64.0 → orionis-0.68.0}/orionis/contracts/installer/__init__.py +0 -0
  63. {orionis-0.64.0 → orionis-0.68.0}/orionis/contracts/installer/i_installer_manager.py +0 -0
  64. {orionis-0.64.0 → orionis-0.68.0}/orionis/contracts/installer/i_installer_output.py +0 -0
  65. {orionis-0.64.0 → orionis-0.68.0}/orionis/contracts/installer/i_installer_setup.py +0 -0
  66. {orionis-0.64.0 → orionis-0.68.0}/orionis/contracts/providers/__init__.py +0 -0
  67. {orionis-0.64.0 → orionis-0.68.0}/orionis/contracts/providers/i_service_provider.py +0 -0
  68. {orionis-0.64.0 → orionis-0.68.0}/orionis/contracts/services/__init__.py +0 -0
  69. {orionis-0.64.0 → orionis-0.68.0}/orionis/contracts/services/config/__init__.py +0 -0
  70. {orionis-0.64.0 → orionis-0.68.0}/orionis/contracts/services/config/i_config_service.py +0 -0
  71. {orionis-0.64.0/orionis/contracts/services/files → orionis-0.68.0/orionis/contracts/services/environment}/__init__.py +0 -0
  72. {orionis-0.64.0/orionis/contracts/services/log → orionis-0.68.0/orionis/contracts/services/files}/__init__.py +0 -0
  73. {orionis-0.64.0/orionis/installer → orionis-0.68.0/orionis/contracts/services/log}/__init__.py +0 -0
  74. {orionis-0.64.0 → orionis-0.68.0}/orionis/contracts/services/log/i_log_service.py +0 -0
  75. {orionis-0.64.0 → orionis-0.68.0}/orionis/contracts/support/i_exception_to_dict.py +0 -0
  76. {orionis-0.64.0 → orionis-0.68.0}/orionis/contracts/support/i_reflection.py +0 -0
  77. {orionis-0.64.0 → orionis-0.68.0}/orionis/contracts/support/i_std.py +0 -0
  78. {orionis-0.64.0/orionis/luminate → orionis-0.68.0/orionis/installer}/__init__.py +0 -0
  79. {orionis-0.64.0 → orionis-0.68.0}/orionis/installer/installer_manager.py +0 -0
  80. {orionis-0.64.0 → orionis-0.68.0}/orionis/installer/installer_output.py +0 -0
  81. {orionis-0.64.0 → orionis-0.68.0}/orionis/installer/installer_setup.py +0 -0
  82. {orionis-0.64.0/orionis/luminate/bootstrap → orionis-0.68.0/orionis/luminate}/__init__.py +0 -0
  83. {orionis-0.64.0 → orionis-0.68.0}/orionis/luminate/app.py +0 -0
  84. {orionis-0.64.0 → orionis-0.68.0}/orionis/luminate/app_context.py +0 -0
  85. {orionis-0.64.0/orionis/luminate/config → orionis-0.68.0/orionis/luminate/bootstrap}/__init__.py +0 -0
  86. {orionis-0.64.0 → orionis-0.68.0}/orionis/luminate/bootstrap/command_bootstrapper.py +0 -0
  87. {orionis-0.64.0 → orionis-0.68.0}/orionis/luminate/bootstrap/config_bootstrapper.py +0 -0
  88. {orionis-0.64.0 → orionis-0.68.0}/orionis/luminate/bootstrap/environment_bootstrapper.py +0 -0
  89. {orionis-0.64.0 → orionis-0.68.0}/orionis/luminate/bootstrap/exception_bootstrapper.py +0 -0
  90. {orionis-0.64.0/orionis/luminate/console → orionis-0.68.0/orionis/luminate/config}/__init__.py +0 -0
  91. {orionis-0.64.0 → orionis-0.68.0}/orionis/luminate/config/app.py +0 -0
  92. {orionis-0.64.0 → orionis-0.68.0}/orionis/luminate/config/auth.py +0 -0
  93. {orionis-0.64.0 → orionis-0.68.0}/orionis/luminate/config/cache.py +0 -0
  94. {orionis-0.64.0 → orionis-0.68.0}/orionis/luminate/config/cors.py +0 -0
  95. {orionis-0.64.0 → orionis-0.68.0}/orionis/luminate/config/database.py +0 -0
  96. {orionis-0.64.0 → orionis-0.68.0}/orionis/luminate/config/filesystems.py +0 -0
  97. {orionis-0.64.0 → orionis-0.68.0}/orionis/luminate/config/logging.py +0 -0
  98. {orionis-0.64.0 → orionis-0.68.0}/orionis/luminate/config/mail.py +0 -0
  99. {orionis-0.64.0 → orionis-0.68.0}/orionis/luminate/config/queue.py +0 -0
  100. {orionis-0.64.0 → orionis-0.68.0}/orionis/luminate/config/session.py +0 -0
  101. {orionis-0.64.0/orionis/luminate/console/base → orionis-0.68.0/orionis/luminate/console}/__init__.py +0 -0
  102. {orionis-0.64.0/orionis/luminate/console/commands → orionis-0.68.0/orionis/luminate/console/base}/__init__.py +0 -0
  103. {orionis-0.64.0 → orionis-0.68.0}/orionis/luminate/console/base/command.py +0 -0
  104. {orionis-0.64.0 → orionis-0.68.0}/orionis/luminate/console/command_filter.py +0 -0
  105. {orionis-0.64.0/orionis/luminate/console/exceptions → orionis-0.68.0/orionis/luminate/console/commands}/__init__.py +0 -0
  106. {orionis-0.64.0 → orionis-0.68.0}/orionis/luminate/console/commands/cache_clear.py +0 -0
  107. {orionis-0.64.0 → orionis-0.68.0}/orionis/luminate/console/commands/help.py +0 -0
  108. {orionis-0.64.0 → orionis-0.68.0}/orionis/luminate/console/commands/schedule_work.py +0 -0
  109. {orionis-0.64.0 → orionis-0.68.0}/orionis/luminate/console/commands/tests.py +0 -0
  110. {orionis-0.64.0 → orionis-0.68.0}/orionis/luminate/console/commands/version.py +0 -0
  111. {orionis-0.64.0/orionis/luminate/console/output → orionis-0.68.0/orionis/luminate/console/exceptions}/__init__.py +0 -0
  112. {orionis-0.64.0 → orionis-0.68.0}/orionis/luminate/console/exceptions/cli_exception.py +0 -0
  113. {orionis-0.64.0 → orionis-0.68.0}/orionis/luminate/console/kernel.py +0 -0
  114. {orionis-0.64.0/orionis/luminate/console/tasks → orionis-0.68.0/orionis/luminate/console/output}/__init__.py +0 -0
  115. {orionis-0.64.0 → orionis-0.68.0}/orionis/luminate/console/output/console.py +0 -0
  116. {orionis-0.64.0 → orionis-0.68.0}/orionis/luminate/console/output/executor.py +0 -0
  117. {orionis-0.64.0 → orionis-0.68.0}/orionis/luminate/console/output/progress_bar.py +0 -0
  118. {orionis-0.64.0 → orionis-0.68.0}/orionis/luminate/console/output/styles.py +0 -0
  119. {orionis-0.64.0 → orionis-0.68.0}/orionis/luminate/console/parser.py +0 -0
  120. {orionis-0.64.0 → orionis-0.68.0}/orionis/luminate/console/runner.py +0 -0
  121. {orionis-0.64.0/orionis/luminate/facades → orionis-0.68.0/orionis/luminate/console/tasks}/__init__.py +0 -0
  122. {orionis-0.64.0 → orionis-0.68.0}/orionis/luminate/console/tasks/scheduler.py +0 -0
  123. {orionis-0.64.0 → orionis-0.68.0}/orionis/luminate/container/container.py +0 -0
  124. {orionis-0.64.0 → orionis-0.68.0}/orionis/luminate/container/exception.py +0 -0
  125. {orionis-0.64.0 → orionis-0.68.0}/orionis/luminate/container/types.py +0 -0
  126. {orionis-0.64.0/orionis/luminate/facades/config → orionis-0.68.0/orionis/luminate/facades}/__init__.py +0 -0
  127. {orionis-0.64.0/orionis/luminate/facades/environment → orionis-0.68.0/orionis/luminate/facades/config}/__init__.py +0 -0
  128. {orionis-0.64.0/orionis/luminate/facades/files → orionis-0.68.0/orionis/luminate/facades/environment}/__init__.py +0 -0
  129. {orionis-0.64.0/orionis/luminate/facades/log → orionis-0.68.0/orionis/luminate/facades/files}/__init__.py +0 -0
  130. {orionis-0.64.0/orionis/luminate/facades/tests → orionis-0.68.0/orionis/luminate/facades/log}/__init__.py +0 -0
  131. {orionis-0.64.0/orionis/luminate/patterns → orionis-0.68.0/orionis/luminate/facades/tests}/__init__.py +0 -0
  132. {orionis-0.64.0 → orionis-0.68.0}/orionis/luminate/facades/tests/tests_facade.py +0 -0
  133. {orionis-0.64.0/orionis/luminate/pipelines → orionis-0.68.0/orionis/luminate/patterns}/__init__.py +0 -0
  134. {orionis-0.64.0 → orionis-0.68.0}/orionis/luminate/patterns/singleton.py +0 -0
  135. {orionis-0.64.0/orionis/luminate/providers → orionis-0.68.0/orionis/luminate/pipelines}/__init__.py +0 -0
  136. {orionis-0.64.0 → orionis-0.68.0}/orionis/luminate/pipelines/cli_pipeline.py +0 -0
  137. {orionis-0.64.0/orionis/luminate/providers/config → orionis-0.68.0/orionis/luminate/providers}/__init__.py +0 -0
  138. {orionis-0.64.0/orionis/luminate/providers/log → orionis-0.68.0/orionis/luminate/providers/config}/__init__.py +0 -0
  139. {orionis-0.64.0/orionis/luminate/services → orionis-0.68.0/orionis/luminate/providers/environment}/__init__.py +0 -0
  140. {orionis-0.64.0/orionis/luminate/services/config → orionis-0.68.0/orionis/luminate/providers/log}/__init__.py +0 -0
  141. {orionis-0.64.0/orionis/luminate/services/files → orionis-0.68.0/orionis/luminate/services}/__init__.py +0 -0
  142. {orionis-0.64.0/orionis/luminate/services/log → orionis-0.68.0/orionis/luminate/services/config}/__init__.py +0 -0
  143. {orionis-0.64.0 → orionis-0.68.0}/orionis/luminate/services/config/config_service.py +0 -0
  144. {orionis-0.64.0/orionis/luminate/test → orionis-0.68.0/orionis/luminate/services/environment}/__init__.py +0 -0
  145. {orionis-0.64.0/tests → orionis-0.68.0/orionis/luminate/services/files}/__init__.py +0 -0
  146. {orionis-0.64.0/tests/tools → orionis-0.68.0/orionis/luminate/services/log}/__init__.py +0 -0
  147. {orionis-0.64.0 → orionis-0.68.0}/orionis/luminate/services/log/log_service.py +0 -0
  148. {orionis-0.64.0 → orionis-0.68.0}/orionis/luminate/support/dot_dict.py +0 -0
  149. {orionis-0.64.0 → orionis-0.68.0}/orionis/luminate/support/exception_to_dict.py +0 -0
  150. {orionis-0.64.0 → orionis-0.68.0}/orionis/luminate/support/reflection.py +0 -0
  151. {orionis-0.64.0 → orionis-0.68.0}/orionis/luminate/support/std.py +0 -0
  152. {orionis-0.64.0 → orionis-0.68.0}/orionis/luminate/test/exception.py +0 -0
  153. {orionis-0.64.0 → orionis-0.68.0}/orionis/luminate/test/unit_test.py +0 -0
  154. {orionis-0.64.0 → orionis-0.68.0}/orionis/static/ascii/icon.ascii +0 -0
  155. {orionis-0.64.0 → orionis-0.68.0}/orionis/static/ascii/info.ascii +0 -0
  156. {orionis-0.64.0 → orionis-0.68.0}/orionis/static/bg/galaxy.jpg +0 -0
  157. {orionis-0.64.0 → orionis-0.68.0}/orionis/static/favicon/OrionisFrameworkFavicon.png +0 -0
  158. {orionis-0.64.0 → orionis-0.68.0}/orionis/static/logos/OrionisFramework.jpg +0 -0
  159. {orionis-0.64.0 → orionis-0.68.0}/orionis/static/logos/OrionisFramework.png +0 -0
  160. {orionis-0.64.0 → orionis-0.68.0}/orionis/static/logos/OrionisFramework.psd +0 -0
  161. {orionis-0.64.0 → orionis-0.68.0}/orionis/static/logos/OrionisFramework2.png +0 -0
  162. {orionis-0.64.0 → orionis-0.68.0}/orionis/static/logos/OrionisFramework3.png +0 -0
  163. {orionis-0.64.0 → orionis-0.68.0}/orionis.egg-info/dependency_links.txt +0 -0
  164. {orionis-0.64.0 → orionis-0.68.0}/orionis.egg-info/entry_points.txt +0 -0
  165. {orionis-0.64.0 → orionis-0.68.0}/orionis.egg-info/requires.txt +0 -0
  166. {orionis-0.64.0 → orionis-0.68.0}/orionis.egg-info/top_level.txt +0 -0
  167. {orionis-0.64.0 → orionis-0.68.0}/setup.cfg +0 -0
  168. {orionis-0.64.0 → orionis-0.68.0}/setup.py +0 -0
  169. {orionis-0.64.0 → orionis-0.68.0}/tests/tools/class_example.py +0 -0
  170. {orionis-0.64.0 → orionis-0.68.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.64.0
3
+ Version: 0.68.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
@@ -0,0 +1,74 @@
1
+ from abc import ABC, abstractmethod
2
+
3
+ class IEnvironmentService(ABC):
4
+
5
+ @abstractmethod
6
+ def _initialize(self, path: str = None):
7
+ """
8
+ Initializes the instance by setting the path to the .env file.
9
+ If no path is provided, defaults to a `.env` file in the current directory.
10
+
11
+ Parameters
12
+ ----------
13
+ path : str, optional
14
+ Path to the .env file. Defaults to None.
15
+ """
16
+ pass
17
+
18
+ @abstractmethod
19
+ def get(self, key: str, default=None) -> str:
20
+ """
21
+ Retrieves the value of an environment variable from the .env file
22
+ or from system environment variables if not found.
23
+
24
+ Parameters
25
+ ----------
26
+ key : str
27
+ The key of the environment variable.
28
+ default : optional
29
+ Default value if the key does not exist. Defaults to None.
30
+
31
+ Returns
32
+ -------
33
+ str
34
+ The value of the environment variable or the default value.
35
+ """
36
+ pass
37
+
38
+ @abstractmethod
39
+ def set(self, key: str, value: str) -> None:
40
+ """
41
+ Sets the value of an environment variable in the .env file.
42
+
43
+ Parameters
44
+ ----------
45
+ key : str
46
+ The key of the environment variable.
47
+ value : str
48
+ The value to set.
49
+ """
50
+ pass
51
+
52
+ @abstractmethod
53
+ def unset(self, key: str) -> None:
54
+ """
55
+ Removes an environment variable from the .env file.
56
+
57
+ Parameters
58
+ ----------
59
+ key : str
60
+ The key of the environment variable to remove.
61
+ """
62
+ pass
63
+
64
+ @abstractmethod
65
+ def all(self) -> dict:
66
+ """
67
+ Retrieves all environment variable values from the .env file.
68
+
69
+ Returns
70
+ -------
71
+ dict
72
+ A dictionary of all environment variables and their values.
73
+ """
74
+ pass
@@ -1,8 +1,6 @@
1
- import os
2
- from pathlib import Path
3
1
  from abc import ABC, abstractmethod
4
2
 
5
- class IPathService(ABC):
3
+ class IPathResolverService(ABC):
6
4
 
7
5
  @abstractmethod
8
6
  def resolve(self, route: str) -> str:
@@ -5,7 +5,7 @@
5
5
  NAME = "orionis"
6
6
 
7
7
  # Current version of the framework
8
- VERSION = "0.64.0"
8
+ VERSION = "0.68.0"
9
9
 
10
10
  # Full name of the author or maintainer of the project
11
11
  AUTHOR = "Raul Mauricio Uñate Castro"
@@ -0,0 +1,10 @@
1
+ from orionis.luminate.container.container import Container
2
+
3
+ class ServiceProvidersBootstrapper:
4
+
5
+ def __init__(self, container : Container) -> None:
6
+ self._container = container
7
+ self._autoload()
8
+
9
+ def _autoload(self) -> None:
10
+ pass
@@ -0,0 +1,41 @@
1
+ from typing import Any
2
+ from orionis.luminate.container.container import Container
3
+ from orionis.luminate.container.exception import OrionisContainerException, OrionisContainerTypeError
4
+
5
+ def app(concrete: Any = None):
6
+ """
7
+ Retrieves the container instance or resolves a service from the container.
8
+
9
+ If a `concrete` class or service is passed, it will check if it is bound
10
+ to the container and return an instance of the service. If not bound,
11
+ an exception will be raised.
12
+
13
+ Parameters
14
+ ----------
15
+ concrete : Any, optional
16
+ The concrete service or class to resolve from the container.
17
+ If None, returns the container instance itself.
18
+
19
+ Returns
20
+ -------
21
+ Container or Any
22
+ If `concrete` is provided and bound, returns the resolved service.
23
+ If `concrete` is None, returns the container instance.
24
+
25
+ Raises
26
+ ------
27
+ OrionisContainerException
28
+ If `concrete` is not bound to the container.
29
+ """
30
+
31
+ # Create a new container instance
32
+ container : Container = Container()
33
+
34
+ # If concrete is provided (not None), attempt to resolve it from the container
35
+ if concrete is not None:
36
+ if not isinstance(concrete, type):
37
+ raise OrionisContainerTypeError(f"The provided concrete must be a class or service, got {type(concrete)}.")
38
+ return container.make(concrete)
39
+
40
+ # If concrete is None, return the container instance
41
+ return container
@@ -1,6 +1,6 @@
1
1
  from typing import Any, Optional
2
2
  from orionis.contracts.facades.config.i_config_facade import IConfig
3
- from orionis.luminate.app_context import AppContext
3
+ from orionis.luminate.facades.app import app
4
4
  from orionis.luminate.services.config.config_service import ConfigService
5
5
 
6
6
  class Config(IConfig):
@@ -17,9 +17,8 @@ class Config(IConfig):
17
17
  value : Any
18
18
  The value to set.
19
19
  """
20
- with AppContext() as app:
21
- config_service : ConfigService = app.container.make(ConfigService)
22
- config_service.set(key, value)
20
+ _config_service_provider : ConfigService = app(ConfigService)
21
+ return _config_service_provider.set(key, value)
23
22
 
24
23
  @staticmethod
25
24
  def get(key: str, default: Optional[Any] = None) -> Any:
@@ -38,6 +37,5 @@ class Config(IConfig):
38
37
  Any
39
38
  The configuration value or the default value if the key is not found.
40
39
  """
41
- with AppContext() as app:
42
- config_service : ConfigService = app.container.make(ConfigService)
43
- return config_service.get(key, default)
40
+ _config_service_provider : ConfigService = app(ConfigService)
41
+ return _config_service_provider.get(key, default)
@@ -0,0 +1,93 @@
1
+ from orionis.contracts.facades.environment.i_environment_facade import IEnv
2
+ from orionis.luminate.facades.app import app
3
+ from orionis.luminate.services.environment.environment_service import EnvironmentService
4
+
5
+ def env(key: str, default=None) -> str:
6
+ """
7
+ Retrieves the value of an environment variable.
8
+
9
+ This function provides a convenient way to access environment variables
10
+ stored in the application context. If the variable does not exist, it
11
+ returns the specified default value.
12
+
13
+ Parameters
14
+ ----------
15
+ key : str
16
+ The name of the environment variable to retrieve.
17
+ default : Any, optional
18
+ The default value to return if the environment variable does not exist.
19
+ Defaults to None.
20
+
21
+ Returns
22
+ -------
23
+ str
24
+ The value of the environment variable, or the default value if the variable
25
+ does not exist.
26
+ """
27
+ return Env.get(key, default)
28
+
29
+ class Env(IEnv):
30
+
31
+
32
+ @staticmethod
33
+ def get(key: str, default=None) -> str:
34
+ """
35
+ Retrieves the value of an environment variable from the .env file
36
+ or from system environment variables if not found.
37
+
38
+ Parameters
39
+ ----------
40
+ key : str
41
+ The key of the environment variable.
42
+ default : optional
43
+ Default value if the key does not exist. Defaults to None.
44
+
45
+ Returns
46
+ -------
47
+ str
48
+ The value of the environment variable or the default value.
49
+ """
50
+
51
+ _env_service : EnvironmentService = app(EnvironmentService)
52
+ return _env_service.get(key, default)
53
+
54
+ @staticmethod
55
+ def set(key: str, value: str) -> None:
56
+ """
57
+ Sets the value of an environment variable in the .env file.
58
+
59
+ Parameters
60
+ ----------
61
+ key : str
62
+ The key of the environment variable.
63
+ value : str
64
+ The value to set.
65
+ """
66
+ _env_service : EnvironmentService = app(EnvironmentService)
67
+ return _env_service.set(key, value)
68
+
69
+ @staticmethod
70
+ def unset(key: str) -> None:
71
+ """
72
+ Removes an environment variable from the .env file.
73
+
74
+ Parameters
75
+ ----------
76
+ key : str
77
+ The key of the environment variable to remove.
78
+ """
79
+ _env_service : EnvironmentService = app(EnvironmentService)
80
+ return _env_service.unset(key)
81
+
82
+ @staticmethod
83
+ def all() -> dict:
84
+ """
85
+ Retrieves all environment variable values from the .env file.
86
+
87
+ Returns
88
+ -------
89
+ dict
90
+ A dictionary of all environment variables and their values.
91
+ """
92
+ _env_service : EnvironmentService = app(EnvironmentService)
93
+ return _env_service.all()
@@ -1,6 +1,6 @@
1
1
  import os
2
2
  from orionis.contracts.facades.files.i_path_facade import IPath
3
- from orionis.luminate.services.files.path_service import PathService
3
+ from orionis.luminate.services.files.path_resolver_service import PathResolverService
4
4
 
5
5
  class Path(IPath):
6
6
  """
@@ -64,8 +64,9 @@ class Path(IPath):
64
64
  # Normalize path (removes redundant slashes)
65
65
  route = os.path.normpath(route)
66
66
 
67
- # Obtain the path service from the container
68
- PathService().resolve(route)
67
+ # Resolve path (Note: The service container is not used here)
68
+ path_resolver_service = PathResolverService()
69
+ return path_resolver_service.resolve(route)
69
70
 
70
71
  @staticmethod
71
72
  def app(file: str = None):
@@ -1,5 +1,5 @@
1
1
  from orionis.contracts.facades.log.i_log_facade import ILog
2
- from orionis.luminate.app_context import AppContext
2
+ from orionis.luminate.facades.app import app
3
3
  from orionis.luminate.services.log.log_service import LogguerService
4
4
 
5
5
  class Log(ILog):
@@ -34,7 +34,8 @@ class Log(ILog):
34
34
  message : str
35
35
  The message to log.
36
36
  """
37
- LogguerService().info(message)
37
+ _log_service : LogguerService = app(LogguerService)
38
+ return _log_service.info(message)
38
39
 
39
40
  @staticmethod
40
41
  def error(message: str) -> None:
@@ -46,7 +47,8 @@ class Log(ILog):
46
47
  message : str
47
48
  The message to log.
48
49
  """
49
- LogguerService().error(message)
50
+ _log_service : LogguerService = app(LogguerService)
51
+ return _log_service.error(message)
50
52
 
51
53
  @staticmethod
52
54
  def success(message: str) -> None:
@@ -58,7 +60,8 @@ class Log(ILog):
58
60
  message : str
59
61
  The message to log.
60
62
  """
61
- LogguerService().success(message)
63
+ _log_service : LogguerService = app(LogguerService)
64
+ return _log_service.success(message)
62
65
 
63
66
  @staticmethod
64
67
  def warning(message: str) -> None:
@@ -70,7 +73,8 @@ class Log(ILog):
70
73
  message : str
71
74
  The message to log.
72
75
  """
73
- LogguerService().warning(message)
76
+ _log_service : LogguerService = app(LogguerService)
77
+ return _log_service.warning(message)
74
78
 
75
79
  @staticmethod
76
80
  def debug(message: str) -> None:
@@ -82,4 +86,5 @@ class Log(ILog):
82
86
  message : str
83
87
  The message to log.
84
88
  """
85
- LogguerService().debug(message)
89
+ _log_service : LogguerService = app(LogguerService)
90
+ return _log_service.debug(message)
@@ -0,0 +1,19 @@
1
+ from orionis.luminate.providers.service_provider import ServiceProvider
2
+ from orionis.luminate.services.config.config_service import ConfigService
3
+
4
+ class ConfigServiceProvider(ServiceProvider):
5
+
6
+ def register(self,) -> None:
7
+ """
8
+ Registers services or bindings into the given container.
9
+ """
10
+ self._container_id = self.app.scoped(ConfigService)
11
+
12
+ def boot(self,) -> None:
13
+ """
14
+ Boot the service provider.
15
+
16
+ This method is intended to be overridden by subclasses to perform
17
+ any necessary bootstrapping or initialization tasks.
18
+ """
19
+ self.app.make(self._container_id)
@@ -0,0 +1,19 @@
1
+ from orionis.luminate.providers.service_provider import ServiceProvider
2
+ from orionis.luminate.services.environment.environment_service import EnvironmentService
3
+
4
+ class EnvironmentProvider(ServiceProvider):
5
+
6
+ def register(self) -> None:
7
+ """
8
+ Registers services or bindings into the given container.
9
+ """
10
+ self._container_id = self.app.singleton(EnvironmentService)
11
+
12
+ def boot(self) -> None:
13
+ """
14
+ Boot the service provider.
15
+
16
+ This method is intended to be overridden by subclasses to perform
17
+ any necessary bootstrapping or initialization tasks.
18
+ """
19
+ self.app.make(self._container_id)
@@ -0,0 +1,19 @@
1
+ from orionis.luminate.providers.service_provider import ServiceProvider
2
+ from orionis.luminate.services.log.log_service import LogguerService
3
+
4
+ class LogServiceProvider(ServiceProvider):
5
+
6
+ def register(self) -> None:
7
+ """
8
+ Registers services or bindings into the given container.
9
+ """
10
+ self._container_id = self.app.singleton(LogguerService)
11
+
12
+ def boot(self) -> None:
13
+ """
14
+ Boot the service provider.
15
+
16
+ This method is intended to be overridden by subclasses to perform
17
+ any necessary bootstrapping or initialization tasks.
18
+ """
19
+ self.app.make(self._container_id)
@@ -0,0 +1,51 @@
1
+ from orionis.contracts.providers.i_service_provider import IServiceProvider
2
+ from orionis.luminate.container.container import Container
3
+
4
+ class ServiceProvider(IServiceProvider):
5
+ """
6
+ Base class for service providers.
7
+
8
+ Parameters
9
+ ----------
10
+ container : Container
11
+ The container instance to be used by the service provider.
12
+ """
13
+
14
+ def __init__(self, app : Container) -> None:
15
+ """
16
+ Initialize the service provider with the given container.
17
+
18
+ Parameters
19
+ ----------
20
+ container : Container
21
+ The container instance to be used by the service provider.
22
+ """
23
+ self.app = app
24
+
25
+ def register(self) -> None:
26
+ """
27
+ Register services in the container.
28
+
29
+ This method should be overridden in the subclass to register
30
+ specific services.
31
+
32
+ Parameters
33
+ ----------
34
+ container : Container
35
+ The container instance where services will be registered.
36
+ """
37
+ raise NotImplementedError("This method should be overridden in the subclass")
38
+
39
+ def boot(self) -> None:
40
+ """
41
+ Boot services in the container.
42
+
43
+ This method should be overridden in the subclass to boot
44
+ specific services.
45
+
46
+ Parameters
47
+ ----------
48
+ container : Container
49
+ The container instance where services will be booted.
50
+ """
51
+ raise NotImplementedError("This method should be overridden in the subclass")
@@ -1,61 +1,21 @@
1
1
  import os
2
- import threading
3
2
  from pathlib import Path
4
3
  from dotenv import set_key, unset_key, dotenv_values
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 Env().get(key, default)
30
-
31
- class Env(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):
4
+ from orionis.contracts.services.environment.i_environment_service import IEnvironmentService
5
+
6
+ class EnvironmentService(IEnvironmentService):
7
+
8
+ def __init__(self, path: str = None):
9
+
40
10
  """
41
- Override the __new__ method to ensure only one instance of the class is created.
11
+ Initializes the EnvironmentService instance.
42
12
 
43
13
  Parameters
44
14
  ----------
45
15
  path : str, optional
46
16
  The path to the .env file. Defaults to None.
47
-
48
- Returns
49
- -------
50
- Environment
51
- The singleton instance of the Environment class.
52
17
  """
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
18
+ self._initialize(path)
59
19
 
60
20
  def _initialize(self, path: str = None):
61
21
  """
@@ -0,0 +1,59 @@
1
+ import os
2
+ import threading
3
+ from pathlib import Path
4
+ from orionis.contracts.services.files.i_path_resolver_service import IPathResolverService
5
+
6
+ class PathResolverService(IPathResolverService):
7
+
8
+ _lock = threading.Lock()
9
+ _instance = None
10
+
11
+ def __new__(cls):
12
+ """
13
+ Override the __new__ method to ensure only one instance of the class is created.
14
+
15
+ Returns
16
+ -------
17
+ PathResolverService
18
+ The singleton instance of the PathResolverService class.
19
+ """
20
+ # Use the lock to ensure thread-safe instantiation
21
+ with cls._lock:
22
+ if cls._instance is None:
23
+ cls._instance = super().__new__(cls)
24
+ cls._instance.base_path = Path(os.getcwd())
25
+ return cls._instance
26
+
27
+ def resolve(self, route: str) -> str:
28
+ """
29
+ Resolves and returns the absolute path as a string.
30
+
31
+ This method combines the base path (current working directory) with the provided
32
+ relative path, resolves it to an absolute path, and validates that it exists
33
+ and is either a directory or a file.
34
+
35
+ Parameters
36
+ ----------
37
+ route : str
38
+ The relative directory or file path to be resolved.
39
+
40
+ Returns
41
+ -------
42
+ str
43
+ The absolute path to the directory or file.
44
+
45
+ Raises
46
+ ------
47
+ PathNotFoundError
48
+ If the resolved path does not exist or is neither a directory nor a file.
49
+ """
50
+ # Combine base path with the relative route
51
+ real_path = (self.base_path / route).resolve()
52
+
53
+ # Validate that the path exists and is either a directory or a file
54
+ if not real_path.exists():
55
+ raise Exception(f"The requested path does not exist or is invalid: {real_path}")
56
+ if not (real_path.is_dir() or real_path.is_file()):
57
+ raise Exception(f"The requested path does not exist or is invalid: {real_path}")
58
+
59
+ return str(real_path)
File without changes
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: orionis
3
- Version: 0.64.0
3
+ Version: 0.68.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
@@ -52,8 +52,10 @@ orionis/contracts/providers/i_service_provider.py
52
52
  orionis/contracts/services/__init__.py
53
53
  orionis/contracts/services/config/__init__.py
54
54
  orionis/contracts/services/config/i_config_service.py
55
+ orionis/contracts/services/environment/__init__.py
56
+ orionis/contracts/services/environment/i_environment_service.py
55
57
  orionis/contracts/services/files/__init__.py
56
- orionis/contracts/services/files/i_path_service.py
58
+ orionis/contracts/services/files/i_path_resolver_service.py
57
59
  orionis/contracts/services/log/__init__.py
58
60
  orionis/contracts/services/log/i_log_service.py
59
61
  orionis/contracts/support/i_exception_to_dict.py
@@ -71,6 +73,7 @@ orionis/luminate/bootstrap/command_bootstrapper.py
71
73
  orionis/luminate/bootstrap/config_bootstrapper.py
72
74
  orionis/luminate/bootstrap/environment_bootstrapper.py
73
75
  orionis/luminate/bootstrap/exception_bootstrapper.py
76
+ orionis/luminate/bootstrap/service_providers_bootstrapper.py
74
77
  orionis/luminate/config/__init__.py
75
78
  orionis/luminate/config/app.py
76
79
  orionis/luminate/config/auth.py
@@ -108,6 +111,7 @@ orionis/luminate/container/container.py
108
111
  orionis/luminate/container/exception.py
109
112
  orionis/luminate/container/types.py
110
113
  orionis/luminate/facades/__init__.py
114
+ orionis/luminate/facades/app.py
111
115
  orionis/luminate/facades/config/__init__.py
112
116
  orionis/luminate/facades/config/config_facade.py
113
117
  orionis/luminate/facades/environment/__init__.py
@@ -123,15 +127,20 @@ orionis/luminate/patterns/singleton.py
123
127
  orionis/luminate/pipelines/__init__.py
124
128
  orionis/luminate/pipelines/cli_pipeline.py
125
129
  orionis/luminate/providers/__init__.py
130
+ orionis/luminate/providers/service_provider.py
126
131
  orionis/luminate/providers/config/__init__.py
127
132
  orionis/luminate/providers/config/config_service_provider.py
133
+ orionis/luminate/providers/environment/__init__.py
134
+ orionis/luminate/providers/environment/environment_provider.py
128
135
  orionis/luminate/providers/log/__init__.py
129
136
  orionis/luminate/providers/log/log_service_provider.py
130
137
  orionis/luminate/services/__init__.py
131
138
  orionis/luminate/services/config/__init__.py
132
139
  orionis/luminate/services/config/config_service.py
140
+ orionis/luminate/services/environment/__init__.py
141
+ orionis/luminate/services/environment/environment_service.py
133
142
  orionis/luminate/services/files/__init__.py
134
- orionis/luminate/services/files/path_service.py
143
+ orionis/luminate/services/files/path_resolver_service.py
135
144
  orionis/luminate/services/log/__init__.py
136
145
  orionis/luminate/services/log/log_service.py
137
146
  orionis/luminate/support/dot_dict.py
File without changes
File without changes