orionis 0.286.0__py3-none-any.whl → 0.287.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 (57) hide show
  1. orionis/metadata/framework.py +1 -1
  2. orionis/services/environment/contracts/env.py +45 -50
  3. orionis/services/environment/dot_env.py +205 -181
  4. orionis/services/environment/env.py +68 -85
  5. orionis/services/environment/exceptions/environment_value_error.py +18 -0
  6. orionis/services/environment/exceptions/environment_value_exception.py +23 -0
  7. orionis/services/environment/type_hint.py +559 -0
  8. orionis/test/logs/history.py +3 -5
  9. {orionis-0.286.0.dist-info → orionis-0.287.0.dist-info}/METADATA +1 -1
  10. {orionis-0.286.0.dist-info → orionis-0.287.0.dist-info}/RECORD +56 -54
  11. tests/example/test_example.py +5 -2
  12. tests/foundation/config/app/test_app.py +13 -3
  13. tests/foundation/config/auth/test_auth.py +9 -4
  14. tests/foundation/config/cache/test_cache.py +60 -15
  15. tests/foundation/config/cache/test_cache_file.py +62 -14
  16. tests/foundation/config/cache/test_cache_stores.py +74 -14
  17. tests/foundation/config/cors/test_cors.py +102 -33
  18. tests/foundation/config/database/test_database.py +38 -14
  19. tests/foundation/config/database/test_database_connections.py +79 -5
  20. tests/foundation/config/database/test_database_mysql.py +138 -15
  21. tests/foundation/config/database/test_database_oracle.py +110 -26
  22. tests/foundation/config/database/test_database_pgsql.py +96 -26
  23. tests/foundation/config/database/test_database_sqlite.py +56 -2
  24. tests/foundation/config/exceptions/test_exceptions_integrity.py +44 -10
  25. tests/foundation/config/filesystems/test_filesystems.py +64 -14
  26. tests/foundation/config/filesystems/test_filesystems_aws.py +45 -7
  27. tests/foundation/config/filesystems/test_filesystems_disks.py +78 -8
  28. tests/foundation/config/filesystems/test_filesystems_local.py +66 -18
  29. tests/foundation/config/filesystems/test_filesystems_public.py +37 -0
  30. tests/foundation/config/logging/test_logging.py +75 -11
  31. tests/foundation/config/logging/test_logging_channels.py +79 -2
  32. tests/foundation/config/logging/test_logging_chunked.py +85 -12
  33. tests/foundation/config/logging/test_logging_daily.py +79 -12
  34. tests/foundation/config/logging/test_logging_hourly.py +68 -2
  35. tests/foundation/config/logging/test_logging_monthly.py +48 -2
  36. tests/foundation/config/logging/test_logging_stack.py +49 -14
  37. tests/foundation/config/logging/test_logging_weekly.py +92 -2
  38. tests/foundation/config/mail/test_mail.py +87 -15
  39. tests/foundation/config/mail/test_mail_file.py +40 -4
  40. tests/foundation/config/mail/test_mail_mailers.py +56 -8
  41. tests/foundation/config/mail/test_mail_smtp.py +58 -14
  42. tests/foundation/config/queue/test_queue.py +62 -9
  43. tests/foundation/config/queue/test_queue_brokers.py +27 -10
  44. tests/foundation/config/queue/test_queue_database.py +53 -15
  45. tests/foundation/config/root/test_root_paths.py +69 -2
  46. tests/foundation/config/session/test_session.py +30 -1
  47. tests/foundation/config/startup/test_config_startup.py +77 -7
  48. tests/foundation/config/testing/test_testing.py +68 -0
  49. tests/patterns/singleton/test_singleton.py +10 -1
  50. tests/services/environment/test_env.py +3 -4
  51. tests/testing/test_testing_result.py +56 -19
  52. tests/testing/test_testing_unit.py +93 -24
  53. orionis/services/environment/exceptions/value_exception.py +0 -27
  54. {orionis-0.286.0.dist-info → orionis-0.287.0.dist-info}/WHEEL +0 -0
  55. {orionis-0.286.0.dist-info → orionis-0.287.0.dist-info}/licenses/LICENCE +0 -0
  56. {orionis-0.286.0.dist-info → orionis-0.287.0.dist-info}/top_level.txt +0 -0
  57. {orionis-0.286.0.dist-info → orionis-0.287.0.dist-info}/zip-safe +0 -0
