cedric-agent / setup_check.py
claridon's picture
Upload folder using huggingface_hub
d1b7767 verified
#!/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())