orionis 0.435.0__py3-none-any.whl → 0.437.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 (59) hide show
  1. orionis/console/contracts/kernel.py +16 -3
  2. orionis/console/dumper/contracts/dump.py +8 -9
  3. orionis/console/dynamic/progress_bar.py +21 -29
  4. orionis/console/output/console.py +12 -0
  5. orionis/container/context/manager.py +27 -17
  6. orionis/container/context/scope.py +8 -7
  7. orionis/container/contracts/service_provider.py +12 -8
  8. orionis/container/providers/service_provider.py +9 -16
  9. orionis/container/resolver/resolver.py +29 -22
  10. orionis/foundation/contracts/application.py +437 -47
  11. orionis/foundation/contracts/config.py +14 -6
  12. orionis/foundation/providers/console_provider.py +16 -15
  13. orionis/foundation/providers/dumper_provider.py +20 -8
  14. orionis/foundation/providers/logger_provider.py +19 -14
  15. orionis/foundation/providers/path_resolver_provider.py +17 -14
  16. orionis/foundation/providers/progress_bar_provider.py +15 -14
  17. orionis/foundation/providers/testing_provider.py +20 -14
  18. orionis/foundation/providers/workers_provider.py +19 -14
  19. orionis/metadata/framework.py +1 -1
  20. orionis/services/asynchrony/contracts/coroutines.py +5 -9
  21. orionis/services/asynchrony/coroutines.py +10 -23
  22. orionis/services/asynchrony/exceptions/exception.py +3 -3
  23. orionis/services/environment/contracts/caster.py +8 -9
  24. orionis/services/environment/contracts/env.py +9 -9
  25. orionis/services/environment/core/dot_env.py +56 -71
  26. orionis/services/environment/dynamic/caster.py +215 -215
  27. orionis/services/environment/enums/__init__.py +5 -0
  28. orionis/services/environment/enums/value_type.py +22 -25
  29. orionis/services/environment/env.py +28 -12
  30. orionis/services/environment/exceptions/exception.py +6 -2
  31. orionis/services/environment/exceptions/value.py +6 -2
  32. orionis/services/environment/helpers/functions.py +5 -3
  33. orionis/services/environment/key/key_generator.py +8 -11
  34. orionis/services/environment/validators/__init__.py +7 -0
  35. orionis/services/environment/validators/key_name.py +5 -5
  36. orionis/services/environment/validators/types.py +29 -9
  37. orionis/services/introspection/abstract/contracts/reflection.py +188 -221
  38. orionis/services/introspection/abstract/reflection.py +311 -178
  39. orionis/services/introspection/callables/contracts/reflection.py +64 -21
  40. orionis/services/introspection/callables/reflection.py +98 -23
  41. orionis/services/introspection/concretes/reflection.py +278 -181
  42. orionis/services/introspection/dependencies/contracts/reflection.py +21 -18
  43. orionis/services/introspection/dependencies/entities/callable_dependencies.py +15 -16
  44. orionis/services/introspection/dependencies/entities/class_dependencies.py +24 -16
  45. orionis/services/introspection/dependencies/entities/known_dependencies.py +19 -13
  46. orionis/services/introspection/dependencies/entities/method_dependencies.py +22 -16
  47. orionis/services/introspection/dependencies/reflection.py +0 -3
  48. orionis/services/introspection/instances/reflection.py +16 -6
  49. orionis/services/log/contracts/log_service.py +4 -0
  50. orionis/services/log/handlers/filename.py +2 -0
  51. orionis/services/paths/contracts/resolver.py +0 -3
  52. orionis/services/paths/resolver.py +0 -3
  53. {orionis-0.435.0.dist-info → orionis-0.437.0.dist-info}/METADATA +1 -1
  54. {orionis-0.435.0.dist-info → orionis-0.437.0.dist-info}/RECORD +59 -59
  55. /orionis/services/introspection/concretes/contracts/{concrete.py → reflection.py} +0 -0
  56. {orionis-0.435.0.dist-info → orionis-0.437.0.dist-info}/WHEEL +0 -0
  57. {orionis-0.435.0.dist-info → orionis-0.437.0.dist-info}/licenses/LICENCE +0 -0
  58. {orionis-0.435.0.dist-info → orionis-0.437.0.dist-info}/top_level.txt +0 -0
  59. {orionis-0.435.0.dist-info → orionis-0.437.0.dist-info}/zip-safe +0 -0
