Spaces:
Sleeping
Sleeping
File size: 3,293 Bytes
d1b7767 |
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 |
#!/usr/bin/env python3
"""
Setup verification script for Cedric Agent
Checks if all dependencies are available and files are in place
"""
import sys
import os
import importlib
def check_file_exists(filepath, description):
"""Check if a file exists and print status"""
if os.path.exists(filepath):
print(f"β
{description}: {filepath}")
return True
else:
print(f"β {description}: {filepath} - MISSING")
return False
def check_module(module_name, description):
"""Check if a Python module can be imported"""
try:
importlib.import_module(module_name)
print(f"β
{description}: {module_name}")
return True
except ImportError:
print(f"β {description}: {module_name} - NOT INSTALLED")
return False
def main():
print("π Cedric Agent Setup Verification")
print("=" * 40)
all_good = True
# Check required files
print("\nπ Checking files...")
files_to_check = [
("app.py", "Main application"),
("requirements.txt", "Dependencies file"),
("pyproject.toml", "Project configuration"),
("README.md", "Documentation"),
("LICENSE", "License file"),
(".gitignore", "Git ignore file"),
("me/summary.txt", "Personal summary"),
("me/cedric-linkedin.pdf", "LinkedIn profile"),
]
for filepath, description in files_to_check:
if not check_file_exists(filepath, description):
all_good = False
# Check Python modules
print("\nπ¦ Checking Python dependencies...")
modules_to_check = [
("openai", "OpenAI library"),
("gradio", "Gradio web interface"),
("dotenv", "Environment variables"),
("pypdf", "PDF processing"),
("requests", "HTTP requests"),
]
for module_name, description in modules_to_check:
if not check_module(module_name, description):
all_good = False
# Check environment variables
print("\nπ Checking environment variables...")
env_vars_to_check = [
("OPENAI_API_KEY", "OpenAI API key", True),
("PUSHOVER_TOKEN", "Pushover token", False),
("PUSHOVER_USER", "Pushover user key", False),
]
for var_name, description, required in env_vars_to_check:
if os.getenv(var_name):
print(f"β
{description}: Set")
else:
if required:
print(f"β {description}: NOT SET (Required)")
all_good = False
else:
print(f"β οΈ {description}: NOT SET (Optional)")
# Final status
print("\n" + "=" * 40)
if all_good:
print("π Setup verification completed successfully!")
print("You can now run: python app.py")
else:
print("β Setup verification failed!")
print("Please fix the issues above before running the application.")
print("\nπ‘ Quick fixes:")
print("- Install missing dependencies: uv sync (or pip install -r requirements.txt)")
print("- Create .env file with your OpenAI API key")
print("- Make sure all files are in the correct location")
return 0 if all_good else 1
if __name__ == "__main__":
sys.exit(main()) |