orionis 0.66.0__py3-none-any.whl → 0.68.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 (25) hide show
  1. orionis/contracts/services/environment/__init__.py +0 -0
  2. orionis/contracts/services/environment/i_environment_service.py +74 -0
  3. orionis/contracts/services/files/{i_path_service.py → i_path_resolver_service.py} +1 -3
  4. orionis/framework.py +1 -1
  5. orionis/luminate/bootstrap/service_providers_bootstrapper.py +10 -0
  6. orionis/luminate/facades/app.py +41 -0
  7. orionis/luminate/facades/config/config_facade.py +5 -7
  8. orionis/luminate/facades/environment/environment_facade.py +19 -62
  9. orionis/luminate/facades/files/path_facade.py +4 -3
  10. orionis/luminate/facades/log/log_facade.py +11 -6
  11. orionis/luminate/providers/config/config_service_provider.py +6 -13
  12. orionis/luminate/providers/environment/__init__.py +0 -0
  13. orionis/luminate/providers/environment/environment_provider.py +19 -0
  14. orionis/luminate/providers/log/log_service_provider.py +6 -13
  15. orionis/luminate/providers/service_provider.py +51 -0
  16. orionis/luminate/services/environment/__init__.py +0 -0
  17. orionis/luminate/services/environment/environment_service.py +96 -0
  18. orionis/luminate/services/files/path_resolver_service.py +59 -0
  19. {orionis-0.66.0.dist-info → orionis-0.68.0.dist-info}/METADATA +1 -1
  20. {orionis-0.66.0.dist-info → orionis-0.68.0.dist-info}/RECORD +24 -15
  21. orionis/luminate/services/files/path_service.py +0 -91
  22. {orionis-0.66.0.dist-info → orionis-0.68.0.dist-info}/LICENCE +0 -0
  23. {orionis-0.66.0.dist-info → orionis-0.68.0.dist-info}/WHEEL +0 -0
  24. {orionis-0.66.0.dist-info → orionis-0.68.0.dist-info}/entry_points.txt +0 -0
  25. {orionis-0.66.0.dist-info → orionis-0.68.0.dist-info}/top_level.txt +0 -0
File without changes
@@ -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:
orionis/framework.py CHANGED
@@ -5,7 +5,7 @@
5
5
  NAME = "orionis"
6
6
 
7
7
  # Current version of the framework
8
- VERSION = "0.66.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)
@@ -1,8 +1,6 @@
1
- import os
2
- import threading
3
- from pathlib import Path
4
- from dotenv import set_key, unset_key, dotenv_values
5
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
6
4
 
7
5
  def env(key: str, default=None) -> str:
8
6
  """
@@ -26,55 +24,13 @@ def env(key: str, default=None) -> str:
26
24
  The value of the environment variable, or the default value if the variable
27
25
  does not exist.
28
26
  """
29
- return Env().get(key, default)
27
+ return Env.get(key, default)
30
28
 
31
29
  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):
40
- """
41
- Override the __new__ method to ensure only one instance of the class is created.
42
-
43
- Parameters
44
- ----------
45
- path : str, optional
46
- The path to the .env file. Defaults to None.
47
-
48
- Returns
49
- -------
50
- Environment
51
- The singleton instance of the Environment class.
52
- """
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
59
-
60
- def _initialize(self, path: str = None):
61
- """
62
- Initializes the instance by setting the path to the .env file.
63
- If no path is provided, defaults to a `.env` file in the current directory.
64
-
65
- Parameters
66
- ----------
67
- path : str, optional
68
- Path to the .env file. Defaults to None.
69
- """
70
- # Set the path to the .env file
71
- self.path = Path(path) if path else Path(os.getcwd()) / ".env"
72
30
 
73
- # Create the .env file if it does not exist
74
- if not self.path.exists():
75
- self.path.touch()
76
31
 
77
- def get(self, key: str, default=None) -> str:
32
+ @staticmethod
33
+ def get(key: str, default=None) -> str:
78
34
  """
79
35
  Retrieves the value of an environment variable from the .env file
80
36
  or from system environment variables if not found.
@@ -91,13 +47,12 @@ class Env(IEnv):
91
47
  str
92
48
  The value of the environment variable or the default value.
93
49
  """
94
- # Get the value from the .env file
95
- value = dotenv_values(self.path).get(key)
96
50
 
