orionis 0.60.0__py3-none-any.whl → 0.63.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.
- orionis/framework.py +1 -1
- orionis/luminate/bootstrap/environment_bootstrapper.py +44 -1
- orionis/luminate/container/container.py +10 -10
- orionis/luminate/services/log/log_service.py +1 -1
- {orionis-0.60.0.dist-info → orionis-0.63.0.dist-info}/METADATA +1 -1
- {orionis-0.60.0.dist-info → orionis-0.63.0.dist-info}/RECORD +10 -10
- {orionis-0.60.0.dist-info → orionis-0.63.0.dist-info}/LICENCE +0 -0
- {orionis-0.60.0.dist-info → orionis-0.63.0.dist-info}/WHEEL +0 -0
- {orionis-0.60.0.dist-info → orionis-0.63.0.dist-info}/entry_points.txt +0 -0
- {orionis-0.60.0.dist-info → orionis-0.63.0.dist-info}/top_level.txt +0 -0
orionis/framework.py
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
import ast
|
1
2
|
import os
|
2
3
|
from pathlib import Path
|
3
4
|
from typing import Dict
|
@@ -62,10 +63,52 @@ class EnvironmentBootstrapper(IEnvironmentBootstrapper):
|
|
62
63
|
raise PermissionError(f"Cannot create `.env` file at {path}: {str(e)}")
|
63
64
|
|
64
65
|
try:
|
65
|
-
|
66
|
+
all_vars = dotenv_values(path)
|
67
|
+
for key, value in all_vars.items():
|
68
|
+
self._environment_vars[key] = self._parse_value(value)
|
66
69
|
except Exception as e:
|
67
70
|
raise BootstrapRuntimeError(f"Error loading environment variables from {path}: {str(e)}")
|
68
71
|
|
72
|
+
def _parse_value(self, value):
|
73
|
+
"""
|
74
|
+
Parse and convert a string value into its appropriate Python data type.
|
75
|
+
|
76
|
+
This function handles conversion for common types such as `None`, booleans (`True`/`False`),
|
77
|
+
integers, and Python literals (e.g., lists, dictionaries). If the value cannot be parsed
|
78
|
+
into a specific type, it is returned as-is.
|
79
|
+
|
80
|
+
Parameters
|
81
|
+
----------
|
82
|
+
value : str or None
|
83
|
+
The value to be parsed. If `None`, it is returned as `None`.
|
84
|
+
|
85
|
+
Returns
|
86
|
+
-------
|
87
|
+
any
|
88
|
+
The parsed value. Possible return types include:
|
89
|
+
- `None` if the value is empty, `None`, `'None'`, or `'null'`.
|
90
|
+
- `bool` if the value is `'True'`, `'true'`, `'False'`, or `'false'`.
|
91
|
+
- `int` if the value is a digit string (e.g., `'123'`).
|
92
|
+
- Python literals (e.g., lists, dictionaries) if the value can be evaluated as such.
|
93
|
+
- The original value if no conversion is applicable.
|
94
|
+
"""
|
95
|
+
# Strip leading and trailing whitespace from the value
|
96
|
+
value = str(value).strip() if value is not None else None
|
97
|
+
|
98
|
+
# Parse common types and Python literals
|
99
|
+
if not value or value.lower() in {'none', 'null'}:
|
100
|
+
return None
|
101
|
+
if value.lower() in {'true', 'false'}:
|
102
|
+
return value.lower() == 'true'
|
103
|
+
if value.isdigit():
|
104
|
+
return int(value)
|
105
|
+
|
106
|
+
# Attempt to parse Python literals (e.g., lists, dictionaries)
|
107
|
+
try:
|
108
|
+
return ast.literal_eval(value)
|
109
|
+
except (ValueError, SyntaxError):
|
110
|
+
return value
|
111
|
+
|
69
112
|
def get(self, key: str = None) -> str:
|
70
113
|
"""
|
71
114
|
Retrieves the value of an environment variable by its key.
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import inspect
|
2
2
|
from collections import deque
|
3
3
|
from threading import Lock
|
4
|
-
from typing import Callable, Any, Dict
|
4
|
+
from typing import Callable, Any, Dict, get_args, get_origin
|
5
5
|
from orionis.contracts.container.i_container import IContainer
|
6
6
|
from orionis.luminate.container.exception import OrionisContainerException, OrionisContainerValueError, OrionisContainerTypeError
|
7
7
|
from orionis.luminate.container.types import Types
|
@@ -375,27 +375,27 @@ class Container(IContainer):
|
|
375
375
|
unresolved_dependencies.append(param_name)
|
376
376
|
continue
|
377
377
|
|
378
|
+
# Resolve parameters with default values (without annotations)
|
379
|
+
if param.default is not param.empty:
|
380
|
+
resolved_dependencies[param_name] = param.default
|
381
|
+
continue
|
382
|
+
|
378
383
|
# Resolve dependencies based on annotations (excluding primitive types)
|
379
384
|
if param.annotation is not param.empty:
|
380
385
|
param_type = param.annotation
|
381
386
|
|
382
|
-
# Check if it's a
|
383
|
-
if
|
387
|
+
# Check if it's a generic type, get the origin type
|
388
|
+
if get_origin(param_type) is not None:
|
389
|
+
param_type = get_args(param_type)[0]
|
384
390
|
|
385
|
-
|
391
|
+
if isinstance(param_type, type) and not issubclass(param_type, (int, str, bool, float)):
|
386
392
|
if self.has(param_type):
|
387
393
|
resolved_dependencies[param_name] = self.make(f"{param_type.__module__}.{param_type.__name__}")
|
388
394
|
else:
|
389
395
|
resolved_dependencies[param_name] = self._resolve_dependency(param_type)
|
390
396
|
else:
|
391
|
-
|
392
|
-
# It's a primitive, use as-is
|
393
397
|
resolved_dependencies[param_name] = param_type
|
394
398
|
|
395
|
-
# Resolve parameters with default values (without annotations)
|
396
|
-
elif param.default is not param.empty:
|
397
|
-
resolved_dependencies[param_name] = param.default
|
398
|
-
|
399
399
|
# Step 4: Resolve any remaining unresolved dependencies.
|
400
400
|
while unresolved_dependencies:
|
401
401
|
dep_name = unresolved_dependencies.popleft()
|
@@ -92,7 +92,7 @@ class LogguerService(ILogguerService):
|
|
92
92
|
datefmt="%Y-%m-%d %H:%M:%S",
|
93
93
|
encoding="utf-8",
|
94
94
|
handlers=[
|
95
|
-
logging.FileHandler(path)
|
95
|
+
logging.FileHandler(path, encoding="utf-8")
|
96
96
|
# logging.StreamHandler() # Uncomment to also log to the console
|
97
97
|
]
|
98
98
|
)
|
@@ -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=
|
3
|
+
orionis/framework.py,sha256=ZuUvKxunOXlKqb9G5nSdHe_2J3Jl6lcoo6_U7tIdNUg,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
|
@@ -59,7 +59,7 @@ orionis/luminate/app_context.py,sha256=XREVkOHU6aP8UB2daA2QbFcOCB8HRmcGXjVbrlW1A
|
|
59
59
|
orionis/luminate/bootstrap/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
60
60
|
orionis/luminate/bootstrap/command_bootstrapper.py,sha256=OU0hDMtG1xqVbvCneq4C5mlOUu9OmfkxqbvGH59QsUw,6919
|
61
61
|
orionis/luminate/bootstrap/config_bootstrapper.py,sha256=Gw83UtPAOggwzqmz062JfJcpIfmZvmIQyZJfgVFiIcQ,7474
|
62
|
-
orionis/luminate/bootstrap/environment_bootstrapper.py,sha256=
|
62
|
+
orionis/luminate/bootstrap/environment_bootstrapper.py,sha256=z8pbnT2oc_NDzqMtgsF6r_JWt5bvGFNenNb30HeRl2A,5219
|
63
63
|
orionis/luminate/bootstrap/exception_bootstrapper.py,sha256=wDKfEW295c7-bavr7YUHK2CLYcTSZgjT9ZRSBne6GOE,1356
|
64
64
|
orionis/luminate/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
65
65
|
orionis/luminate/config/app.py,sha256=7teuVPuaV2ao0M5Bv-jhSgjEwb9DtVwde2saTRmYru4,1737
|
@@ -94,7 +94,7 @@ orionis/luminate/console/output/progress_bar.py,sha256=ssi8Drryr-shl7OxweTgGOhvR
|
|
94
94
|
orionis/luminate/console/output/styles.py,sha256=2e1_FJdNpKaVqmdlCx-udzTleH_6uEFE9_TjH7T1ZUk,3696
|
95
95
|
orionis/luminate/console/tasks/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
96
96
|
orionis/luminate/console/tasks/scheduler.py,sha256=zt4p2VGUYGGrG2-E-MxyheKjBqGDJB2c0irULDsBgIw,22678
|
97
|
-
orionis/luminate/container/container.py,sha256=
|
97
|
+
orionis/luminate/container/container.py,sha256=SKC7IyiAaeySiSvlRbTZRTTe4i_Jvm2N8O9Di8It6_I,16350
|
98
98
|
orionis/luminate/container/exception.py,sha256=ap1SqYEjQEEHXJJTNmL7V1jrmRjgT5_7geZ95MYkhMA,1691
|
99
99
|
orionis/luminate/container/types.py,sha256=BDcXN0__voRNHZ5Gr5dF0sWIYAQyNk4TxAwILBWyDAA,1735
|
100
100
|
orionis/luminate/facades/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -123,7 +123,7 @@ orionis/luminate/services/config/config_service.py,sha256=TZa3WZtDKEW6p0bMktzMXn
|
|
123
123
|
orionis/luminate/services/files/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
124
124
|
orionis/luminate/services/files/path_service.py,sha256=opLl1k0QLPv9u9GCKENyRsLKhupM_0BDjXE_elk47EU,3039
|
125
125
|
orionis/luminate/services/log/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
126
|
-
orionis/luminate/services/log/log_service.py,sha256=
|
126
|
+
orionis/luminate/services/log/log_service.py,sha256=aiENimOQHqaEAsBJz2_698bt1IeJjddHnledLKfg25o,5262
|
127
127
|
orionis/luminate/support/dot_dict.py,sha256=FVHfBuAGTTVMjNG01Fix645fRNKKUMmNx61pYkxPL5c,1253
|
128
128
|
orionis/luminate/support/exception_to_dict.py,sha256=jpQ-c7ud1JLm8dTWbvMT1dI-rL3yTB2P8VxNscAX71k,2098
|
129
129
|
orionis/luminate/support/reflection.py,sha256=VYpluTQJ0W_m6jYQ9_L02sYFrk2wlLYtLY2yp9rZMKA,11944
|
@@ -144,9 +144,9 @@ tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
144
144
|
tests/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
145
145
|
tests/tools/class_example.py,sha256=dIPD997Y15n6WmKhWoOFSwEldRm9MdOHTZZ49eF1p3c,1056
|
146
146
|
tests/tools/test_reflection.py,sha256=bhLQ7VGVod4B8sv-rW9AjnOumvaBVsoxieA3sdoM2yM,5244
|
147
|
-
orionis-0.
|
148
|
-
orionis-0.
|
149
|
-
orionis-0.
|
150
|
-
orionis-0.
|
151
|
-
orionis-0.
|
152
|
-
orionis-0.
|
147
|
+
orionis-0.63.0.dist-info/LICENCE,sha256=-_4cF2EBKuYVS_SQpy1uapq0oJPUU1vl_RUWSy2jJTo,1111
|
148
|
+
orionis-0.63.0.dist-info/METADATA,sha256=kwu4WjDZvu4j6P41DLtWBKvHNa5oyKeG9N504f2DezM,2978
|
149
|
+
orionis-0.63.0.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
150
|
+
orionis-0.63.0.dist-info/entry_points.txt,sha256=eef1_CVewfokKjrGBynXa06KabSJYo7LlDKKIKvs1cM,53
|
151
|
+
orionis-0.63.0.dist-info/top_level.txt,sha256=2bdoHgyGZhOtLAXS6Om8OCTmL24dUMC_L1quMe_ETbk,14
|
152
|
+
orionis-0.63.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|