-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathverify_setup.py
More file actions
127 lines (112 loc) · 3.94 KB
/
Copy pathverify_setup.py
File metadata and controls
127 lines (112 loc) · 3.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
"""
Test script to verify the Advanced To-Do List setup
"""
import os
import sys
from pathlib import Path
def check_environment():
"""Check if the environment is properly configured"""
print("\n" + "="*50)
print("Advanced To-Do List - Setup Verification")
print("="*50 + "\n")
checks_passed = 0
checks_total = 0
# Check 1: Python version
print("✓ Check 1: Python Version")
checks_total += 1
python_version = sys.version_info
print(f" Python {python_version.major}.{python_version.minor}.{python_version.micro}")
if python_version.major >= 3 and python_version.minor >= 8:
print(" ✅ PASS: Python 3.8+\n")
checks_passed += 1
else:
print(" ❌ FAIL: Python 3.8+ required\n")
# Check 2: Required files
print("✓ Check 2: Project Files")
checks_total += 1
required_files = [
'app.py',
'requirements.txt',
'.env',
'README.md',
'QUICK_START.md',
'templates/index.html',
'static/style.css',
'static/script.js'
]
all_files_exist = True
for file in required_files:
filepath = Path(file)
exists = filepath.exists()
status = "✅" if exists else "❌"
print(f" {status} {file}")
if not exists:
all_files_exist = False
if all_files_exist:
print(" ✅ PASS: All files present\n")
checks_passed += 1
else:
print(" ❌ FAIL: Missing files\n")
# Check 3: Dependencies
print("✓ Check 3: Required Packages")
checks_total += 1
packages_to_check = {
'flask': 'flask',
'flask_cors': 'flask_cors',
'dotenv': 'dotenv',
'google.generativeai': 'google.generativeai'
}
packages_installed = True
for package_name, import_name in packages_to_check.items():
try:
__import__(import_name)
print(f" ✅ {package_name}")
except ImportError:
print(f" ❌ {package_name} NOT INSTALLED")
packages_installed = False
if packages_installed:
print(" ✅ PASS: All dependencies installed\n")
checks_passed += 1
else:
print(" ⚠️ WARN: Some packages missing (run: pip install -r requirements.txt)\n")
# Check 4: Environment configuration
print("✓ Check 4: Environment Configuration")
checks_total += 1
env_file = Path('.env')
if env_file.exists():
with open('.env', 'r') as f:
content = f.read()
if 'GEMINI_API_KEY=' in content:
if 'your_api_key_here' in content:
print(" ⚠️ API Key is placeholder (update with real key)")
print(" ℹ️ Visit: https://ai.google.dev/")
print(" ⚠️ WARN: .env not fully configured\n")
else:
print(" ✅ GEMINI_API_KEY configured")
print(" ✅ PASS: Environment ready\n")
checks_passed += 1
else:
print(" ❌ GEMINI_API_KEY not found in .env")
print(" ❌ FAIL: Configuration missing\n")
else:
print(" ❌ .env file not found")
print(" ❌ FAIL: Configuration missing\n")
# Summary
print("="*50)
print(f"Results: {checks_passed}/{checks_total} checks passed")
print("="*50 + "\n")
if checks_passed == checks_total:
print("✅ All checks passed! Ready to run the app.\n")
print("Start with: python app.py")
return True
elif checks_passed >= 3:
print("⚠️ Some checks failed. Please review above.\n")
if not packages_installed:
print("Run: pip install -r requirements.txt")
return False
else:
print("❌ Critical checks failed. Setup incomplete.\n")
return False
if __name__ == '__main__':
success = check_environment()
sys.exit(0 if success else 1)