@@ -5,7 +5,7 @@
5
5
  NAME = "orionis"
6
6
 
7
7
  # Current version of the framework
8
- VERSION = "0.286.0"
8
+ VERSION = "0.287.0"
9
9
 
10
10
  # Full name of the author or maintainer of the project
11
11
  AUTHOR = "Raul Mauricio Uñate Castro"
@@ -1,36 +1,47 @@
1
- from typing import Any, Dict, Optional
1
+ from typing import Any, Dict
2
2
  from abc import ABC, abstractmethod
3
3
 
4
4
  class IEnv(ABC):
5
- """Interface contract for environment management operations."""
6
5
 
7
6
  @staticmethod
8
7
  @abstractmethod
9
- def get(key: str, default: Optional[Any] = None) -> Any:
8
+ def get(key: str, default: Any = None) -> Any:
10
9
  """
11
- Retrieves an environment variable's value.
12
-
13
- Args:
14
- key: Environment variable name
15
- default: Default value if key doesn't exist
16
-
17
- Returns:
18
- The parsed value or default if not found
10
+ Retrieve the value of an environment variable by key.
11
+
12
+ Parameters
13
+ ----------
14
+ key : str
15
+ The name of the environment variable to retrieve.
16
+ default : Any, optional
17
+ The value to return if the key is not found. Default is None.
18
+
19
+ Returns
20
+ -------
21
+ Any
22
+ The value of the environment variable if found, otherwise the default value.
19
23
  """
20
24
  pass
21
25
 
22
26
  @staticmethod
23
27
  @abstractmethod
24
- def set(key: str, value: str) -> bool:
28
+ def set(key: str, value: str, type: str = None) -> bool:
25
29
  """
26
- Sets an environment variable.
27
-
28
- Args:
29
- key: Environment variable name
30
- value: Value to set
31
-
32
- Returns:
33
- True if successful, False otherwise
30
+ Set an environment variable in the .env file.
31
+
32
+ Parameters
33
+ ----------
34
+ key : str
35
+ The name of the environment variable to set.
36
+ value : str
37
+ The value to assign to the environment variable.
38
+ type : str, optional
39
+ The type of the environment variable (e.g., 'str', 'int'). Default is None.
40
+
41
+ Returns
42
+ -------
43
+ bool
44
+ True if the variable was set successfully, False otherwise.
34
45
  """
35
46
  pass
36
47
 
@@ -38,13 +49,17 @@ class IEnv(ABC):
38
49
  @abstractmethod
39
50
  def unset(key: str) -> bool:
40
51
  """
41
- Removes an environment variable.
52
+ Remove the specified environment variable from the .env file.
42
53
 
43
- Args:
44
- key: Environment variable name
54
+ Parameters
55
+ ----------
56
+ key : str
57
+ The name of the environment variable to remove.
45
58
 
46
- Returns:
47
- True if successful, False otherwise
59
+ Returns
60
+ -------
61
+ bool
62
+ True if the variable was successfully removed, False otherwise.
48
63
  """
49
64
  pass
50
65
 
@@ -52,31 +67,11 @@ class IEnv(ABC):
52
67
  @abstractmethod
53
68
  def all() -> Dict[str, Any]:
54
69
  """
55
- Retrieves all environment variables.
56
-
57
- Returns:
58
- Dictionary of all key-value pairs
59
- """
60
- pass
61
-
62
- @staticmethod
63
- @abstractmethod
64
- def toJson() -> str:
65
- """
66
- Serializes environment to JSON.
67
-
68
- Returns:
69
- JSON string representation
70
- """
71
- pass
72
-
73
- @staticmethod
74
- @abstractmethod
75
- def toBase64() -> str:
76
- """
77
- Encodes environment to Base64.
70
+ Retrieve all environment variables as a dictionary.
78
71
 
79
- Returns:
80
- Base64 encoded string
72
+ Returns
73
+ -------
74
+ dict of str to Any
75
+ A dictionary containing all environment variables loaded by DotEnv.
81
76
  """
82
77
  pass
@@ -5,243 +5,267 @@ from pathlib import Path
5
5
  from typing import Any, Optional, Union
6
6
  from dotenv import dotenv_values, load_dotenv, set_key, unset_key
7
7
  from orionis.patterns.singleton.meta_class import Singleton
