A powerful command-line weather application built with Typer that provides current weather, forecasts, and location management with local database storage.
pip install weather-dashboardgit clone <repository-url>
cd weather-dashboard
pip install -e .-
Get your API key from WeatherAPI.com
-
Set your API key (optional - can be set via environment variable):
export WEATHER_API_KEY="your-api-key-here"- Initialize the database:
weather-dashboard init-db- Get current weather:
weather-dashboard currentShow current weather for a location (interactive mode if no location set)
weather-dashboard current [OPTIONS]Options:
--unit, -u: Temperature unit (C for Celsius, F for Fahrenheit) [default: C]--verbose, -v: Enable verbose logging
Get current weather and forecast for a specific location
weather-dashboard weather "London, UK" --unit F
weather-dashboard weather "New York" --unit CShow weather forecast (interactive mode or with options)
weather-dashboard forecast [OPTIONS]Options:
--days, -d: Number of days to forecast (1-7)--unit, -u: Temperature unit (C/F)--verbose, -v: Enable verbose logging
Get forecast for a specific date
weather-dashboard date 2024-12-25 --unit F
weather-dashboard date 2024-01-15Start the interactive weather application
weather-dashboard interactiveInitialize or reset the database
weather-dashboard init-dbShow database location and configuration information
weather-dashboard database-infoAdd a new location to the database
weather-dashboard add-location \
--name "Paris" \
--lat 48.8566 \
--lon 2.3522 \
--country "France" \
--region "Île-de-France"Refresh location data in the database
# Refresh by city name
weather-dashboard refresh-location --city "London"
# Refresh by location ID
weather-dashboard refresh-location --id 1Update application settings
# Set default forecast days
weather-dashboard settings --forecast-days 5
# Set default temperature unit
weather-dashboard settings --temp-unit F
# Set both
weather-dashboard settings --forecast-days 3 --temp-unit CSet default number of forecast days
weather-dashboard set-forecast-days --days 7Display the current version
weather-dashboard versionRun comprehensive diagnostics on database and API connectivity
weather-dashboard diagnosticsTest location saving functionality (for debugging)
weather-dashboard test-location --city "Tokyo" --country "Japan"The CLI app supports the following environment variables:
WEATHER_API_KEY: Your WeatherAPI.com API key (required)DATABASE_URL: Database connection URL (optional, defaults to local SQLite)
By default, the app stores data in:
- Linux/macOS:
~/.local/share/weather-dashboard/weather_app.db - Windows:
%APPDATA%/weather-dashboard/weather_app.db
Use weather-dashboard database-info to see your exact database location.
You can override the default database location:
export DATABASE_URL="sqlite:///path/to/your/database.db"
# Or use PostgreSQL
export DATABASE_URL="postgresql://user:password@localhost:5432/weather_db"# Get current weather (interactive mode)
weather-dashboard current
# Get weather for specific location
weather-dashboard weather "Tokyo, Japan"
# Get 5-day forecast in Fahrenheit
weather-dashboard forecast --days 5 --unit F
# Check weather for a future date
weather-dashboard date 2024-02-14 --unit C# Initialize database
weather-dashboard init-db
# Check database status
weather-dashboard database-info
# Add favorite location
weather-dashboard add-location \
--name "Home" \
--lat 40.7128 \
--lon -74.0060 \
--country "USA" \
--region "New York"# Set preferences
weather-dashboard settings --forecast-days 7 --temp-unit F
# Run diagnostics
weather-dashboard diagnostics"No API key found"
- Set your API key:
export WEATHER_API_KEY="your-key" - Or create a
.envfile withWEATHER_API_KEY=your-key
"Database connection failed"
- Run:
weather-dashboard init-db - Check database location:
weather-dashboard database-info
"Location not found"
- Try more specific location names: "London, UK" instead of "London"
- Use interactive mode for location search
Enable verbose logging for troubleshooting:
weather-dashboard current --verbose
weather-dashboard diagnostics --verbose# Reset database
weather-dashboard init-db
# Check if everything works
weather-dashboard diagnostics- Web Interface: See main README.md for the Flask web application
- API Documentation: Check the WeatherAPI.com documentation
- Source Code: View the full source code repository
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.
Made with ❤️ using Typer and Rich