97
- # Return the value or the default value
98
- return value if value is not None else os.getenv(key, default)
51
+ _env_service : EnvironmentService = app(EnvironmentService)
52
+ return _env_service.get(key, default)
99
53
 
100
- def set(self, key: str, value: str) -> None:
54
+ @staticmethod
55
+ def set(key: str, value: str) -> None:
101
56
  """
102
57
  Sets the value of an environment variable in the .env file.
103
58
 
@@ -108,10 +63,11 @@ class Env(IEnv):
108
63
  value : str
109
64
  The value to set.
110
65
  """
111
- # Set the value in the .env file
112
- set_key(str(self.path), key, value)
66
+ _env_service : EnvironmentService = app(EnvironmentService)
67
+ return _env_service.set(key, value)
113
68
 
114
- def unset(self, key: str) -> None:
69
+ @staticmethod
70
+ def unset(key: str) -> None:
115
71
  """
116
72
  Removes an environment variable from the .env file.
117
73
 
@@ -120,10 +76,11 @@ class Env(IEnv):
120
76
  key : str
121
77
  The key of the environment variable to remove.
122
78
  """
123
- # Remove the key from the .env file
124
- unset_key(str(self.path), key)
79
+ _env_service : EnvironmentService = app(EnvironmentService)
80
+ return _env_service.unset(key)
125
81
 
126
- def all(self) -> dict:
82
+ @staticmethod
83
+ def all() -> dict:
127
84
  """
128
85
  Retrieves all environment variable values from the .env file.
129
86
 
@@ -132,5 +89,5 @@ class Env(IEnv):
132
89
  dict
133
90
  A dictionary of all environment variables and their values.
134
91
  """
