resumescreener_v2 / test_installation.py
root
ss
26e8660
#!/usr/bin/env python3
"""
Test script to verify AI Resume Screener installation
"""
import sys
import importlib
def test_import(module_name, package_name=None):
"""Test if a module can be imported"""
try:
importlib.import_module(module_name)
print(f"βœ… {package_name or module_name}")
return True
except ImportError as e:
print(f"❌ {package_name or module_name}: {e}")
return False
def main():
print("πŸ§ͺ Testing AI Resume Screener Installation\n")
# Core dependencies
print("πŸ“¦ Core Dependencies:")
core_deps = [
("streamlit", "Streamlit"),
("pandas", "Pandas"),
("numpy", "NumPy"),
("plotly", "Plotly"),
]
core_success = all(test_import(module, name) for module, name in core_deps)
# ML/AI dependencies
print("\nπŸ€– ML/AI Dependencies:")
ml_deps = [
("sentence_transformers", "Sentence Transformers"),
("transformers", "Transformers"),
("torch", "PyTorch"),
("faiss", "FAISS"),
("rank_bm25", "Rank BM25"),
("nltk", "NLTK"),
]
ml_success = all(test_import(module, name) for module, name in ml_deps)
# File processing dependencies
print("\nπŸ“„ File Processing Dependencies:")
file_deps = [
("pdfplumber", "PDF Plumber"),
("PyPDF2", "PyPDF2"),
("docx", "python-docx"),
("datasets", "Hugging Face Datasets"),
]
file_success = all(test_import(module, name) for module, name in file_deps)
# Optional dependencies
print("\n⚑ Optional Dependencies:")
optional_deps = [
("accelerate", "Accelerate"),
("bitsandbytes", "BitsAndBytes"),
]
for module, name in optional_deps:
test_import(module, name)
# Summary
print("\n" + "="*50)
if core_success and ml_success and file_success:
print("πŸŽ‰ All required dependencies are installed!")
print("βœ… Ready to run AI Resume Screener")
# Test basic functionality
print("\nπŸ”§ Testing basic functionality...")
try:
import pandas as pd
import numpy as np
from sentence_transformers import SentenceTransformer
# Test data creation
test_df = pd.DataFrame({'test': [1, 2, 3]})
test_array = np.array([1, 2, 3])
print("βœ… Pandas and NumPy working")
print("βœ… Installation test completed successfully!")
except Exception as e:
print(f"❌ Basic functionality test failed: {e}")
else:
print("❌ Some required dependencies are missing")
print("πŸ“ Please install missing packages using:")
print(" pip install -r requirements.txt")
print("\nπŸš€ To run the application:")
print(" streamlit run src/streamlit_app.py")
if __name__ == "__main__":
main()