8
- from orionis.services.environment.exceptions.value_exception import OrionisEnvironmentValueException
8
+ from orionis.services.environment.exceptions.environment_value_exception import OrionisEnvironmentValueException
9
+ from orionis.services.environment.exceptions.environment_value_error import OrionisEnvironmentValueError
10
+ from orionis.services.environment.type_hint import EnvTypes
9
11
 
10
12
  class DotEnv(metaclass=Singleton):
11
- """
12
- DotEnv is a singleton class for managing environment variables using a `.env` file.
13
- This class provides methods to load, get, set, unset, and list environment variables,
14
- with automatic serialization and deserialization of common Python data types.
15
- It ensures that changes to the `.env` file are reflected in the current process's
16
- environment variables and vice versa.
17
- """
18
13
 
14
+ # Thread-safe singleton instance lock
19
15
  _lock = threading.RLock()
20
16
 
21
17
  def __init__(self, path: str = None) -> None:
22
18
  """
23
- Initializes the environment service by resolving the path to the `.env` file, ensuring its existence,
19
+ Initialize the environment service by resolving the path to the `.env` file, ensuring its existence,
24
20
  and loading environment variables from it.
25
- Args:
26
- path (str, optional): The path to the `.env` file. If not provided, defaults to a `.env` file
27
- in the current working directory.
28
- Raises:
29
- OSError: If the `.env` file cannot be created when it does not exist.
30
- """
31
-
32
- with self._lock:
33
- if path:
34
- self._resolved_path = Path(path).expanduser().resolve()
35
- else:
36
- self._resolved_path = Path(os.getcwd()) / ".env"
37
21
 
38
- if not self._resolved_path.exists():
39
- self._resolved_path.touch()
22
+ Parameters
23
+ ----------
24
+ path : str, optional
25
+ Path to the `.env` file. If not provided, defaults to a `.env` file
26
+ in the current working directory.
40
27
 
41
- load_dotenv(self._resolved_path)
42
-
43
- def get(self, key: str, default: Optional[Any] = None, is_path:bool=False) -> Any:
28
+ Raises
29
+ ------
30
+ OSError
31
+ If the `.env` file cannot be created when it does not exist.
44
32
  """
45
- Retrieve the value of an environment variable by key.
46
-
47
- This method first attempts to fetch the value from the dotenv file specified by
48
- `self._resolved_path`. If the key is not found in the dotenv file, it falls back
49
- to the system environment variables. If the key is not found in either location,
50
- the provided `default` value is returned.
33
+ try:
34
+ with self._lock:
35
+ if path:
36
+ self._resolved_path = Path(path).expanduser().resolve()
37
+ else:
38
+ self._resolved_path = Path(os.getcwd()) / ".env"
51
39
 
52
- The returned value is parsed using the internal `__parseValue` method if found.
40
+ if not self._resolved_path.exists():
41
+ self._resolved_path.touch()
53
42
 
54
- Args:
55
- key (str): The name of the environment variable to retrieve.
56
- default (Optional[Any], optional): The value to return if the key is not found.
57
- Defaults to None.
58
- is_path (bool, optional): If True, the value is treated as a file path and backslashes are replaced with forward slashes.
59
- This is useful for Windows paths. Defaults to False.
43
+ load_dotenv(self._resolved_path)
44
+ except OSError as e:
45
+ raise OSError(f"Failed to create or access the .env file at {self._resolved_path}: {e}")
60
46
 
61
- Returns:
62
- Any: The parsed value of the environment variable, or the default if not found.
47
+ def get(self, key: str, default: Optional[Any] = None) -> Any:
48
+ """
49
+ Get the value of an environment variable.
50
+
51
+ Parameters
52
+ ----------
53
+ key : str
54
+ Name of the environment variable to retrieve.
55
+ default : Any, optional
56
+ Value to return if the key is not found. Default is None.
57
+
58
+ Returns
59
+ -------
60
+ Any
61
+ Parsed value of the environment variable, or `default` if not found.
62
+
63
+ Raises
64
+ ------
65
+ OrionisEnvironmentValueError
66
+ If `key` is not a string.
63
67
  """
64
68
  with self._lock:
69
+
70
+ # Ensure the key is a string.
71
+ if not isinstance(key, str):
72
+ raise OrionisEnvironmentValueError(
73
+ f"Key must be a string, got {type(key).__name__}."
74
+ )
75
+
76
+ # Get the value from the .env file or the current environment.
65
77
  value = dotenv_values(self._resolved_path).get(key)
78
+
79
+ # If the value is not found in the .env file, check the current environment variables.
66
80
  if value is None:
67
81
  value = os.getenv(key)
68
- return self.__parseValue(value, is_path) if value is not None else default
69
82
 
70
- def set(self, key: str, value: Union[str, int, float, bool, list, dict], is_path:bool=False) -> bool:
71
- """
72
- Sets an environment variable with the specified key and value.
73
-
74
- This method serializes the given value and updates both the .env file and the current process's environment variables.
75
-
76
- Args:
77
- key (str): The name of the environment variable to set.
78
- value (Union[str, int, float, bool, list, dict]): The value to assign to the environment variable. Supported types include string, integer, float, boolean, list, and dictionary.
79
- is_path (bool, optional): If True, the value is treated as a file path and backslashes are replaced with forward slashes.
80
- This is useful for Windows paths. Defaults to False.
83
+ # Parse the value using the internal __parseValue method and return it
84
+ return self.__parseValue(value) if value is not None else default
81
85
 