@@ -2,22 +2,30 @@ from abc import ABC, abstractmethod
2
2
 
3
3
  class IConfig(ABC):
4
4
  """
5
- An abstract base class that defines an interface for classes that must have
6
- a `config` attribute.
5
+ Abstract base class for configuration holders.
7
6
 
8
- The subclass is required to implement the `config` attribute, which should be
9
- a dataclass instance representing the configuration data.
7
+ This interface enforces the presence of a `config` attribute in subclasses,
8
+ which must return a dataclass instance containing configuration data.
10
9
 
11
10
  Attributes
12
11
  ----------
13
12
  config : object
14
- A dataclass instance representing the configuration.
13
+ Dataclass instance representing the configuration data.
15
14
  """
16
15
 
17
16
  @property
18
17
  @abstractmethod
19
18
  def config(self):
20
19
  """
21
- Should return a dataclass instance representing the configuration.
20
+ Get the configuration dataclass instance.
21
+
22
+ Returns
23
+ -------
24
+ object
25
+ Dataclass instance containing the configuration data.
26
+
27
+ Notes
28
+ -----
29
+ Subclasses must implement this property to provide access to their configuration.
22
30
  """
23
31
  pass
@@ -4,36 +4,37 @@ from orionis.container.providers.service_provider import ServiceProvider
4
4
 
5
5
  class ConsoleProvider(ServiceProvider):
6
6
  """
7
- ConsoleProvider
8
- ===============
9
-
10
- Registers the console output service in the application container.
11
- Provides access to various console output features, including information, warnings, errors, debug messages, tables, confirmations, and password prompts.
12
-
13
- Methods
14
- -------
15
- register()
16
- Registers the console service in the application container.
17
- boot()
18
- Performs post-registration initialization if needed.
7
+ Provides and registers the console output service within the application container.
8
+
9
+ This provider binds the console output interface to its concrete implementation,
10
+ enabling access to various console output features such as information, warnings,
11
+ errors, debug messages, tables, confirmations, and password prompts.
19
12
  """
20
13
 
21
14
  def register(self) -> None:
22
15
  """
23
- Registers the console service in the application container.
16
+ Register the console output service in the application container.
17
+
18
+ Binds the IConsole interface to the Console implementation as a transient service,
19
+ with the alias "core.orionis.console".
24
20
 
25
21
  Returns
26
22
  -------
27
23
  None
28
24
  """
25
+
29
26
  self.app.transient(IConsole, Console, alias="core.orionis.console")
30
27
 
31
28
  def boot(self) -> None:
32
29
  """
33
- Performs post-registration initialization if needed.
30
+ Perform post-registration initialization for the console provider.
31
+
32
+ This method is a placeholder for any additional setup required after
33
+ registration. Currently, it does not perform any actions.
34
34
 
35
35
  Returns
36
36
  -------
37
37
  None
38
38
  """
39
- pass
39
+
40
+ pass
@@ -4,36 +4,48 @@ from orionis.container.providers.service_provider import ServiceProvider
4
4
 
5
5
  class DumperProvider(ServiceProvider):
6
6
  """
7
- DumperProvider
8
- ==============
7
+ Service provider for registering the debug message service.
9
8
 
10
- Registers the debug message service in the application container.
11
- Provides access to debug message printing, error reporting, and other console diagnostics.
9
+ This provider registers the debug service in the application container,
10
+ enabling debug message printing, error reporting, and console diagnostics.
11
+
12
+ Attributes
13
+ ----------
14
+ app : Application
15
+ The application container instance where services are registered.
12
16
 
13
17
  Methods
14
18
  -------
15
19
  register()
16
- Registers the debug service in the application container.
20
+ Register the debug service in the application container.
17
21
  boot()
18
- Performs post-registration initialization if needed.
22
+ Perform post-registration initialization if required.
19
23
  """
20
24
 
21
25
  def register(self) -> None:
