orionis 0.327.0__py3-none-any.whl → 0.329.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.
Files changed (35) hide show
  1. orionis/container/contracts/service_provider.py +30 -0
  2. orionis/container/providers/service_provider.py +2 -1
  3. orionis/metadata/framework.py +1 -1
  4. {orionis-0.327.0.dist-info → orionis-0.329.0.dist-info}/METADATA +1 -1
  5. {orionis-0.327.0.dist-info → orionis-0.329.0.dist-info}/RECORD +9 -34
  6. orionis/_facades/__init__.py +0 -0
  7. orionis/_facades/app_facade.py +0 -26
  8. orionis/_facades/commands/__init__.py +0 -0
  9. orionis/_facades/commands/commands_facade.py +0 -42
  10. orionis/_facades/commands/scheduler_facade.py +0 -38
  11. orionis/_facades/config/__init__.py +0 -0
  12. orionis/_facades/config/config_facade.py +0 -41
  13. orionis/_facades/environment/__init__.py +0 -0
  14. orionis/_facades/environment/environment_facade.py +0 -68
  15. orionis/_facades/files/__init__.py +0 -0
  16. orionis/_facades/files/path_facade.py +0 -311
  17. orionis/_facades/log/__init__.py +0 -0
  18. orionis/_facades/log/log_facade.py +0 -16
  19. orionis/_providers/__init__.py +0 -0
  20. orionis/_providers/commands/__init__.py +0 -0
  21. orionis/_providers/commands/reactor_commands_service_provider.py +0 -30
  22. orionis/_providers/commands/scheduler_provider.py +0 -11
  23. orionis/_providers/config/__init__.py +0 -0
  24. orionis/_providers/config/config_service_provider.py +0 -11
  25. orionis/_providers/environment/__init__.py +0 -0
  26. orionis/_providers/environment/environment__service_provider.py +0 -21
  27. orionis/_providers/files/__init__.py +0 -0
  28. orionis/_providers/files/paths_provider.py +0 -21
  29. orionis/_providers/log/__init__.py +0 -0
  30. orionis/_providers/log/log_service_provider.py +0 -25
  31. orionis/_providers/service_provider.py +0 -37
  32. {orionis-0.327.0.dist-info → orionis-0.329.0.dist-info}/WHEEL +0 -0
  33. {orionis-0.327.0.dist-info → orionis-0.329.0.dist-info}/licenses/LICENCE +0 -0
  34. {orionis-0.327.0.dist-info → orionis-0.329.0.dist-info}/top_level.txt +0 -0
  35. {orionis-0.327.0.dist-info → orionis-0.329.0.dist-info}/zip-safe +0 -0
@@ -0,0 +1,30 @@
1
+ from abc import ABC, abstractmethod
2
+
3
+ class IServiceProvider(ABC):
4
+
5
+ @abstractmethod
6
+ def register(self) -> None:
7
+ """
8
+ Register services into the application container.
9
+
10
+ This method must be implemented by all concrete service providers.
11
+ It should bind services, configurations, or other components
12
+ to the application container.
13
+
14
+ Raises
15
+ ------
16
+ NotImplementedError
17
+ If the method is not overridden in a subclass.
18
+ """
19
+ pass
20
+
21
+ @abstractmethod
22
+ def boot(self) -> None:
23
+ """
24
+ Perform any post-registration bootstrapping or initialization.
25
+
26
+ This method is called after all services have been registered.
27
+ Override this method to initialize services, set up event listeners,
28
+ or perform other boot-time operations.
29
+ """
30
+ pass
@@ -1,6 +1,7 @@
1
1
  from orionis.container.contracts.container import IContainer
2
+ from orionis.container.contracts.service_provider import IServiceProvider
2
3
 
