orionis 0.59.0__py3-none-any.whl → 0.62.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/app.py +6 -1
- orionis/luminate/bootstrap/environment_bootstrapper.py +73 -2
- {orionis-0.59.0.dist-info → orionis-0.62.0.dist-info}/METADATA +1 -1
- {orionis-0.59.0.dist-info → orionis-0.62.0.dist-info}/RECORD +9 -9
- {orionis-0.59.0.dist-info → orionis-0.62.0.dist-info}/LICENCE +0 -0
- {orionis-0.59.0.dist-info → orionis-0.62.0.dist-info}/WHEEL +0 -0
- {orionis-0.59.0.dist-info → orionis-0.62.0.dist-info}/entry_points.txt +0 -0
- {orionis-0.59.0.dist-info → orionis-0.62.0.dist-info}/top_level.txt +0 -0
orionis/framework.py
CHANGED
orionis/luminate/app.py
CHANGED
@@ -1,6 +1,8 @@
|
|
1
|
+
import json
|
1
2
|
from orionis.luminate.container.container import Container
|
2
3
|
from orionis.luminate.bootstrap.config_bootstrapper import ConfigBootstrapper
|
3
4
|
from orionis.luminate.bootstrap.command_bootstrapper import CommandsBootstrapper
|
5
|
+
from orionis.luminate.bootstrap.environment_bootstrapper import EnvironmentBootstrapper
|
4
6
|
from orionis.luminate.patterns.singleton import SingletonMeta
|
5
7
|
|
6
8
|
class Application(metaclass=SingletonMeta):
|
@@ -22,7 +24,10 @@ class Application(metaclass=SingletonMeta):
|
|
22
24
|
commands_bootstrapper_key = self.container.singleton(CommandsBootstrapper)
|
23
25
|
commands_bootstrapper: CommandsBootstrapper = self.container.make(commands_bootstrapper_key)
|
24
26
|
self._commands = commands_bootstrapper.get()
|
25
|
-
|
27
|
+
|
28
|
+
environment_bootstrapper_key = self.container.singleton(EnvironmentBootstrapper)
|
29
|
+
environment_bootstrapper: EnvironmentBootstrapper = self.container.make(environment_bootstrapper_key)
|
30
|
+
self._environment = environment_bootstrapper.get()
|
26
31
|
|
27
32
|
def isBooted(self):
|
28
33
|
return True
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import ast
|
1
2
|
import os
|
2
3
|
from pathlib import Path
|
3
4
|
from typing import Dict
|
@@ -62,6 +63,76 @@ 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
|
-
raise BootstrapRuntimeError(f"Error loading environment variables from {path}: {str(e)}")
|
70
|
+
raise BootstrapRuntimeError(f"Error loading environment variables from {path}: {str(e)}")
|
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
|
+
|
112
|
+
def get(self, key: str = None) -> str:
|
113
|
+
"""
|
114
|
+
Retrieves the value of an environment variable by its key.
|
115
|
+
|
116
|
+
Parameters
|
117
|
+
----------
|
118
|
+
key : str
|
119
|
+
The key of the environment variable to retrieve.
|
120
|
+
|
121
|
+
Returns
|
122
|
+
-------
|
123
|
+
str
|
124
|
+
The value of the environment variable.
|
125
|
+
|
126
|
+
Raises
|
127
|
+
------
|
128
|
+
KeyError
|
129
|
+
If the environment variable does not exist.
|
130
|
+
"""
|
131
|
+
|
132
|
+
if not key:
|
133
|
+
return self._environment_vars
|
134
|
+
|
135
|
+
if key not in self._environment_vars:
|
136
|
+
raise KeyError(f"Environment variable {key} not found")
|
137
|
+
|
138
|
+
return self._environment_vars[key]
|
@@ -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=HTxNkMZYihg6FyaLRbHW6lGFDSyb1N_HQUVKTvWmxaI,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
|
@@ -54,12 +54,12 @@ orionis/installer/installer_manager.py,sha256=Hb6T0bmSl39T30maY-nUWkrLhG77JdrKe4
|
|
54
54
|
orionis/installer/installer_output.py,sha256=LeKxzuXpnHOKbKpUtx3tMGkCi2bGcPV1VNnfBxwfxUU,7161
|
55
55
|
orionis/installer/installer_setup.py,sha256=c2HtVklSa-2_-YVonc7fwtoK-RTDqBS2Ybvbekgfqtc,6970
|
56
56
|
orionis/luminate/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
57
|
-
orionis/luminate/app.py,sha256=
|
57
|
+
orionis/luminate/app.py,sha256=RqhaFbBQH78t3IgSQc0FHrsSW414UDgee5e6Oy8JHEY,1446
|
58
58
|
orionis/luminate/app_context.py,sha256=XREVkOHU6aP8UB2daA2QbFcOCB8HRmcGXjVbrlW1AHQ,1827
|
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
|
@@ -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.62.0.dist-info/LICENCE,sha256=-_4cF2EBKuYVS_SQpy1uapq0oJPUU1vl_RUWSy2jJTo,1111
|
148
|
+
orionis-0.62.0.dist-info/METADATA,sha256=rTftP4uxxhD0e3X4C6lwBSDHEKb2ylRyyB1Q8x-ZGZg,2978
|
149
|
+
orionis-0.62.0.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
150
|
+
orionis-0.62.0.dist-info/entry_points.txt,sha256=eef1_CVewfokKjrGBynXa06KabSJYo7LlDKKIKvs1cM,53
|
151
|
+
orionis-0.62.0.dist-info/top_level.txt,sha256=2bdoHgyGZhOtLAXS6Om8OCTmL24dUMC_L1quMe_ETbk,14
|
152
|
+
orionis-0.62.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|