Fix Python 3.9 compatibility issues

Resolved startup errors:

1. Type hint compatibility:
   - Changed SkaterStatsDTO | GoalieStatsDTO to Union[SkaterStatsDTO, GoalieStatsDTO]
   - Python 3.9 does not support | operator for type unions

2. Yahoo Fantasy adapter import:
   - Made yfpy import lazy in get_fantasy_repository()
   - Prevents ModuleNotFoundError when yfpy not installed
   - Only loads Yahoo adapter when actually needed

3. Updated startup script for compatibility

The application now starts successfully on Python 3.9.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Michael Simard
2025-11-23 22:49:48 -06:00
parent c10fdd594d
commit ff0ca17b15
3 changed files with 23 additions and 3 deletions

18
start_server.sh Executable file
View File

@@ -0,0 +1,18 @@
#!/bin/bash
# Startup script for Project Kempe Fantasy Hockey Backend
cd "$(dirname "$0")"
echo "=========================================="
echo "Project Kempe - Fantasy Hockey Backend"
echo "=========================================="
echo ""
echo "Starting FastAPI server..."
echo "Server will be available at: http://localhost:8000"
echo "API Documentation: http://localhost:8000/docs"
echo ""
echo "Press Ctrl+C to stop the server"
echo ""
# Start the server using python module
python3 -m uvicorn src.presentation.api.main:app --reload --host 0.0.0.0 --port 8000