22
26
  """
23
- Registers the debug service in the application container.
27
+ Register the debug service in the application container.
28
+
29
+ Registers the `IDebug` interface with the `Debug` implementation
30
+ as a transient service, using the alias "core.orionis.dumper".
24
31
 
25
32
  Returns
26
33
  -------
27
34
  None
28
35
  """
36
+
29
37
  self.app.transient(IDebug, Debug, alias="core.orionis.dumper")
30
38
 
31
39
  def boot(self) -> None:
32
40
  """
33
- Performs post-registration initialization if needed.
41
+ Perform post-registration initialization if required.
42
+
43
+ This method is a placeholder for any initialization logic that
44
+ should occur after the service has been registered.
34
45
 
35
46
  Returns
36
47
  -------
37
48
  None
38
49
  """
50
+
39
51
  pass
@@ -4,36 +4,41 @@ from orionis.services.log.log_service import LoggerService
4
4
 
5
5
  class LoggerProvider(ServiceProvider):
6
6
  """
7
- LoggerProvider
8
- ==============
9
-
10
- Registers the logging service in the application container.
11
- Provides a `LoggerService` instance for application-wide logging.
12
-
13
- Methods
14
- -------
15
- register()
16
- Registers the logging service in the application container.
17
- boot()
18
- Performs post-registration initialization if needed.
7
+ Provides and registers the logging service within the application container.
8
+
9
+ This provider binds an implementation of `ILoggerService` to the application,
10
+ making a `LoggerService` instance available for application-wide logging.
11
+
12
+ Attributes
13
+ ----------
14
+ app : Application
15
+ The application container instance where services are registered.
19
16
  """
20
17
 
21
18
  def register(self) -> None:
22
19
  """
23
- Registers the logging service in the application container.
20
+ Register the logging service in the application container.
21
+
22
+ This method binds the `LoggerService` implementation to the `ILoggerService`
23
+ contract in the application container, using the application's logging configuration.
24
24
 
25
25
  Returns
26
26
  -------
27
27
  None
28
28
  """
29
+
29
30
  self.app.instance(ILoggerService, LoggerService(self.app.config('logging')), alias="core.orionis.logger")
30
31
 
31
32
  def boot(self) -> None:
32
33
  """
33
- Performs post-registration initialization if needed.
34
+ Perform post-registration initialization for the logging service.
35
+
36
+ This method is a placeholder for any additional setup required after
37
+ the logging service has been registered.
34
38
 
35
39
  Returns
36
40
  -------
37
41
  None
38
42
  """
43
+
39
44
  pass
@@ -4,37 +4,40 @@ from orionis.services.paths.resolver import Resolver
4
4
 
5
5
  class PathResolverProvider(ServiceProvider):
6
6
  """
7
- PathResolverProvider
8
- ===================
9
-
10
7
  Registers the path resolution service in the application container.
11
- Provides compatibility with the file system for resolving paths.
12
-
13
- Methods
14
- -------
15
- register()
16
- Registers the path resolver service in the application container.
17
- boot()
18
- Performs post-registration initialization if needed.
19
- """
20
8
 
9
+ This provider binds the `IResolver` interface to the `Resolver` implementation,
10
+ allowing the application to resolve file system paths through dependency injection.
11
+
12
+ Attributes
13
+ ----------
14
+ app : Application
15
+ The application container instance inherited from ServiceProvider.
16
+ """
21
17
 
22
18
  def register(self) -> None:
23
19
  """
24
- Registers the path resolver service in the application container.
20
+ Register the path resolver service in the application container.
21
+
22
+ Binds the `IResolver` interface to the `Resolver` implementation as a transient
23
+ service, with the alias "core.orionis.path_resolver".
25
24
 
26
25
  Returns
27
26
  -------
28
27
  None
29
28
  """
29
+
30
30
  self.app.transient(IResolver, Resolver, alias="core.orionis.path_resolver")
31
31
 
32
32
  def boot(self) -> None:
33
33
  """
34
- Performs post-registration initialization if needed.
34
+ Perform post-registration initialization if needed.
35
+
36
+ This method is a placeholder for any actions required after service registration.
35
37
 
36
38
  Returns
37
39
  -------
38
40
  None
