A modern, real-time weather dashboard built with Flask and featuring WebSocket updates, reliable weather data from OpenMeteo, and comprehensive testing.
- ⚡ Real-time Weather Updates - WebSocket-powered live updates with polling fallback
- 🌤️ Reliable Weather Data - Powered by OpenMeteo API for accurate and free weather information
- 📱 Responsive Design - Web components-based UI that works on all devices
- 🚀 Fast Performance - Intelligent caching and optimized API calls
- 🔄 Real-time Updates - Automatic weather data refresh with intelligent caching
- 📊 Comprehensive Monitoring - Built-in cache statistics and API health monitoring
- 🐳 Docker Ready - Containerized deployment with Docker Compose support
- ✅ Fully Tested - 95 tests with 73% code coverage
# Clone the repository
git clone https://github.com/harperreed/weather-dashboard.git
cd weather-dashboard
# Start with Docker Compose
docker-compose up -d# Install dependencies with uv
uv sync --all-extras --dev
# Run the application
uv run python main.py
# Run tests
uv run pytest tests/ -vVisit http://localhost:5001 to see your weather dashboard!
GET /- Main weather dashboardGET /api/weather- Current weather data (supports lat/lon and location params)GET /api/cache/stats- Cache statisticsGET /{city}- Weather for predefined cities (chicago, nyc, sf, etc.)
The dashboard automatically updates using WebSockets with the following features:
- Live weather updates every 10 minutes
- Connection status indicators showing WebSocket/polling status
- Automatic reconnection with exponential backoff
- Free European weather service
- No API key required
- Excellent data quality and reliability
- Global weather coverage with high accuracy
Set these environment variables:
SECRET_KEY=your-secret-key-hereNo API keys are required as the application uses OpenMeteo's free API service.
The project includes comprehensive testing:
# Run all tests
uv run pytest tests/ -v
# Run with coverage
uv run pytest tests/ --cov=. --cov-report=html
# Run specific test types
uv run pytest tests/unit/ -v # Unit tests
uv run pytest tests/integration/ -v # Integration tests
uv run pytest tests/test_frontend.py -v # Frontend testsThis project includes comprehensive GitHub Actions workflows:
- Runs tests across Python 3.10, 3.11, and 3.12
- Generates coverage reports and uploads to Codecov
- Enforces 70% minimum code coverage
- Produces test artifacts for review
- Ruff for fast Python linting and formatting
- Black for code formatting consistency
- isort for import sorting
- MyPy for type checking
- Bandit for security scanning
- Radon for complexity analysis
- CodeQL analysis for vulnerability detection
- Semgrep for security pattern matching
- Gitleaks for secret scanning
- Safety and pip-audit for dependency vulnerability checks
- License compatibility checking
- Builds and tests Docker images
- Trivy security scanning for container vulnerabilities
- Multi-architecture builds
- Pushes to GitHub Container Registry
- Tests Docker Compose configurations
- Staging deployment on
developbranch - Production deployment on version tags
- Automated GitHub releases
- Smoke testing and health checks
- Code metrics and complexity analysis
- Repository health checks
- Dependency graph generation
- Automated status badges
- Dependabot for automated dependency updates
- Auto-merge for minor/patch updates after tests pass
- Security update prioritization
The weather provider system is designed for extensibility:
- The
OpenMeteoProviderclass inweather_providers.pyhandles all OpenMeteo API interactions - Weather data processing and caching logic is centralized in the provider
- All weather-related tests are in
tests/unit/test_weather_providers.py
weather-dashboard/
├── .github/ # GitHub workflows and templates
├── static/ # Frontend assets
│ ├── js/ # JavaScript components
│ └── icons/ # Weather icons
├── templates/ # HTML templates
├── tests/ # Test suite
│ ├── unit/ # Unit tests
│ ├── integration/ # Integration tests
│ └── conftest.py # Test configuration
├── main.py # Flask application
├── weather_providers.py # Weather provider abstractions
├── pyproject.toml # Project configuration
└── docker-compose.yml # Container orchestration
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Make your changes and add tests
- Ensure all tests pass:
uv run pytest tests/ -v - Check code quality:
uv run ruff check . && uv run black --check . - Commit your changes:
git commit -m 'Add amazing feature' - Push to the branch:
git push origin feature/amazing-feature - Open a Pull Request
For security vulnerabilities, please email [security@yourproject.com] instead of filing a public issue.
This project is licensed under the MIT License - see the LICENSE file for details.
- Weather data provided by Open-Meteo
- Weather icons from Meteocons
- Built with Flask, uv, and Docker