-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_setup.py
More file actions
executable file
·160 lines (139 loc) · 5.5 KB
/
test_setup.py
File metadata and controls
executable file
·160 lines (139 loc) · 5.5 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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
#!/usr/bin/env python3
"""
Setup verification script
Checks if all required files and dependencies are in place
"""
import sys
import os
from pathlib import Path
def check_file(path, description):
"""Check if a file exists"""
if Path(path).exists():
print(f"✅ {description}")
return True
else:
print(f"❌ {description} - NOT FOUND: {path}")
return False
def check_env_file(path, app_name):
"""Check if .env file exists and has API key"""
if not Path(path).exists():
print(f"❌ {app_name}: .env file not found")
return False
with open(path) as f:
content = f.read()
if "ANTHROPIC_API_KEY=sk-" in content or "ANTHROPIC_API_KEY=your_api_key_here" in content:
if "your_api_key_here" in content:
print(f"⚠️ {app_name}: .env exists but API key not set")
return False
print(f"✅ {app_name}: .env configured")
return True
else:
print(f"❌ {app_name}: .env missing API key")
return False
def check_python_module(module_name):
"""Check if a Python module is installed"""
try:
__import__(module_name)
print(f"✅ Python package: {module_name}")
return True
except ImportError:
print(f"❌ Python package missing: {module_name}")
return False
def main():
print("=" * 60)
print("Conversational AI Agents - Setup Verification")
print("=" * 60)
print()
all_good = True
# Check Python version
print("🐍 Checking Python version...")
version = sys.version_info
if version.major == 3 and version.minor >= 8:
print(f"✅ Python {version.major}.{version.minor}.{version.micro}")
else:
print(f"❌ Python version too old: {version.major}.{version.minor}")
print(" Required: Python 3.8 or higher")
all_good = False
print()
# Check project structure
print("📁 Checking project structure...")
structure_checks = [
("README.md", "Main README"),
("QUICKSTART.md", "Quick start guide"),
("company-research-assistant/backend/main.py", "Research Assistant backend"),
("company-research-assistant/backend/serve_frontend.py", "Research Assistant server"),
("company-research-assistant/backend/requirements.txt", "Research Assistant requirements"),
("company-research-assistant/frontend/templates/index.html", "Research Assistant frontend"),
("company-research-assistant/frontend/static/app.js", "Research Assistant JavaScript"),
("interview-practice-partner/backend/main.py", "Interview Partner backend"),
("interview-practice-partner/backend/serve_frontend.py", "Interview Partner server"),
("interview-practice-partner/backend/requirements.txt", "Interview Partner requirements"),
("interview-practice-partner/frontend/templates/index.html", "Interview Partner frontend"),
("interview-practice-partner/frontend/static/app.js", "Interview Partner JavaScript"),
]
for path, desc in structure_checks:
if not check_file(path, desc):
all_good = False
print()
# Check environment files
print("🔑 Checking environment configuration...")
env_checks = [
("company-research-assistant/backend/.env", "Company Research Assistant"),
("interview-practice-partner/backend/.env", "Interview Practice Partner"),
]
env_ok = True
for path, app_name in env_checks:
if not check_env_file(path, app_name):
env_ok = False
if not env_ok:
print()
print("⚠️ To fix: Run ./setup.sh and add your ANTHROPIC_API_KEY to .env files")
all_good = False
print()
# Check Python dependencies
print("📦 Checking Python packages...")
packages = ["fastapi", "uvicorn", "anthropic", "pydantic"]
for package in packages:
if not check_python_module(package):
all_good = False
if not all([check_python_module(p) for p in packages]):
print()
print("⚠️ To fix: Run ./setup.sh or:")
print(" pip install -r company-research-assistant/backend/requirements.txt")
print(" pip install -r interview-practice-partner/backend/requirements.txt")
print()
# Check executable permissions
print("🔧 Checking script permissions...")
scripts = ["setup.sh", "start-research-assistant.sh", "start-interview-partner.sh", "start-all-in-one.sh"]
for script in scripts:
if Path(script).exists():
if os.access(script, os.X_OK):
print(f"✅ {script} is executable")
else:
print(f"⚠️ {script} not executable - run: chmod +x {script}")
else:
print(f"⚠️ {script} not found")
print()
# Final verdict
print("=" * 60)
if all_good and env_ok:
print("✅ ALL CHECKS PASSED!")
print()
print("You're ready to run the applications:")
print(" ./start-all-in-one.sh")
print()
print("Or run them separately:")
print(" ./start-research-assistant.sh")
print(" ./start-interview-partner.sh")
else:
print("⚠️ SOME CHECKS FAILED")
print()
print("Please fix the issues above and run this script again.")
print()
print("Quick fix:")
print(" 1. Run: ./setup.sh")
print(" 2. Add your ANTHROPIC_API_KEY to the .env files")
print(" 3. Run this script again: python test_setup.py")
print("=" * 60)
if __name__ == "__main__":
main()