39
41
  """
42
+
40
43
  pass
@@ -4,36 +4,37 @@ from orionis.container.providers.service_provider import ServiceProvider
4
4
 
5
5
  class ProgressBarProvider(ServiceProvider):
6
6
  """
7
- ProgressBarProvider
8
- ===================
9
-
10
- Registers the dynamic progress bar service in the application container.
11
- Provides a console progress bar for visual feedback during operations.
12
-
13
- Methods
14
- -------
15
- register()
16
- Registers the progress bar service in the application container.
17
- boot()
18
- Performs post-registration initialization if needed.
7
+ Service provider for registering the dynamic progress bar.
8
+
9
+ This provider registers the `IProgressBar` interface with the `ProgressBar`
10
+ implementation in the application container, allowing for dependency injection
11
+ and usage of a console-based progress bar for visual feedback during operations.
19
12
  """
20
13
 
21
14
  def register(self) -> None:
22
15
  """
23
- Registers the progress bar service in the application container.
16
+ Register the progress bar service in the application container.
17
+
18
+ Registers the `IProgressBar` interface to resolve to the `ProgressBar`
19
+ implementation, with the alias "core.orionis.progress_bar".
24
20
 
25
21
  Returns
26
22
  -------
27
23
  None
28
24
  """
25
+
29
26
  self.app.transient(IProgressBar, ProgressBar, alias="core.orionis.progress_bar")
30
27
 
31
28
  def boot(self) -> None:
32
29
  """
33
- Performs post-registration initialization if needed.
30
+ Perform post-registration initialization.
31
+
32
+ This method is called after all providers have been registered. No additional
33
+ initialization is required for the progress bar service.
34
34
 
35
35
  Returns
36
36
  -------
37
37
  None
38
38
  """
39
+
39
40
  pass
@@ -4,36 +4,42 @@ from orionis.test.core.unit_test import UnitTest
4
4
 
5
5
  class TestingProvider(ServiceProvider):
6
6
  """
7
- TestingProvider
8
- ===============
9
-
10
- Registers the unit testing environment service in the application container.
11
- Provides a native unit testing framework for Orionis with features beyond common frameworks.
12
-
13
- Methods
14
- -------
15
- register()
16
- Registers the unit testing service in the application container.
17
- boot()
18
- Performs post-registration initialization if needed.
7
+ Provides and registers the unit testing environment service in the application container.
8
+
9
+ This provider integrates a native unit testing framework for Orionis,
10
+ enabling advanced testing features and registering the service as a singleton
11
+ within the application's dependency injection container.
12
+
13
+ Attributes
14
+ ----------
15
+ app : Application
16
+ The application container instance where services are registered.
19
17
  """
20
18
 
21
19
  def register(self) -> None:
22
20
  """
23
- Registers the unit testing service in the application container.
21
+ Register the unit testing service in the application container.
22
+
23
+ Registers the IUnitTest interface to the UnitTest implementation as a singleton,
24
+ with the alias "core.orionis.testing".
24
25
 
25
26
  Returns
26
27
  -------
27
28
  None
28
29
  """
30
+
29
31
  self.app.singleton(IUnitTest, UnitTest, alias="core.orionis.testing")
30
32
 
31
33
  def boot(self) -> None:
32
34
  """
33
- Performs post-registration initialization if needed.
35
+ Perform post-registration initialization if required.
36
+
37
+ This method is intended for any setup needed after service registration.
38
+ Currently, no additional initialization is performed.
34
39
 
35
40
  Returns
36
41
  -------
37
42
  None
38
43
  """
44
+
39
45
  pass
@@ -4,36 +4,41 @@ from orionis.services.system.workers import Workers
4
4
 
5
5
  class WorkersProvider(ServiceProvider):
6
6
  """
7
- WorkersProvider
8
- ===============
9
-
10
- Registers the worker management service in the application container.
11
- Determines the optimal number of workers to start based on system analysis.
12
-
13
- Methods
14
- -------
15
- register()
16
- Registers the worker service in the application container.
17
- boot()
18
- Performs post-registration initialization if needed.
7
+ Provides and registers the worker management service within the application container.
8
+
9
+ This provider determines and registers the optimal worker management implementation,
10
+ making it available for dependency injection throughout the application.
11
+
12
+ Attributes
13
+ ----------
14
+ app : Application
15
+ The application container instance where services are registered.
19
16
  """
20
17
 
21
18
  def register(self) -> None:
22
19
  """