135
- # Return all environment variables
136
- return dotenv_values(self.path)
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.container.container import Container
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
- Container().make(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
- Container().make(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
- Container().make(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
- Container().make(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
- Container().make(LogguerService).debug(message)
89
+ _log_service : LogguerService = app(LogguerService)
90
+ return _log_service.debug(message)
@@ -1,26 +1,19 @@
1
- from orionis.contracts.providers.i_service_provider import IServiceProvider
2
- from orionis.luminate.container.container import Container
1
+ from orionis.luminate.providers.service_provider import ServiceProvider
3
2
  from orionis.luminate.services.config.config_service import ConfigService
4
3
 
5
- class ConfigServiceProvider(IServiceProvider):
4
+ class ConfigServiceProvider(ServiceProvider):
6
5
 
7
- def register(self, container: Container) -> None:
6
+ def register(self,) -> None:
8
7
  """
9
8
  Registers services or bindings into the given container.
10
-
11
- Args:
12
- container (Container): The container to register services or bindings into.
13
9
  """
14
- self.key_sp = container.scoped(ConfigService)
10
+ self._container_id = self.app.scoped(ConfigService)
15
11
 
16
- def boot(self, container: Container) -> None:
12
+ def boot(self,) -> None:
17
13
  """
18
14
  Boot the service provider.
19
15
 
20
16
  This method is intended to be overridden by subclasses to perform
21
17
  any necessary bootstrapping or initialization tasks.
22
-
23
- Args:
24
- container (Container): The service container instance.
25
18
  """
26
- container.make(self.key_sp)
19
+ self.app.make(self._container_id)
File without changes
@@ -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)
@@ -1,26 +1,19 @@
1
- from orionis.contracts.providers.i_service_provider import IServiceProvider
2
- from orionis.luminate.container.container import Container
1
+ from orionis.luminate.providers.service_provider import ServiceProvider
3
2
  from orionis.luminate.services.log.log_service import LogguerService
4
3
 
5
- class LogServiceProvider(IServiceProvider):
4
+ class LogServiceProvider(ServiceProvider):
6
5
 
7
- def register(self, container: Container) -> None:
6
+ def register(self) -> None:
8
7
  """
9
8
  Registers services or bindings into the given container.
10
-
11
- Args:
12
- container (Container): The container to register services or bindings into.
13
9
  """
14
- self.key_sp = container.singleton(LogguerService)
10
+ self._container_id = self.app.singleton(LogguerService)
15
11
 
16
- def boot(self, container: Container) -> None:
12
+ def boot(self) -> None:
17
13
  """
18
14
  Boot the service provider.
19
15
 
20
16
  This method is intended to be overridden by subclasses to perform
21
17
  any necessary bootstrapping or initialization tasks.
22
-
23
- Args:
24
- container (Container): The service container instance.
25
18
  """
26
- container.make(self.key_sp)
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")
File without changes
@@ -0,0 +1,96 @@
1
+ import os
2
+ from pathlib import Path
3
+ from dotenv import set_key, unset_key, dotenv_values
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
+
10
+ """
11
+ Initializes the EnvironmentService instance.
12
+
13
+ Parameters
14
+ ----------
15
+ path : str, optional
16
+ The path to the .env file. Defaults to None.
17
+ """
18
+ self._initialize(path)
19
+
20
+ def _initialize(self, path: str = None):
21
+ """
22
+ Initializes the instance by setting the path to the .env file.
23
+ If no path is provided, defaults to a `.env` file in the current directory.
24
+
25
+ Parameters
26
+ ----------
27
+ path : str, optional
28
+ Path to the .env file. Defaults to None.
29
+ """
30
+ # Set the path to the .env file
31
+ self.path = Path(path) if path else Path(os.getcwd()) / ".env"
32
+
33
+ # Create the .env file if it does not exist
34
+ if not self.path.exists():
35
+ self.path.touch()
36
+
37
+ def get(self, key: str, default=None) -> str:
38
+ """
39
+ Retrieves the value of an environment variable from the .env file
40
+ or from system environment variables if not found.
41
+
42
+ Parameters
43
+ ----------
44
+ key : str
45
+ The key of the environment variable.
46
+ default : optional
47
+ Default value if the key does not exist. Defaults to None.
48
+
49
+ Returns
50
+ -------
51
+ str
52
+ The value of the environment variable or the default value.
53
+ """
54
+ # Get the value from the .env file
55
+ value = dotenv_values(self.path).get(key)
56
+
57
+ # Return the value or the default value
58
+ return value if value is not None else os.getenv(key, default)
59
+
60
+ def set(self, key: str, value: str) -> None:
61
+ """
62
+ Sets the value of an environment variable in the .env file.
63
+
64
+ Parameters
65
+ ----------
66
+ key : str
67
+ The key of the environment variable.
68
+ value : str
69
+ The value to set.
70
+ """
71
+ # Set the value in the .env file
72
+ set_key(str(self.path), key, value)
73
+
74
+ def unset(self, key: str) -> None:
75
+ """
76
+ Removes an environment variable from the .env file.
77
+
78
+ Parameters
79
+ ----------
80
+ key : str
81
+ The key of the environment variable to remove.
82
+ """
83
+ # Remove the key from the .env file
84
+ unset_key(str(self.path), key)
85
+
86
+ def all(self) -> dict:
87
+ """
88
+ Retrieves all environment variable values from the .env file.
89
+
90
+ Returns
91
+ -------
92
+ dict
93
+ A dictionary of all environment variables and their values.
94
+ """
95
+ # Return all environment variables
96
+ return dotenv_values(self.path)
@@ -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)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: orionis
3
- Version: 0.66.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
@@ -1,6 +1,6 @@
1
1
  orionis/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
2
  orionis/cli_manager.py,sha256=0bM-hABXJSoPGuvEgnqeaj9qcLP8VjTQ3z9Mb0TSEUI,1381
3
- orionis/framework.py,sha256=SFegmp7F_hzTIxb36GqTwVkDaEe2fhqWP2M77zf-QEg,1386
3
+ orionis/framework.py,sha256=Bkfcg8Fns2s21OJxK0LzX2uCh_vQu-YjjxFAfgRme4s,1386
4
4
  orionis/contracts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
5
  orionis/contracts/bootstrap/i_command_bootstrapper.py,sha256=cfpYWSlNhOY1q_C9o0H7F381OoM0Oh0qaeqP-c85nzk,2457
6
6
  orionis/contracts/bootstrap/i_config_bootstrapper.py,sha256=d2TXT74H2fCBbzWgrt9-ZG11S_H_YPQOEcJoIOrsgb0,4462
@@ -42,8 +42,10 @@ orionis/contracts/providers/i_service_provider.py,sha256=zoBAsGE-KrNfCsF3u876oxo
42
42
  orionis/contracts/services/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
43
43
  orionis/contracts/services/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
44
44
  orionis/contracts/services/config/i_config_service.py,sha256=TdlEEsd8jvzBGozwaZtQ9KYHisY4ACL-VUOtydidHeE,989
45
+ orionis/contracts/services/environment/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
46
+ orionis/contracts/services/environment/i_environment_service.py,sha256=e-bod0MTq21WVvchlE7kyMQoFL_yhhN4ddRfzctDrz0,1959
45
47
  orionis/contracts/services/files/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
46
- orionis/contracts/services/files/i_path_service.py,sha256=Le5sax8c_PjUyb5Hg7AVQALGjxlym5cc6OSPvGCKBKk,866
48
+ orionis/contracts/services/files/i_path_resolver_service.py,sha256=B53Qzei4o_jzehIF0zJVHXzI4S-h0XeQ5vMslxT8okM,837
47
49
  orionis/contracts/services/log/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
48
50
  orionis/contracts/services/log/i_log_service.py,sha256=1RD3u-a5ZDMbg7AYE8y2SW8QNRybAU3De0mEA0dAeNo,2167
49
51
  orionis/contracts/support/i_exception_to_dict.py,sha256=LZpbCNDYQJs3j2mIM-NRFl0IfA8I0GFHExgRSO6K2FQ,780
@@ -61,6 +63,7 @@ orionis/luminate/bootstrap/command_bootstrapper.py,sha256=OU0hDMtG1xqVbvCneq4C5m
61
63
  orionis/luminate/bootstrap/config_bootstrapper.py,sha256=Gw83UtPAOggwzqmz062JfJcpIfmZvmIQyZJfgVFiIcQ,7474
62
64
  orionis/luminate/bootstrap/environment_bootstrapper.py,sha256=z8pbnT2oc_NDzqMtgsF6r_JWt5bvGFNenNb30HeRl2A,5219
63
65
  orionis/luminate/bootstrap/exception_bootstrapper.py,sha256=wDKfEW295c7-bavr7YUHK2CLYcTSZgjT9ZRSBne6GOE,1356
66
+ orionis/luminate/bootstrap/service_providers_bootstrapper.py,sha256=bQK1yDLP9dqks3TQhTaJDnrnla_79Tw8wTOY2AsLuDQ,268
64
67
  orionis/luminate/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
65
68
  orionis/luminate/config/app.py,sha256=7teuVPuaV2ao0M5Bv-jhSgjEwb9DtVwde2saTRmYru4,1737
66
69
  orionis/luminate/config/auth.py,sha256=CG8F0pfVjKz4DY3d1Wi7gscdhnp4TT-Q8SJ2sdsHh18,523
@@ -98,14 +101,15 @@ orionis/luminate/container/container.py,sha256=SKC7IyiAaeySiSvlRbTZRTTe4i_Jvm2N8
98
101
  orionis/luminate/container/exception.py,sha256=ap1SqYEjQEEHXJJTNmL7V1jrmRjgT5_7geZ95MYkhMA,1691
99
102
  orionis/luminate/container/types.py,sha256=BDcXN0__voRNHZ5Gr5dF0sWIYAQyNk4TxAwILBWyDAA,1735
100
103
  orionis/luminate/facades/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
104
+ orionis/luminate/facades/app.py,sha256=20ai-4ggQSBLNz2zpaESKsJ7NhnTQ-XvnRoT_WGNcxk,1486
101
105
  orionis/luminate/facades/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
102
- orionis/luminate/facades/config/config_facade.py,sha256=GLQ6JiD2dB7WLyhUZ4SGBSNo7VuwHpX_QrrQcvjoAi8,1429
106
+ orionis/luminate/facades/config/config_facade.py,sha256=xpyVdH_-CeOvtMuf-Pjl9SFZWOflXzx9lyDy_fYOmxU,1353
103
107
  orionis/luminate/facades/environment/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
104
- orionis/luminate/facades/environment/environment_facade.py,sha256=AzaaQaOz8scgSCVi3liyLaBI_nXhZR2deLFhOQ2nmhU,4191
108
+ orionis/luminate/facades/environment/environment_facade.py,sha256=URYc1fhE95U6SXTVFqNGS2zAYAylRw8Mqf6cEht9LBg,2825
105
109
  orionis/luminate/facades/files/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
106
- orionis/luminate/facades/files/path_facade.py,sha256=uWU8_-iaMGBWuVxbk_MoTm0FVFq25F_ub-ObvrtceHg,8987
110
+ orionis/luminate/facades/files/path_facade.py,sha256=xajnRjA5FZy9wSCs7NhZyWGapFqQ8hak779_-6G_QXk,9091
107
111
  orionis/luminate/facades/log/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
108
- orionis/luminate/facades/log/log_facade.py,sha256=YiPCbrRjxN-xYSJMfK_ii3NbsfMM1kYGBOeUCG6PNz4,2256
112
+ orionis/luminate/facades/log/log_facade.py,sha256=_F5-Vnon6hZKefrTwurvraW8lfoG99VmLql_prMdKm8,2482
109
113
  orionis/luminate/facades/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
110
114
  orionis/luminate/facades/tests/tests_facade.py,sha256=eH_fyXjzEVw8aqEwxAgSujFUItz2woau6hc2Mf4VlkE,1660
111
115
  orionis/luminate/patterns/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -113,15 +117,20 @@ orionis/luminate/patterns/singleton.py,sha256=b3U0nubKSQWyal5wTXADVPtOztkaTk-M8Z
113
117
  orionis/luminate/pipelines/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
114
118
  orionis/luminate/pipelines/cli_pipeline.py,sha256=xpdwxArZrYqaeo4h375RQwY329V14S8DJC9z1w_Ar1s,4218
115
119
  orionis/luminate/providers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
120
+ orionis/luminate/providers/service_provider.py,sha256=Ave9V10KPVCI6bt3HwJ51322P-_RnQuHXkC-ltlAOOA,1537
116
121
  orionis/luminate/providers/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
117
- orionis/luminate/providers/config/config_service_provider.py,sha256=B72XEIzbiFFojB3c361QFTVz3kuM9HEUHaW-whMgytw,946
122
+ orionis/luminate/providers/config/config_service_provider.py,sha256=MDUdswBE3llDyTkpWnBnLACXs5lgEBHyVHENnwBtobE,660
123
+ orionis/luminate/providers/environment/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
124
+ orionis/luminate/providers/environment/environment_provider.py,sha256=k5Cgk59UNKliFN1zS7ghUyva03jg00QhJxWYhg-6JUQ,679
118
125
  orionis/luminate/providers/log/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
119
- orionis/luminate/providers/log/log_service_provider.py,sha256=ROvuiEaUAWN-KMZnW3CKoJMgPR8kP37kLB5y1ug03Jg,942
126
+ orionis/luminate/providers/log/log_service_provider.py,sha256=tcWDEI-fubi1mWSS-IKiRReuc0pRMHpxvbvuDgs2Uy0,654
120
127
  orionis/luminate/services/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
121
128
  orionis/luminate/services/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
122
129
  orionis/luminate/services/config/config_service.py,sha256=TZa3WZtDKEW6p0bMktzMXn85cOQy-q21myiYu3rZA34,2147
130
+ orionis/luminate/services/environment/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
131
+ orionis/luminate/services/environment/environment_service.py,sha256=2XuzDxapUoiyyESyg2-hdx9xTyFjgAgVTOcvRx68uPg,2946
123
132
  orionis/luminate/services/files/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
124
- orionis/luminate/services/files/path_service.py,sha256=opLl1k0QLPv9u9GCKENyRsLKhupM_0BDjXE_elk47EU,3039
133
+ orionis/luminate/services/files/path_resolver_service.py,sha256=E-G_E2H5QAZyxeMssARp7l1OBSxQurxkUPoKdSOCKEE,2041
125
134
  orionis/luminate/services/log/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
126
135
  orionis/luminate/services/log/log_service.py,sha256=aiENimOQHqaEAsBJz2_698bt1IeJjddHnledLKfg25o,5262
127
136
  orionis/luminate/support/dot_dict.py,sha256=FVHfBuAGTTVMjNG01Fix645fRNKKUMmNx61pYkxPL5c,1253
@@ -144,9 +153,9 @@ tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
144
153
  tests/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
145
154
  tests/tools/class_example.py,sha256=dIPD997Y15n6WmKhWoOFSwEldRm9MdOHTZZ49eF1p3c,1056
146
155
  tests/tools/test_reflection.py,sha256=bhLQ7VGVod4B8sv-rW9AjnOumvaBVsoxieA3sdoM2yM,5244
147
- orionis-0.66.0.dist-info/LICENCE,sha256=-_4cF2EBKuYVS_SQpy1uapq0oJPUU1vl_RUWSy2jJTo,1111
148
- orionis-0.66.0.dist-info/METADATA,sha256=YfYKGVnCJTBnTK9N8bche5sGZkDfX5cDrOzxdiGHcV8,2978
149
- orionis-0.66.0.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
150
- orionis-0.66.0.dist-info/entry_points.txt,sha256=eef1_CVewfokKjrGBynXa06KabSJYo7LlDKKIKvs1cM,53
151
- orionis-0.66.0.dist-info/top_level.txt,sha256=2bdoHgyGZhOtLAXS6Om8OCTmL24dUMC_L1quMe_ETbk,14
152
- orionis-0.66.0.dist-info/RECORD,,
156
+ orionis-0.68.0.dist-info/LICENCE,sha256=-_4cF2EBKuYVS_SQpy1uapq0oJPUU1vl_RUWSy2jJTo,1111
157
+ orionis-0.68.0.dist-info/METADATA,sha256=3D2zt3rbGf4vN_UIRT7pqDYGx4YX9_dPtBd47q9-vRY,2978
158
+ orionis-0.68.0.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
159
+ orionis-0.68.0.dist-info/entry_points.txt,sha256=eef1_CVewfokKjrGBynXa06KabSJYo7LlDKKIKvs1cM,53
160
+ orionis-0.68.0.dist-info/top_level.txt,sha256=2bdoHgyGZhOtLAXS6Om8OCTmL24dUMC_L1quMe_ETbk,14
161
+ orionis-0.68.0.dist-info/RECORD,,
@@ -1,91 +0,0 @@
1
- import os
2
- import threading
3
- from pathlib import Path
4
- from orionis.contracts.services.files.i_path_service import IPathService
5
-
6
- class PathService(IPathService):
7
- """
8
- A thread-safe singleton class for resolving and validating absolute paths.
9
-
10
- This class resolves the absolute path for a given relative directory or file path
11
- based on the script's execution directory. It ensures that the requested path is valid
12
- (either a directory or a file) and provides methods to retrieve the resolved path.
13
-
14
- Attributes
15
- ----------
16
- base_path : Path
17
- The base path (current working directory) used for resolving relative paths.
18
- route : str
19
- The resolved absolute path to the directory or file.
20
- """
21
-
22
- _instance = None
23
- _lock = threading.Lock()
24
-
25
- def __new__(cls):
26
- """
27
- Override the __new__ method to ensure only one instance of the class is created.
28
-
29
- Returns
30
- -------
31
- PathService
32
- The singleton instance of the PathService class.
33
- """
34
- # Use the lock to ensure thread-safe instantiation
35
- with cls._lock:
36
- if cls._instance is None:
37
- cls._instance = super().__new__(cls)
38
- cls._instance._initialize()
39
- return cls._instance
40
-
41
- def _initialize(self):
42
- """
43
- Initializes the instance by setting the base path to the current working directory.
44
- """
45
- self.base_path = Path(os.getcwd())
46
-
47
- def resolve(self, route: str) -> str:
48
- """
49
- Resolves and returns the absolute path as a string.
50
-
51
- This method combines the base path (current working directory) with the provided
52
- relative path, resolves it to an absolute path, and validates that it exists
53
- and is either a directory or a file.
54
-
55
- Parameters
56
- ----------
57
- route : str
58
- The relative directory or file path to be resolved.
59
-
60
- Returns
61
- -------
62
- str
63
- The absolute path to the directory or file.
64
-
65
- Raises
66
- ------
67
- ValueError
68
- If the resolved path does not exist or is neither a directory nor a file.
69
- """
70
- # Combine base path with the relative route
71
- real_path = (self.base_path / route).resolve()
72
-
73
- # Validate that the path exists and is either a directory or a file
74
- if not real_path.exists():
75
- raise ValueError(f"The requested path does not exist: {real_path}")
76
- if not (real_path.is_dir() or real_path.is_file()):
77
- raise ValueError(f"The requested path is neither a directory nor a file: {real_path}")
78
-
79
- self.route = str(real_path)
80
- return self.route
81
-
82
- def __str__(self) -> str:
83
- """
84
- Returns the resolved absolute path as a string (dunder method).
85
-
86
- Returns
87
- -------
88
- str
89
- The absolute path to the directory or file.
90
- """
91
- return self.route