Skip to content

Rog294super/Weather-App

Repository files navigation

Weather Application

A Python-based weather application using Tkinter GUI and the Open-Meteo API with integrated auto-update functionality.

🌟 Features

  • 🌍 City name to coordinates conversion using geopy/Nominatim
  • 🌀️ Real-time weather data from Open-Meteo API
  • πŸ”„ Automatic update checking and installation
  • πŸ›‘οΈ Comprehensive error handling
  • 🎨 User-friendly GUI with dark theme
  • πŸ“Š Detailed weather information display with emoji icons
  • ⚑ Fast startup with ONEDIR build
  • ⌨️ Enter key support for quick weather lookup

πŸ“¦ Installation

Option 1: Using the Installer (Recommended)

  1. Download Weather_Installer.exe from the latest release
  2. Run the installer
  3. Choose installation location
  4. Click "Install"
  5. The installer will:
    • Download the latest version
    • Create desktop shortcut
    • Set up auto-update functionality

Option 2: Manual Installation

  1. Download Weather.zip from the latest release
  2. Extract to your preferred location
  3. Run Weather.exe

Option 3: From Source

  1. Clone the repository:
git clone https://github.com/Rog294super/Weather-App.git
cd Weather-App
  1. Install dependencies:
pip install -r requirements.txt
  1. Run the application:
python Weather.py

πŸš€ Usage

  1. Enter a city name (e.g., "Amsterdam" or "Amsterdam, Netherlands")
  2. Click "Fetch Weather" or press Enter
  3. View detailed weather information with emoji indicators

πŸ”„ Auto-Update System

The application includes a built-in update system:

  • Automatic check: Checks for updates on startup (background)
  • Manual check: Click "πŸ”„ Check Updates" button
  • One-click install: Automatically downloads and installs updates
  • Seamless restart: Application restarts after update

The update process uses a C++ updater (updater.exe) that:

  1. Closes the running application
  2. Downloads the new version
  3. Replaces the old executable
  4. Restarts the application

πŸ—οΈ Building from Source

Prerequisites

  • Python 3.8+
  • PyInstaller: pip install pyinstaller
  • C++ compiler (for updater): MinGW-w64 or Visual Studio

Build Instructions

  1. Build the application:
compiler.bat

Choose from:

  • Option 1: ONEDIR (Instant Startup) - Recommended
  • Option 2: Installer
  • Option 3: Build both
  • Option 4: Clean build folders
  1. Build the updater (if needed):
cd Updater
compile_updater.bat

The ONEDIR build creates a folder structure with instant startup (<0.5s) instead of a single large executable.

πŸ“ Project Structure

Weather/
β”œβ”€β”€ Weather.py              # Main application
β”œβ”€β”€ file_handler.py         # File operations utility
β”œβ”€β”€ weather_installer.py    # Online installer
β”œβ”€β”€ Weather.spec           # PyInstaller spec for main app
β”œβ”€β”€ Weather_Installer.spec # PyInstaller spec for installer
β”œβ”€β”€ compiler.bat           # Build automation script
β”œβ”€β”€ requirements.txt       # Python dependencies
β”œβ”€β”€ README.md             # This file
β”œβ”€β”€ LICENSE               # MIT License
└── Updater/
    β”œβ”€β”€ updater_final.cpp     # C++ updater source
    β”œβ”€β”€ compile_updater.bat   # Updater build script
    └── test_update.bat       # Update testing script

πŸ› οΈ Technical Details

Weather Data

  • API: Open-Meteo (free, no API key required)
  • Data includes: Temperature, humidity, wind, precipitation, cloud cover
  • Weather codes: Translated to human-readable descriptions with emoji icons

Geocoding

  • Service: Nominatim (OpenStreetMap)
  • Features: City name β†’ coordinates conversion
  • Timeout handling: 10-second timeout with retry logic

Error Handling

  • βœ… Network timeout handling
  • βœ… Invalid location handling
  • βœ… API error handling
  • βœ… Geocoding service errors
  • βœ… Update system errors
  • βœ… Comprehensive logging

Update System Architecture

Weather.exe
    ↓ (checks GitHub API)
    ↓ (new version available)
    ↓ (launches)
updater.exe <download_url> <target_path>
    ↓ (closes Weather.exe)
    ↓ (downloads new version)
    ↓ (replaces old executable)
    ↓ (restarts Weather.exe)

🎯 Key Improvements from v1.0.0

Integrated Update System

  • βœ… Automatic update checking on startup
  • βœ… Manual update check button
  • βœ… One-click update installation
  • βœ… Progress indicators during update
  • βœ… Automatic restart after update

Enhanced UI

  • βœ… Version display in header
  • βœ… Update button with status indication
  • βœ… Better weather formatting with emojis
  • βœ… Enter key support
  • βœ… Improved error messages

Better .gitignore

  • βœ… Excludes build artifacts
  • βœ… Excludes user-specific files
  • βœ… Excludes IDE files
  • βœ… Keeps source files tracked

Code Quality

  • βœ… UpdateManager class for update logic
  • βœ… Better separation of concerns
  • βœ… Improved error handling
  • βœ… Better logging throughout

πŸ› Troubleshooting

Update Issues

  • "Updater not found": Reinstall the application using the installer
  • Update fails: Try manual download from GitHub releases
  • Application doesn't restart: Manually start Weather.exe

Weather Fetch Issues

  • "Geocoding service timed out": Check internet connection, try again
  • "Could not find location": Try adding country name (e.g., "Paris, France")
  • "Weather API error": Service may be temporarily unavailable

General Issues

  • Application won't start: Check Windows Defender/antivirus settings
  • Slow startup: Use ONEDIR version from installer
  • Missing icon: Icon.ico file may be missing (optional, won't affect functionality)

πŸ“ Development

Testing Updates

cd Updater
test_update.bat

This simulates the update process without affecting the live application.

Creating a Release

  1. Update VERSION in Weather.py
  2. Build with compiler.bat (option 3 - build all)
  3. Create GitHub release with tag (e.g., v1.0.1)
  4. Upload:
    • dist/Weather.zip (manual installation)
    • dist/Weather_Installer.exe (auto-installer)
    • Updater/updater.exe (required for auto-update)

πŸ“„ License

MIT License - see LICENSE file for details

πŸ‘€ Author

Rog294super

πŸ™ Acknowledgments

πŸ“Š Version History

v1.0.0 (Current)

  • Initial release
  • Basic weather fetching
  • City to coordinates conversion
  • Dark theme GUI
  • Integrated auto-update system
  • ONEDIR instant startup build
  • Enhanced UI with emojis
  • Enter key support
  • Update checking and installation

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published