23
- Registers the worker service in the application container.
20
+ Register the worker service in the application container.
21
+
22
+ Registers the `Workers` implementation as a transient service for the `IWorkers`
23
+ contract, with the alias "core.orionis.workers".
24
24
 
25
25
  Returns
26
26
  -------
27
27
  None
28
28
  """
29
+
29
30
  self.app.transient(IWorkers, Workers, alias="core.orionis.workers")
30
31
 
31
32
  def boot(self) -> None:
32
33
  """
33
- Performs post-registration initialization if needed.
34
+ Perform post-registration initialization if required.
35
+
36
+ This method is a placeholder for any initialization logic that should occur
37
+ after the worker service has been registered.
34
38
 
35
39
  Returns
36
40
  -------
37
41
  None
38
42
  """
43
+
39
44
  pass
@@ -5,7 +5,7 @@
5
5
  NAME = "orionis"
6
6
 
7
7
  # Current version of the framework
8
- VERSION = "0.435.0"
8
+ VERSION = "0.437.0"
9
9
 
10
10
  # Full name of the author or maintainer of the project
11
11
  AUTHOR = "Raul Mauricio Uñate Castro"
@@ -9,24 +9,20 @@ class ICoroutine(ABC):
9
9
  @abstractmethod
10
10
  def run(self) -> Union[T, asyncio.Future]:
11
11
  """
12
- Executes the wrapped coroutine, either synchronously or asynchronously depending on the context.
13
-
14
- Parameters
15
- ----------
16
- None
12
+ Execute the wrapped coroutine either synchronously or asynchronously, depending on the execution context.
17
13
 
18
14
  Returns
19
15
  -------
20
16
  T or asyncio.Future
21
- If called outside an event loop, returns the result of the coroutine execution (type T).
17
+ If called outside of an event loop, returns the result of the coroutine execution (type T).
22
18
  If called within an event loop, returns an asyncio.Future representing the scheduled coroutine.
23
19
 
24
20
  Notes
25
21
  -----
26
- - When invoked outside of an event loop, the coroutine is executed synchronously and its result is returned.
27
- - When invoked inside an event loop, the coroutine is scheduled for asynchronous execution and a Future is returned.
22
+ - Executes the coroutine synchronously and returns its result when called outside an event loop.
23
+ - Schedules the coroutine for asynchronous execution and returns a Future when called inside an event loop.
28
24
  - The caller is responsible for awaiting the Future if asynchronous execution is used.
29
25
  """
30
26
 
31
27
  # This method should be implemented by subclasses to handle coroutine execution.
32
- pass
28
+ pass
@@ -10,28 +10,19 @@ class Coroutine(ICoroutine):
10
10
 
11
11
  def __init__(self, func: TypingCoroutine[Any, Any, T]) -> None:
12
12
  """
13
- Initialize the Coroutine wrapper.
13
+ Wraps a coroutine object and validates its type.
14
14
 
15
15
  Parameters
16
16
  ----------
17
17
  func : Coroutine
18
- The coroutine object to be wrapped. Must be an awaitable coroutine.
18
+ The coroutine object to be wrapped and managed.
19
19
 
20
20
  Raises
21
21
  ------
22
22
  OrionisCoroutineException
23
23
  If the provided object is not a coroutine.
24
-
25
- Returns
26
- -------
27
- None
28
- This method does not return a value.
29
-
30
- Notes
31
- -----
32
- This constructor validates that the provided object is a coroutine using the framework's type introspection.
33
- If the validation fails, an exception is raised to prevent improper usage.
34
24
  """
25
+
35
26
  # Validate that the provided object is a coroutine
36
27
  if not Type(func).isCoroutine():
37
28
  raise OrionisCoroutineException(
@@ -43,17 +34,12 @@ class Coroutine(ICoroutine):
43
34
 
44
35
  def run(self) -> Union[T, asyncio.Future]:
45
36
  """
46
- Executes the wrapped coroutine, either synchronously or asynchronously depending on the context.
47
-
48
- Parameters
49
- ----------
50
- None
37
+ Executes the wrapped coroutine, adapting to the current event loop context.
51
38
 