82
- Returns:
83
- bool: True if the environment variable was successfully set.
86
+ def __parseValue(self, value: Any) -> Any:
84
87
  """
85
-
86
- with self._lock:
87
- serialized_value = self.__serializeValue(value, is_path)
88
- set_key(str(self._resolved_path), key, serialized_value)
89
- os.environ[key] = str(value)
90
- return True
91
-
92
- def unset(self, key: str) -> bool:
88
+ Parse and convert the input value to an appropriate Python data type with enhanced features.
89
+
90
+ Parameters
91
+ ----------
92
+ value : Any
93
+ The value to parse and convert.
94
+
95
+ Returns
96
+ -------
97
+ Any
98
+ The parsed value, which may be of type None, bool, int, float, list, dict, or str.
99
+ - Returns None for None, empty strings, or strings like 'none', 'null', 'nan' (case-insensitive).
100
+ - Returns a boolean for 'true'/'false' strings (case-insensitive) or 1/0.
101
+ - Returns an int if the string represents an integer.
102
+ - Returns a float if the string represents a float.
103
+ - Attempts to evaluate the string as a Python literal (e.g., list, dict, tuple).
104
+ - Handles type hints via 'type:' prefix (e.g., 'int:42', 'bool:true').
105
+ - Returns the original string if no conversion is possible.
106
+
107
+ Raises
108
+ ------
109
+ OrionisEnvironmentValueException
110
+ If type conversion fails for explicitly typed values (e.g., 'abc::int').
93
111
  """
94
- Removes the specified environment variable from both the .env file and the current process environment.
112
+ # Early return for None
113
+ if value is None:
114
+ return None
95
115
 
96
- Args:
97
- key (str): The name of the environment variable to unset.
116
+ # Return immediately if already a basic type
117
+ if isinstance(value, (bool, int, float, dict, list, tuple)):
118
+ return value
98
119
 
99
- Returns:
100
- bool: True if the operation was successful.
101
- """
102
- with self._lock:
103
- unset_key(str(self._resolved_path), key)
104
- os.environ.pop(key, None)
105
- return True
120
+ # Convert to string and clean
121
+ value_str = str(value).strip()
106
122
 
107
- def all(self) -> dict:
108
- """
109
- Retrieves all environment variables from the resolved .env file.
123
+ # Handle empty strings and common null representations
124
+ # This includes 'none', 'null', 'nan', 'nil' (case-insensitive)
125
+ if not value_str or value_str.lower() in {'none', 'null', 'nan', 'nil'}:
126
+ return None
110
127
 
111
- Returns:
112
- dict: A dictionary containing all environment variable key-value pairs,
113
- with values parsed using the internal __parseValue method.
114
- """
115
- with self._lock:
116
- raw_values = dotenv_values(self._resolved_path)
117
- return {k: self.__parseValue(v) for k, v in raw_values.items()}
128
+ # Boolean detection (without type hint)
129
+ lower_val = value_str.lower()
130
+ if lower_val in ('true', 'false', 'yes', 'no', 'on', 'off', '1', '0'):
131
+ return lower_val in ('true', 'yes', 'on', '1')
118
132
 
119
- def toJson(self) -> str:
120
- """
121
- Serializes all environment variables managed by this instance to a JSON-formatted string.
133
+ # Handle type hints using the Type class
134
+ hints = EnvTypes(value_str)
135
+ if hints.hasValidTypeHint():
136
+ return hints.get()
122
137
 