3
- class ServiceProvider:
4
+ class ServiceProvider(IServiceProvider):
4
5
  """
5
6
  Base service provider class for the Orionis framework.
6
7
 
@@ -5,7 +5,7 @@
5
5
  NAME = "orionis"
6
6
 
7
7
  # Current version of the framework
8
- VERSION = "0.327.0"
8
+ VERSION = "0.329.0"
9
9
 
10
10
  # Full name of the author or maintainer of the project
11
11
  AUTHOR = "Raul Mauricio Uñate Castro"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: orionis
3
- Version: 0.327.0
3
+ Version: 0.329.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
@@ -60,19 +60,6 @@ orionis/_contracts/services/log/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm
60
60
  orionis/_contracts/services/log/log_service.py,sha256=1RD3u-a5ZDMbg7AYE8y2SW8QNRybAU3De0mEA0dAeNo,2167
61
61
  orionis/_contracts/support/exception_parse.py,sha256=P7yh5Q3KIcRPAZeg6190XbOSvu5XBK-VVt6zHxaiexw,779
62
62
  orionis/_contracts/support/reflection.py,sha256=Ht5_FsFbCb-APRXX3HdsfKl3cDZU8DyXGXPWKTn05uQ,8429
63
- orionis/_facades/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
64
- orionis/_facades/app_facade.py,sha256=4oVkGVlNoQ76nCt60CoX5oHDrFV0I5LYBNq2Iu__f9w,877
65
- orionis/_facades/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
66
- orionis/_facades/commands/commands_facade.py,sha256=3SgKq_oanNrzcXmIeVkiNcyYHtUaMti0c9XSCS0k74U,1564
67
- orionis/_facades/commands/scheduler_facade.py,sha256=iQqNQmxgOsOc2GRMs66xlUyukCOqGhHLkAiRmLrb3Q4,1437
68
- orionis/_facades/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
69
- orionis/_facades/config/config_facade.py,sha256=C5k9QAi1V8zaJUVkyPkVOlyUDVxlz__EJoSIwcUJMFQ,1358
70
- orionis/_facades/environment/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
71
- orionis/_facades/environment/environment_facade.py,sha256=74PFjb2QomfSnAnM6nXXSypxNEd2fZK6HI96zNt7LdU,2096
72
- orionis/_facades/files/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
73
- orionis/_facades/files/path_facade.py,sha256=il10n3UmmHqwwBiRapaBAXjbNEoRwhtpeMogwBtYoss,9202
74
- orionis/_facades/log/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
75
- orionis/_facades/log/log_facade.py,sha256=TjbIoaXvhstj8SXyqmuLL_xm5IN65dBBAvS_UtbgWG0,683
76
63
  orionis/_foundation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
77
64
  orionis/_foundation/console/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
78
65
  orionis/_foundation/console/command_bootstrapper.py,sha256=y8gGKzTgbHHzUFFC6jwULx1zmZbNrlOKs8Org6Z1iNY,7039
@@ -85,19 +72,6 @@ orionis/_foundation/foundation/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCe
85
72
  orionis/_foundation/foundation/config/config_bootstrapper.py,sha256=Xml0S0oqPkUPwtEvs9hZ_A_FsOU5tlFJxUDGuTkD9do,7484
86
73
  orionis/_foundation/providers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
87
74
  orionis/_foundation/providers/service_providers_bootstrapper.py,sha256=V7Yd4_GCVW83jLFMsGUGfHNRsgfEnDywgAUkH50T270,4558
88
- orionis/_providers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
89
- orionis/_providers/service_provider.py,sha256=mrxpzb2hhNTsgTYg2FHBaOStni-nq6CFG_nMkd_mOL4,1119
90
- orionis/_providers/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
91
- orionis/_providers/commands/reactor_commands_service_provider.py,sha256=MgYaWVkcm_4Pq9Rrqgw8iTBH2C4O25OAdO2VyNEN-Tw,1310
92
- orionis/_providers/commands/scheduler_provider.py,sha256=eGxOhR_mn8_Ti5RbtMW7BtNREjStkOIlZ0LmgsMguDg,461
93
- orionis/_providers/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
94
- orionis/_providers/config/config_service_provider.py,sha256=avsvHndUmvJrcdWL1j3FAQ_FTdNgMcMy8yRde0onRSk,442
95
- orionis/_providers/environment/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
96
- orionis/_providers/environment/environment__service_provider.py,sha256=O9mLSUsWRqkEXCnsKyc9s7d2q7mUoo6IZRZZ11d-M7A,855
97
- orionis/_providers/files/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
98
- orionis/_providers/files/paths_provider.py,sha256=AiRoX0Gw0FKfvy-Sk2FMvx6hU_TnmN13eIg5R__sf2U,785
99
- orionis/_providers/log/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
100
- orionis/_providers/log/log_service_provider.py,sha256=EBJd_t7N1yFR5s3HXsX1B0FH_5uHnYfxaksCjBA0jEY,971
101
75
  orionis/_services/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
102
76
  orionis/_services/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
103
77
  orionis/_services/commands/reactor_commands_service.py,sha256=cyARBmLVox8v-YHjo7XtbReJ00wJ4Oi3PMR2yX0duTM,6172
@@ -135,6 +109,7 @@ orionis/container/context/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJW
135
109
  orionis/container/context/manager.py,sha256=9yODWkHBoJ2kgJZ5ONLqcEcex50vaWuMcxsvmDgnQo4,2437
136
110
  orionis/container/context/scope.py,sha256=CWFiLLTAC_IdmeFKWX-jrphdxB0_TMEVBlz6lQVMPC8,937
137
111
  orionis/container/contracts/container.py,sha256=hOO3w2yqVhp2nPTeS1uJEYgXSTbM3xwezDCOSNMC_a0,7603
112
+ orionis/container/contracts/service_provider.py,sha256=hXp-l4iP7q0FhsCcQAKoYcJ_zxCzIgTdfmO4F0Bbssg,896
138
113
  orionis/container/entities/binding.py,sha256=Qp6Lf4XUDp2NjqXDAC2lzvhOFQWiBDKiGFcKfwb4axw,4342
139
114
  orionis/container/enums/lifetimes.py,sha256=RqQmugMIB1Ev_j_vFLcWorndm-to7xg4stQ7yKFDdDw,190
140
115
  orionis/container/exceptions/attribute_error.py,sha256=ysYKvXfunH-bywK_e02inY94s8aZ3vUZA6jATbDcQmk,480
@@ -144,7 +119,7 @@ orionis/container/exceptions/value_exception.py,sha256=hjY0YEusoL3DurME1ornxvIv1
144
119
  orionis/container/facades/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
145
120
  orionis/container/facades/facade.py,sha256=vu71_uqXnSpCFyeswPgKIhTPmIBLEK3bsy5sk4vTOEk,3306
146
121
  orionis/container/providers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
147
- orionis/container/providers/service_provider.py,sha256=rkrSxdNEi357aNs6MalOIy7-bNnb8E98fGhnBmE8GDs,1830
122
+ orionis/container/providers/service_provider.py,sha256=9SHDzeuJbktRhrLq0zo2fZhRR4xOaYGOb2wKl7iBR4k,1923
148
123
  orionis/container/validators/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
149
124
  orionis/container/validators/implements.py,sha256=iSoDxxTalQKhyKjvsojFlkROhBFvAjvJxRvPJlmGrSg,2843
150
125
  orionis/container/validators/is_abstract_class.py,sha256=Q-Lqyrrps6oj2XWI0KFRp-hDZf4_sgbZlEbfBXj5XT4,1169
@@ -246,7 +221,7 @@ orionis/foundation/contracts/config.py,sha256=Rpz6U6t8OXHO9JJKSTnCimytXE-tfCB-1i
246
221
  orionis/foundation/exceptions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
247
222
  orionis/foundation/exceptions/integrity.py,sha256=mc4pL1UMoYRHEmphnpW2oGk5URhu7DJRREyzHaV-cs8,472
248
223
  orionis/metadata/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
249
- orionis/metadata/framework.py,sha256=3pSdy6bnr8_6wagciqStvz0g2gtRfgoH6E-JRTI5p-8,4960
224
+ orionis/metadata/framework.py,sha256=6IMHwxMeJT3k5KRdt1d8bLgypdJAGfgmqwLUz5qzmGw,4960
250
225
  orionis/metadata/package.py,sha256=tqLfBRo-w1j_GN4xvzUNFyweWYFS-qhSgAEc-AmCH1M,5452
251
226
  orionis/patterns/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
252
227
  orionis/patterns/singleton/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -358,7 +333,7 @@ orionis/test/suite/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuF
358
333
  orionis/test/suite/test_unit.py,sha256=MWgW8dRCRyT1XZ5LsbXQ7-KVPReasoXwzEEL1EWWfE4,52190
359
334
  orionis/test/view/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
360
335
  orionis/test/view/render.py,sha256=jXZkbITBknbUwm_mD8bcTiwLDvsFkrO9qrf0ZgPwqxc,4903
361
- orionis-0.327.0.dist-info/licenses/LICENCE,sha256=-_4cF2EBKuYVS_SQpy1uapq0oJPUU1vl_RUWSy2jJTo,1111
336
+ orionis-0.329.0.dist-info/licenses/LICENCE,sha256=-_4cF2EBKuYVS_SQpy1uapq0oJPUU1vl_RUWSy2jJTo,1111
362
337
  tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
363
338
  tests/example/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
364
339
  tests/example/test_example.py,sha256=kvWgiW3ADEZf718dGsMPtDh_rmOSx1ypEInKm7_6ZPQ,601
@@ -459,8 +434,8 @@ tests/support/wrapper/test_services_wrapper_docdict.py,sha256=yeVwl-VcwkWSQYyxZu
459
434
  tests/testing/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
460
435
  tests/testing/test_testing_result.py,sha256=MrGK3ZimedL0b5Ydu69Dg8Iul017AzLTm7VPxpXlpfU,4315
461
436
  tests/testing/test_testing_unit.py,sha256=DjLBtvVn8B1KlVJNNkstBT8_csA1yeaMqnGrbanN_J4,7438
462
- orionis-0.327.0.dist-info/METADATA,sha256=GPE066gZMY-Rwse4II2FCF2LFnDbQQX81nenlgnP3DU,4772
463
- orionis-0.327.0.dist-info/WHEEL,sha256=Nw36Djuh_5VDukK0H78QzOX-_FQEo6V37m3nkm96gtU,91
464
- orionis-0.327.0.dist-info/top_level.txt,sha256=2bdoHgyGZhOtLAXS6Om8OCTmL24dUMC_L1quMe_ETbk,14
465
- orionis-0.327.0.dist-info/zip-safe,sha256=frcCV1k9oG9oKj3dpUqdJg1PxRT2RSN_XKdLCPjaYaY,2
466
- orionis-0.327.0.dist-info/RECORD,,
437
+ orionis-0.329.0.dist-info/METADATA,sha256=XUCnPpXe0vygTWc_kwwC_IUsiWOVP4iXBDHdjlz1e5Y,4772
438
+ orionis-0.329.0.dist-info/WHEEL,sha256=Nw36Djuh_5VDukK0H78QzOX-_FQEo6V37m3nkm96gtU,91
439
+ orionis-0.329.0.dist-info/top_level.txt,sha256=2bdoHgyGZhOtLAXS6Om8OCTmL24dUMC_L1quMe_ETbk,14
440
+ orionis-0.329.0.dist-info/zip-safe,sha256=frcCV1k9oG9oKj3dpUqdJg1PxRT2RSN_XKdLCPjaYaY,2
441
+ orionis-0.329.0.dist-info/RECORD,,
File without changes
@@ -1,26 +0,0 @@
1
- from typing import Any
2
- from orionis._application import Application
3
- from orionis._container.resolve import Resolve
4
-
5
- def app(abstract: Any = None) -> Any:
6
- """
7
- Retrieve an instance from the application container.
8
-
9
- Parameters
10
- ----------
11
- abstract : Any, optional
12
- The abstract class or interface to resolve. If None, returns the application instance.
13
-
14
- Returns
15
- -------
16
- Any
17
- The resolved instance from the container if an abstract is provided,
18
- otherwise the singleton instance of the application.
19
- """
20
-
21
- # If an abstract class or interface is provided, attempt to resolve it from the container
22
- if abstract is not None:
23
- return Resolve(abstract)
24
-
25
- # If no abstract is provided, return the singleton instance of the application container
26
- return Application.getInstance().container()
File without changes
@@ -1,42 +0,0 @@
1
- from typing import Any
2
- from orionis._contracts.facades.commands.commands_facade import ICommand
3
- from orionis._contracts.services.commands.reactor_commands_service import IReactorCommandsService
4
- from orionis._facades.app_facade import app
5
-
6
- class Command(ICommand):
7
- """
8
- Command class for managing and executing registered CLI commands.
9
-
10
- This class provides a static method to invoke commands registered in the
11
- `CacheCommands` singleton, passing the required signature and any additional
12
- parameters.
13
-
14
- Methods
15
- -------
16
- call(signature: str, vars: dict[str, Any] = {}, *args: Any, **kwargs: Any) -> Any
17
- Executes the specified command with the provided arguments.
18
- """
19
-
20
- @staticmethod
21
- def call(signature: str, vars: dict[str, Any] = {}, *args: Any, **kwargs: Any) -> Any:
22
- """
23
- Calls a registered command using the `CLIRunner`.
24
-
25
- Parameters
26
- ----------
27
- signature : str
28
- The command signature (name) to execute.
29
- vars : dict[str, Any], optional
30
- A dictionary containing named arguments for the command (default is `{}`).
31
- *args : Any
32
- Additional positional arguments.
33
- **kwargs : Any
34
- Additional keyword arguments.
35
-
36
- Returns
37
- -------
38
- Any
39
- The output of the executed command.
40
- """
41
- _commands_provider : IReactorCommandsService = app(IReactorCommandsService)
42
- return _commands_provider.execute(signature, vars, *args, **kwargs)
@@ -1,38 +0,0 @@
1
- from typing import Any
2
- from orionis._contracts.facades.commands.scheduler_facade import ISchedule
3
- from orionis._contracts.services.commands.schedule_service import IScheduleService
4
- from orionis._facades.app_facade import app
5
-
6
- class Schedule(ISchedule):
7
-
8
- @staticmethod
9
- def command(signature: str, vars: dict[str, Any] = {}, *args: Any, **kwargs: Any) -> 'IScheduleService':
10
- """
11
- Defines a Orionis command to be executed.
12
-
13
- Parameters
14
- ----------
15
- signature : str
16
- The signature of the command to execute.
17
- vars : dict, optional
18
- A dictionary of variables to pass to the command, by default an empty dictionary.
19
- *args : Any
20
- Additional positional arguments to pass to the command.
21
- **kwargs : Any
22
- Additional keyword arguments to pass to the command.
23
-
24
- Returns
25
- -------
26
- Schedule
27
- Returns the Schedule instance itself, allowing method chaining.
28
- """
29
- _scheduler_provider : IScheduleService = app(IScheduleService)
30
- return _scheduler_provider.command(signature, vars, *args, **kwargs)
31
-
32
- @staticmethod
33
- def start():
34
- """
35
- Starts the scheduler and stops automatically when there are no more jobs.
36
- """
37
- _scheduler_provider : IScheduleService = app(IScheduleService)
38
- return _scheduler_provider.start()
File without changes
@@ -1,41 +0,0 @@
1
- from typing import Any, Optional
2
- from orionis._contracts.facades.config.config_facade import IConfig
3
- from orionis._contracts.services.config.config_service import IConfigService
4
- from orionis._facades.app_facade import app
5
-
6
- class Config(IConfig):
7
-
8
- @staticmethod
9
- def set(key: str, value: Any) -> None:
10
- """
11
- Dynamically sets a configuration value using dot notation.
12
-
13
- Parameters
14
- ----------
15
- key : str
16
- The configuration key (e.g., 'app.debug').
17
- value : Any
18
- The value to set.
19
- """
20
- _config_service_provider : IConfigService = app(IConfigService)
21
- return _config_service_provider.set(key, value)
22
-
23
- @staticmethod
24
- def get(key: str, default: Optional[Any] = None) -> Any:
25
- """
26
- Retrieves a configuration value using dot notation.
27
-
28
- Parameters
29
- ----------
30
- key : str
31
- The configuration key (e.g., 'app.debug').
32
- default : Optional[Any]
33
- The default value to return if the key is not found.
34
-
35
- Returns
36
- -------
37
- Any
38
- The configuration value or the default value if the key is not found.
39
- """
40
- _config_service_provider : IConfigService = app(IConfigService)
41
- return _config_service_provider.get(key, default)
File without changes
@@ -1,68 +0,0 @@
1
- from orionis._contracts.facades.environment.environment_facade import IEnv
2
- from orionis._contracts.services.environment.environment_service import IEnvironmentService
3
- from orionis._facades.app_facade import app
4
-
5
- class Env(IEnv):
6
-
7
- @staticmethod
8
- def get(key: str, default=None) -> str:
9
- """
10
- Retrieves the value of an environment variable from the .env file
11
- or from system environment variables if not found.
12
-
13
- Parameters
14
- ----------
15
- key : str
16
- The key of the environment variable.
17
- default : optional
18
- Default value if the key does not exist. Defaults to None.
19
-
20
- Returns
21
- -------
22
- str
23
- The value of the environment variable or the default value.
24
- """
25
-
26
- _env_service : IEnvironmentService = app(IEnvironmentService)
27
- return _env_service.get(key, default)
28
-
29
- @staticmethod
30
- def set(key: str, value: str) -> None:
31
- """
32
- Sets the value of an environment variable in the .env file.
33
-
34
- Parameters
35
- ----------
36
- key : str
37
- The key of the environment variable.
38
- value : str
39
- The value to set.
40
- """
41
- _env_service : IEnvironmentService = app(IEnvironmentService)
42
- return _env_service.set(key, value)
43
-
44
- @staticmethod
45
- def unset(key: str) -> None:
46
- """
47
- Removes an environment variable from the .env file.
48
-
49
- Parameters
50
- ----------
51
- key : str
52
- The key of the environment variable to remove.
53
- """
54
- _env_service : IEnvironmentService = app(IEnvironmentService)
55
- return _env_service.unset(key)
56
-
57
- @staticmethod
58
- def all() -> dict:
59
- """
60
- Retrieves all environment variable values from the .env file.
61
-
62
- Returns
63
- -------
64
- dict
65
- A dictionary of all environment variables and their values.
66
- """
67
- _env_service : IEnvironmentService = app(IEnvironmentService)
68
- return _env_service.all()
File without changes
@@ -1,311 +0,0 @@
1
- import os
2
- from orionis._contracts.facades.files.path_facade import IPath
3
- from orionis._contracts.services.files.path_resolver_service import IPathResolverService
4
- # from orionis._services.files.path_resolver_service import PathResolverService
5
-
6
- class Path(IPath):
7
- """
8
- A facade class for resolving absolute paths to various application directories.
9
-
10
- This class provides static methods to resolve paths to common directories such as
11
- 'app', 'config', 'database', 'resources', 'routes', 'storage', and 'tests'.
12
- It uses the `PathService` to resolve and validate paths.
13
-
14
- Methods
15
- -------
16
- _resolve_directory(directory: str, file: str = None) -> SkeletonPath
17
- Resolves the absolute path for a given directory and optional file.
18
- app(file: str = None) -> SkeletonPath
19
- Returns the absolute path for a file inside the 'app' directory.
20
- config(file: str = None) -> SkeletonPath
21
- Returns the absolute path for a file inside the 'config' directory.
22
- database(file: str = None) -> SkeletonPath
23
- Returns the absolute path for a file inside the 'database' directory.
24
- resource(file: str = None) -> SkeletonPath
25
- Returns the absolute path for a file inside the 'resource' directory.
26
- routes(file: str = None) -> SkeletonPath
27
- Returns the absolute path for a file inside the 'routes' directory.
28
- storage(file: str = None) -> SkeletonPath
29
- Returns the absolute path for a file inside the 'storage' directory.
30
- tests(file: str = None) -> SkeletonPath
31
- Returns the absolute path for a file inside the 'tests' directory.
32
- """
33
-
34
- @staticmethod
35
- def _resolve_directory(directory: str, file: str = None):
36
- """
37
- Resolves the absolute path for a given directory and optional file.
38
-
39
- This method constructs a path by joining the directory and file, normalizes it,
40
- and resolves it using the `PathService`.
41
-
42
- Parameters
43
- ----------
44
- directory : str
45
- The base directory to resolve the path from.
46
- file : str, optional
47
- The relative file path inside the directory (default is None).
48
-
49
- Returns
50
- -------
51
- SkeletonPath
52
- The resolved absolute path wrapped in a SkeletonPath object.
53
-
54
- Raises
55
- ------
56
- ValueError
57
- If the resolved path is invalid or cannot be resolved.
58
- """
59
- # Default to an empty string if None
60
- file = file or ""
61
-
62
- # Construct path safely
63
- route = os.path.join(directory, file)
64
-
65
- # Normalize path (removes redundant slashes)
66
- route = os.path.normpath(route)
67
-
68
- # Resolve path (Note: The service container is not used here)
69
- path_resolver_service : None#IPathResolverService = PathResolverService()
70
- return path_resolver_service.resolve(route)
71
-
72
- @staticmethod
73
- def app(file: str = None):
74
- """
75
- Returns the absolute path for a file inside the 'app' directory.
76
-
77
- Parameters
78
- ----------
79
- file : str, optional
80
- The relative file path inside the 'app' directory.
81
-
82
- Returns
83
- -------
84
- SkeletonPath
85
- The resolved path wrapped in a SkeletonPath object.
86
- """
87
- return Path._resolve_directory("app", file)
88
-
89
- @staticmethod
90
- def config(file: str = None):
91
- """
92
- Returns the absolute path for a file inside the 'config' directory.
93
-
94
- Parameters
95
- ----------
96
- file : str, optional
97
- The relative file path inside the 'config' directory.
98
-
99
- Returns
100
- -------
101
- SkeletonPath
102
- The resolved path wrapped in a SkeletonPath object.
103
- """
104
- return Path._resolve_directory("config", file)
105
-
106
- @staticmethod
107
- def database(file: str = None):
108
- """
109
- Returns the absolute path for a file inside the 'database' directory.
110
-
111
- Parameters
112
- ----------
113
- file : str, optional
114
- The relative file path inside the 'database' directory.
115
-
116
- Returns
117
- -------
118
- SkeletonPath
119
- The resolved path wrapped in a SkeletonPath object.
120
- """
121
- return Path._resolve_directory("database", file)
122
-
123
- @staticmethod
124
- def resource(file: str = None):
125
- """
126
- Returns the absolute path for a file inside the 'resource' directory.
127
-
128
- Parameters
129
- ----------
130
- file : str, optional
131
- The relative file path inside the 'resource' directory.
132
-
133
- Returns
134
- -------
135
- SkeletonPath
136
- The resolved path wrapped in a SkeletonPath object.
137
- """
138
- return Path._resolve_directory("resource", file)
139
-
140
- @staticmethod
141
- def routes(file: str = None):
142
- """
143
- Returns the absolute path for a file inside the 'routes' directory.
144
-
145
- Parameters
146
- ----------
147
- file : str, optional
148
- The relative file path inside the 'routes' directory.
149
-
150
- Returns
151
- -------
152
- SkeletonPath
153
- The resolved path wrapped in a SkeletonPath object.
154
- """
155
- return Path._resolve_directory("routes", file)
156
-
157
- @staticmethod
158
- def storage(file: str = None):
159
- """
160
- Returns the absolute path for a file inside the 'storage' directory.
161
-
162
- Parameters
163
- ----------
164
- file : str, optional
165
- The relative file path inside the 'storage' directory.
166
-
167
- Returns
168
- -------
169
- SkeletonPath
170
- The resolved path wrapped in a SkeletonPath object.
171
- """
172
- return Path._resolve_directory("storage", file)
173
-
174
- @staticmethod
175
- def tests(file: str = None):
176
- """
177
- Returns the absolute path for a file inside the 'tests' directory.
178
-
179
- Parameters
180
- ----------
181
- file : str, optional
182
- The relative file path inside the 'tests' directory.
183
-
184
- Returns
185
- -------
186
- SkeletonPath
187
- The resolved path wrapped in a SkeletonPath object.
188
- """
189
- return Path._resolve_directory("tests", file)
190
-
191
-
192
- # -------------- Functions --------------
193
-
194
-
195
- def app_path(file: str = None):
196
- """
197
- Returns the absolute path for a file inside the 'app' directory.
198
-
199
- Parameters
200
- ----------
201
- file : str, optional
202
- The relative file path inside the 'app' directory.
203
-
204
- Returns
205
- -------
206
- SkeletonPath
207
- The resolved path wrapped in a SkeletonPath object.
208
- """
209
- return Path._resolve_directory("app", file)
210
-
211
-
212
- def config_path(file: str = None):
213
- """
214
- Returns the absolute path for a file inside the 'config' directory.
215
-
216
- Parameters
217
- ----------
218
- file : str, optional
219
- The relative file path inside the 'config' directory.
220
-
221
- Returns
222
- -------
223
- SkeletonPath
224
- The resolved path wrapped in a SkeletonPath object.
225
- """
226
- return Path._resolve_directory("config", file)
227
-
228
-
229
- def database_path(file: str = None):
230
- """
231
- Returns the absolute path for a file inside the 'database' directory.
232
-
233
- Parameters
234
- ----------
235
- file : str, optional
236
- The relative file path inside the 'database' directory.
237
-
238
- Returns
239
- -------
240
- SkeletonPath
241
- The resolved path wrapped in a SkeletonPath object.
242
- """
243
- return Path._resolve_directory("database", file)
244
-
245
-
246
- def resource_path(file: str = None):
247
- """
248
- Returns the absolute path for a file inside the 'resource' directory.
249
-
250
- Parameters
251
- ----------
252
- file : str, optional
253
- The relative file path inside the 'resource' directory.
254
-
255
- Returns
256
- -------
257
- SkeletonPath
258
- The resolved path wrapped in a SkeletonPath object.
259
- """
260
- return Path._resolve_directory("resource", file)
261
-
262
-
263
- def routes_path(file: str = None):
264
- """
265
- Returns the absolute path for a file inside the 'routes' directory.
266
-
267
- Parameters
268
- ----------
269
- file : str, optional
270
- The relative file path inside the 'routes' directory.
271
-
272
- Returns
273
- -------
274
- SkeletonPath
275
- The resolved path wrapped in a SkeletonPath object.
276
- """
277
- return Path._resolve_directory("routes", file)
278
-
279
-
280
- def storage_path(file: str = None):
281
- """
282
- Returns the absolute path for a file inside the 'storage' directory.
283
-
284
- Parameters
285
- ----------
286
- file : str, optional
287
- The relative file path inside the 'storage' directory.
288
-
289
- Returns
290
- -------
291
- SkeletonPath
292
- The resolved path wrapped in a SkeletonPath object.
293
- """
294
- return Path._resolve_directory("storage", file)
295
-
296
-
297
- def tests_path(file: str = None):
298
- """
299
- Returns the absolute path for a file inside the 'tests' directory.
300
-
301
- Parameters
302
- ----------
303
- file : str, optional
304
- The relative file path inside the 'tests' directory.
305
-
306
- Returns
307
- -------
308
- SkeletonPath
309
- The resolved path wrapped in a SkeletonPath object.
310
- """
311
- return Path._resolve_directory("tests", file)
File without changes
@@ -1,16 +0,0 @@
1
- from orionis._contracts.facades.facade import Facade
2
- from orionis._contracts.services.log.log_service import ILogguerService
3
-
4
- class Log(Facade):
5
- """
6
- Log Facade class. This is the friendly interface for interacting with the logging service.
7
- It's like the concierge of your application's logging system—always ready to help!
8
- """
9
-
10
- @classmethod
11
- def getFacadeAccessor(cls):
12
- """
13
- Returns the service accessor for the logging system. In this case, it's the `ILogguerService`.
14
- This is where the magic of the Facade pattern comes alive—connecting the interface to the actual service.
15
- """
16
- return ILogguerService
File without changes
File without changes
@@ -1,30 +0,0 @@
1
- from orionis._contracts.services.commands.reactor_commands_service import IReactorCommandsService
2
- from orionis._contracts.services.config.config_service import IConfigService
3
- from orionis._contracts.services.log.log_service import ILogguerService
4
- from orionis._providers.service_provider import ServiceProvider
5
- from orionis._services.commands.reactor_commands_service import ReactorCommandsService
6
- from orionis._services.config.config_service import ConfigService
7
- from orionis._services.log.log_service import LogguerService
8
-
9
- class ReactorCommandsServiceProvider(ServiceProvider):
10
-
11
- def register(self) -> None:
12
- """
13
- Registers services or bindings into the given container.
14
- """
15
- if not self.app.bound(IConfigService):
16
- self.app.scoped(IConfigService, ConfigService)
17
-
18
- if not self.app.bound(ILogguerService):
19
- self.app.singleton(ILogguerService, LogguerService)
20
-
21
- self.app.singleton(IReactorCommandsService, ReactorCommandsService)
22
-
23
- async def boot(self) -> None:
24
- """
25
- Boot the service provider.
26
-
27
- This method is intended to be overridden by subclasses to perform
28
- any necessary bootstrapping or initialization tasks.
29
- """
30
- await self.app.make(IReactorCommandsService)
@@ -1,11 +0,0 @@
1
- from orionis._contracts.services.commands.schedule_service import IScheduleService
2
- from orionis._providers.service_provider import ServiceProvider
3
- from orionis._services.commands.scheduler_service import ScheduleService
4
-
5
- class ScheduleServiceProvider(ServiceProvider):
6
-
7
- def register(self) -> None:
8
- """
9
- Registers services or bindings into the given container.
10
- """
11
- self.app.scoped(IScheduleService, ScheduleService)
File without changes
@@ -1,11 +0,0 @@
1
- from orionis._contracts.services.config.config_service import IConfigService
2
- from orionis._providers.service_provider import ServiceProvider
3
- from orionis._services.config.config_service import ConfigService
4
-
5
- class ConfigServiceProvider(ServiceProvider):
6
-
7
- def register(self) -> None:
8
- """
9
- Registers services or bindings into the given container.
10
- """
11
- self.app.scoped(IConfigService, ConfigService)
File without changes
@@ -1,21 +0,0 @@
1
- from orionis._contracts.services.environment.environment_service import IEnvironmentService
2
- from orionis._providers.service_provider import ServiceProvider
3
- from orionis._services.environment.environment_service import EnvironmentService
4
- from orionis._services.files.path_resolver_service import PathResolverService
5
-
6
- class EnvironmentServiceProvider(ServiceProvider):
7
-
8
- def register(self) -> None:
9
- """
10
- Registers services or bindings into the given container.
11
- """
12
- self.app.singleton(IEnvironmentService, EnvironmentService)
13
-
14
- async def boot(self) -> None:
15
- """
16
- Boot the service provider.
17
-
18
- This method is intended to be overridden by subclasses to perform
19
- any necessary bootstrapping or initialization tasks.
20
- """
21
- await self.app.make(IEnvironmentService)
File without changes
@@ -1,21 +0,0 @@
1
- from orionis._contracts.services.files.path_resolver_service import IPathResolverService
2
- from orionis._providers.service_provider import ServiceProvider
3
- # from orionis._services.files.path_resolver_service import PathResolverService
4
-
5
- class PathResolverProvider(ServiceProvider):
6
-
7
- def register(self) -> None:
8
- """
9
- Registers services or bindings into the given container.
10
- """
11
- pass
12
- # self.app.singleton(IPathResolverService, PathResolverService)
13
-
14
- async def boot(self) -> None:
15
- """
16
- Boot the service provider.
17
-
18
- This method is intended to be overridden by subclasses to perform
19
- any necessary bootstrapping or initialization tasks.
20
- """
21
- await self.app.make(IPathResolverService)
File without changes
@@ -1,25 +0,0 @@
1
- from orionis._contracts.services.config.config_service import IConfigService
2
- from orionis._contracts.services.log.log_service import ILogguerService
3
- from orionis._providers.service_provider import ServiceProvider
4
- from orionis._services.config.config_service import ConfigService
5
- from orionis._services.log.log_service import LogguerService
6
-
7
- class LogServiceProvider(ServiceProvider):
8
-
9
- def register(self) -> None:
10
- """
11
- Registers services or bindings into the given container.
12
- """
13
- if not self.app.bound(IConfigService):
14
- self.app.scoped(IConfigService, ConfigService)
15
-
16
- self.app.singleton(ILogguerService, LogguerService)
17
-
18
- async def boot(self) -> None:
19
- """
20
- Boot the service provider.
21
-
22
- This method is intended to be overridden by subclasses to perform
23
- any necessary bootstrapping or initialization tasks.
24
- """
25
- await self.app.make(ILogguerService)
@@ -1,37 +0,0 @@
1
- from orionis._contracts.container.container import IContainer
2
- from orionis._contracts.providers.service_provider import IServiceProvider
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 : IContainer) -> 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")