52
39
  Returns
53
40
  -------
54
41
  T or asyncio.Future
55
- If called outside an event loop, returns the result of the coroutine after synchronous execution.
56
- If called within an event loop, returns an asyncio.Future representing the scheduled coroutine.
42
+ The result of the coroutine if executed synchronously, or an asyncio.Future if scheduled asynchronously.
57
43
 
58
44
  Raises
59
45
  ------
@@ -62,10 +48,11 @@ class Coroutine(ICoroutine):
62
48
 
63
49
  Notes
64
50
  -----
65
- - When invoked outside an active event loop, the coroutine is executed synchronously and its result is returned.
66
- - When invoked inside an active event loop, the coroutine is scheduled for asynchronous execution and a Future is returned.
67
- - This method automatically detects the execution context and chooses the appropriate execution strategy.
51
+ - If called outside an active event loop, the coroutine is executed synchronously and its result is returned.
52
+ - If called within an active event loop, the coroutine is scheduled for asynchronous execution and a Future is returned.
53
+ - The method automatically detects the execution context and chooses the appropriate execution strategy.
68
54
  """
55
+
69
56
  # Attempt to get the currently running event loop
70
57
  try:
71
58
  loop = asyncio.get_running_loop()
@@ -80,4 +67,4 @@ class Coroutine(ICoroutine):
80
67
 
81
68
  # If no event loop is running, execute the coroutine synchronously using the loop
82
69
  else:
83
- return loop.run_until_complete(self.__func)
70
+ return loop.run_until_complete(self.__func)
@@ -2,12 +2,12 @@ class OrionisCoroutineException(Exception):
2
2
 
3
3
  def __init__(self, msg: str):
4
4
  """
5
- Initializes an OrionisCoroutineException with a descriptive error message.
5
+ Initialize the OrionisCoroutineException.
6
6
 
7
7
  Parameters
8
8
  ----------
9
9
  msg : str
10
- Descriptive error message explaining the cause of the exception.
10
+ A descriptive error message explaining the cause of the exception.
11
11
  """
12
12
 
13
13
  # Call the base Exception constructor with the provided message
@@ -15,7 +15,7 @@ class OrionisCoroutineException(Exception):
15
15
 
16
16
  def __str__(self) -> str:
17
17
  """
18
- Returns a formatted string representation of the exception message.
18
+ Return the string representation of the exception.
19
19
 
20
20
  Returns
21
21
  -------
@@ -10,24 +10,23 @@ class IEnvironmentCaster(ABC):
10
10
  Parameters
11
11
  ----------
12
12
  type_hint : str
13
- The type hint to set, which must be one of the valid options defined in OPTIONS.
13
+ The type hint to assign. Must be one of the valid options defined in OPTIONS.
14
14
 
15
15
  Raises
16
16
  ------
17
17
  OrionisEnvironmentValueError
18
- If the provided type hint is not one of the valid options.
18
+ If the provided type hint is not among the valid options.
19
19
  """
20
20
  pass
21
21
 
22
22
  @abstractmethod
23
23
  def get(self):
24
24
  """
25
- Returns the value corresponding to the specified type hint.
25
+ Retrieve the value corresponding to the specified type hint.
26
26
 
27
- Checks if the provided type hint is valid and then dispatches the call to the appropriate
28
- method for handling the type.
29
-
30
- Supported type hints include: 'path:', 'str:', 'int:', 'float:', 'bool:', 'list:', 'dict:', 'tuple:', and 'set:'.
27
+ Checks the validity of the provided type hint and dispatches the call to the appropriate
28
+ handler for the type. Supported type hints include: 'path:', 'str:', 'int:', 'float:',
29
+ 'bool:', 'list:', 'dict:', 'tuple:', and 'set:'.
31
30
 
32
31
  Returns
33
32
  -------
@@ -37,6 +36,6 @@ class IEnvironmentCaster(ABC):
37
36
  Raises
38
37
  ------
39
38
  OrionisEnvironmentValueError
40
- If the type hint is not one of the supported options.
39
+ If the type hint is not supported.
41
40
  """
42
- pass
41
+ pass