123
- Returns:
124
- str: A JSON string representation of all environment variables, formatted with indentation for readability.
125
- """
126
- import json
127
- with self._lock:
128
- return json.dumps(self.all(), indent=4)
138
+ # Try parseing to literal types, if failed, return the original value
139
+ try:
140
+ return ast.literal_eval(value_str)
141
+ except (ValueError, SyntaxError):
142
+ return value_str
129
143
 
130
- def toBase64(self) -> str:
144
+ def set(self, key: str, value: Union[str, int, float, bool, list, dict, tuple, set], type_hint: str = None) -> bool:
131
145
  """
132
- Serializes all environment variables to a JSON string and encodes it in Base64.
133
-
134
- Returns:
135
- str: A Base64-encoded string representation of all environment variables.
146
+ Set an environment variable with the specified key and value.
147
+
148
+ Serializes the given value and updates both the .env file and the current process's environment variables.
149
+
150
+ Parameters
151
+ ----------
152
+ key : str
153
+ The name of the environment variable to set.
154
+ value : Union[str, int, float, bool, list, dict]
155
+ The value to assign to the environment variable. Supported types include string, integer, float, boolean, list, and dictionary.
156
+ type_hint : str, optional
157
+ The type of the value being set. If provided, it can be (path, str, int, float, bool, list, dict, tuple, set).
158
+
159
+ Returns
160
+ -------
161
+ bool
162
+ True if the environment variable was successfully set.
136
163
  """
137
- import base64
138
- import json
139
164
  with self._lock:
140
- return base64.b64encode(json.dumps(self.all()).encode()).decode()
141
-
142
- def __parseValue(self, value: Any, is_path:bool=False) -> Any:
143
- """
144
- Parses and converts the input value to an appropriate Python data type.
145
-
146
- Args:
147
- value (Any): The value to parse and convert.
148
-
149
- Returns:
150
- Any: The parsed value, which may be of type None, bool, int, float, or the original string.
151
- - Returns None for None, empty strings, or strings like 'none', 'null', 'nan' (case-insensitive).
152
- - Returns a boolean for 'true'/'false' strings (case-insensitive).
153
- - Returns an int if the string represents an integer.
154
- - Returns a float if the string represents a float.
155
- - Attempts to evaluate the string as a Python literal (e.g., list, dict, tuple).
156
- - Returns the original string if no conversion is possible.
157
- """
158
- if value is None:
159
- return None
160
-
161
- if isinstance(value, (bool, int, float)):
162
- return value
163
165
 
164
- value_str = str(value).strip()
165
- if not value_str or value_str.lower() in {'none', 'null', 'nan'}:
166
- return None
167
166
 
168
- if value_str.lower() == 'true':
169
- return True
167
+ # Ensure the value is a valid type.
168
+ if not isinstance(value, (str, int, float, bool, list, dict, tuple, set)):
169
+ raise OrionisEnvironmentValueError(
170
+ f"Unsupported value type: {type(value).__name__}. Allowed types are str, int, float, bool, list, dict, tuple, set."
171
+ )
170
172
 
171
- if value_str.lower() == 'false':
172
- return False
173
+ # Ensure the type is a string.
174
+ if not isinstance(type_hint, str):
175
+ raise OrionisEnvironmentValueError(
176
+ f"Type hint must be a string, got {type(value).__name__}."
177
+ )
173
178
 
174
- if is_path:
175
- return value_str.replace("\\", "/")
179
+ # Ensure the key is a string.
180
+ if not isinstance(key, str):
181
+ raise OrionisEnvironmentValueError(
182
+ f"Key must be a string, got {type(key).__name__}."
183
+ )
176
184
 
177
- try:
178
- if value_str.isdigit() or (value_str.startswith('-') and value_str[1:].isdigit()):
179
- return int(value_str)
180
- except Exception:
181
- pass
185
+ # Validate the type hint if provided.
186
+ options = EnvTypes.options()
187
+ if type_hint and type_hint not in options:
188
+ raise OrionisEnvironmentValueException(f"Invalid type hint: {type_hint}. Allowed types are {str(options)}.")
182
189
 
183
- try:
184
- float_val = float(value_str)
185
- if '.' in value_str or 'e' in value_str.lower():
186
- return float_val
187
- except Exception:
188
- pass
190
+ # Serialize the value based on its type.
191
+ serialized_value = self.__serializeValue(value, type_hint)
189
192
 
190
- try:
191
- return ast.literal_eval(value_str)
192
- except Exception:
193
- pass
193
+ # Set the environment variable in the .env file and the current process environment.
194
+ set_key(str(self._resolved_path), key, serialized_value)
195
+ os.environ[key] = str(value)
194
196
 
195
- return value_str
197
+ # Return True to indicate success.
198
+ return True
196
199
 
197
- def __serializeValue(self, value: Any, is_path:bool=False) -> str:
200
+ def __serializeValue(self, value: Any, type_hint: str = None) -> str:
198
201
  """
