llm / scripts /setup_env.py
Aswin480
feat: initial commit for PABOT Personal Operating System
34b54ad
Raw History Blame Contribute Delete
1.18 kB
"""
Environment Setup & Validation Script
"""
import secrets
from pathlib import Path
def setup():
root = Path(__file__).resolve().parents[1]
env_file = root / ".env"
env_example = root / ".env.example"
print("=== Personal OS Setup ===")
# Create .env if not exists
if not env_file.exists() and env_example.exists():
print("[+] Creating .env from .env.example...")
with open(env_example, encoding="utf-8") as src:
content = src.read()
secret_key = secrets.token_hex(32)
content = content.replace(
"generate_a_secure_random_string_here_minimum_32_chars", secret_key
)
with open(env_file, "w", encoding="utf-8") as dst:
dst.write(content)
print("[+] .env generated with secure random SECRET_KEY.")
else:
print("[+] .env file already present.")
# Create data directories
data_dir = root / "data" / "artifacts"
data_dir.mkdir(parents=True, exist_ok=True)
print(f"[+] Artifact storage directory ready at: {data_dir}")
print("\nSetup complete! You can now run:\n powershell scripts/dev.ps1")
if __name__ == "__main__":
setup()