@danhachuel/thunderbolt 0.6.42 → 0.6.43
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.
- package/app/main.py +22 -0
- package/package.json +1 -1
package/app/main.py
CHANGED
|
@@ -39,6 +39,28 @@ import streamlit as st
|
|
|
39
39
|
ROOT = Path(__file__).resolve().parents[1]
|
|
40
40
|
if str(ROOT) not in sys.path:
|
|
41
41
|
sys.path.insert(0, str(ROOT))
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def _load_local_env() -> None:
|
|
45
|
+
for env_path in (ROOT / ".env", Path.cwd() / ".env"):
|
|
46
|
+
try:
|
|
47
|
+
if not env_path.is_file():
|
|
48
|
+
continue
|
|
49
|
+
for raw_line in env_path.read_text(encoding="utf-8").splitlines():
|
|
50
|
+
line = raw_line.strip()
|
|
51
|
+
if not line or line.startswith("#") or "=" not in line:
|
|
52
|
+
continue
|
|
53
|
+
key, value = line.split("=", 1)
|
|
54
|
+
key = key.strip()
|
|
55
|
+
value = value.strip().strip("'\"")
|
|
56
|
+
if key:
|
|
57
|
+
os.environ.setdefault(key, value)
|
|
58
|
+
except OSError as exc:
|
|
59
|
+
print(f"DEBUG: não foi possível ler {env_path}: {exc}")
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
_load_local_env()
|
|
63
|
+
|
|
42
64
|
try:
|
|
43
65
|
APP_VERSION = json.loads((ROOT / "package.json").read_text(encoding="utf-8")).get("version", "")
|
|
44
66
|
except (OSError, json.JSONDecodeError):
|
package/package.json
CHANGED