199
- Serializes a given value to a string suitable for storage in a .env file.
200
-
201
- Parameters:
202
- value (Any): The value to serialize. Supported types are None, str, bool, int, float, list, and dict.
203
- is_path (bool): If True, the value is treated as a file path and backslashes are replaced with forward slashes.
204
- This is useful for Windows paths.
205
-
206
- Returns:
207
- str: The serialized string representation of the value.
208
-
209
- Raises:
210
- OrionisEnvironmentValueException: If a float value is in scientific notation or If the value's type is not serializable for .env files.
202
+ Parameters
203
+ ----------
204
+ value : Any
205
+ The value to serialize.
206
+ type_hint : str, optional
207
+ An optional type hint to guide serialization.
208
+ Returns
209
+ -------
210
+ str
211
+ The serialized string representation of the value.
212
+ Notes
213
+ -----
214
+ - If `value` is None, returns "null".
215
+ - If `type_hint` is provided, uses `EnvTypes` to serialize.
216
+ - Uses `repr()` for lists, dicts, tuples, and sets.
217
+ - Falls back to `str()` for other types.
211
218
  """
212
- if is_path:
213
- return str(value).replace("\\", "/")
214
219
 
215
220
  if value is None:
216
- return "None"
221
+ return "null"
222
+
223
+ if type_hint:
224
+ return EnvTypes(value).to(type_hint)
217
225
 
218
226
  if isinstance(value, str):
219
- return value
227
+ return value.strip()
220
228
 
221
229
  if isinstance(value, bool):
222
230
  return str(value).lower()
223
231
 
224
- if isinstance(value, int):
232
+ if isinstance(value, int, float):
225
233
  return str(value)
226
234
 
227
- if isinstance(value, float):
228
- value = str(value)
229
- if 'e' in value or 'E' in value:
230
- raise OrionisEnvironmentValueException('scientific notation is not supported, use a string instead')
231
- return value
232
-
233
- if isinstance(value, (list, dict)):
235
+ if isinstance(value, (list, dict, tuple, set)):
234
236
  return repr(value)
235
237
 
236
- if hasattr(value, '__dict__'):
237
- raise OrionisEnvironmentValueException(f"Type {type(value).__name__} is not serializable for .env")
238
+ return str(value)
238
239
 
239
- if not isinstance(value, (list, dict, bool, int, float, str)):
240
- raise OrionisEnvironmentValueException(f"Type {type(value).__name__} is not serializable for .env")
240
+ def unset(self, key: str) -> bool:
241
+ """
242
+ Remove the specified environment variable from both the .env file and the current process environment.
241
243
 
242
- if isinstance(value, (list, dict, bool, int, float, str)):
243
- if type(value).__module__ != "builtins" and not isinstance(value, str):
244
- raise OrionisEnvironmentValueException(f"Type {type(value).__name__} is not serializable for .env")
245
- return repr(value) if not isinstance(value, str) else value
244
+ Parameters
245
+ ----------
246
+ key : str
247
+ The name of the environment variable to unset.
246
248
 
247
- raise OrionisEnvironmentValueException(f"Type {type(value).__name__} is not serializable for .env")
249
+ Returns
250
+ -------
251
+ bool
252
+ True if the operation was successful.
253
+ """
254
+ with self._lock:
255
+ unset_key(str(self._resolved_path), key)
256
+ os.environ.pop(key, None)
257
+ return True
258
+
259
+ def all(self) -> dict:
260
+ """
261
+ Retrieve all environment variables from the resolved .env file.
262
+
263
+ Returns
264
+ -------
265
+ dict
266
+ Dictionary containing all environment variable key-value pairs,
267
+ with values parsed using the internal __parseValue method.
268
+ """
269
+ with self._lock:
270
+ raw_values = dotenv_values(self._resolved_path)
271
+ return {k: self.__parseValue(v) for k, v in raw_values.items()}