Spaces:
Sleeping
Sleeping
| #!/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()) |