Skip to content

Commit 139fcea

Browse files
committed
feat: implement comprehensive dynamic version management system
- Centralized version control in route_planner/__init__.py - Added scripts/get_version.py utility for consistent version fetching - Updated all documentation to use [VERSION] placeholders instead of hardcoded versions - Enhanced build scripts and GitHub Actions to dynamically extract version - Improved installer.nsi with dynamic version parameter support - Eliminated version maintenance overhead across all files - Updated CHANGELOG.md and RELEASE_NOTES.md with v1.1.2 improvements
1 parent ab839ab commit 139fcea

File tree

12 files changed

+280
-21
lines changed

12 files changed

+280
-21
lines changed

.github/workflows/build-windows-executable.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -372,9 +372,13 @@ jobs:
372372
373373
- name: Create ZIP package
374374
run: |
375-
# Get version from tag or use default
376-
$version = "${{ github.ref_name }}" -replace '^v', ''
377-
if (!$version -or $version -eq "master") { $version = "1.0.3" }
375+
# Get version from Python package
376+
$version = python -c "import sys; sys.path.insert(0, '.'); from route_planner import __version__; print(__version__)"
377+
if (!$version) {
378+
# Fallback: try to get from git tag
379+
$version = "${{ github.ref_name }}" -replace '^v', ''
380+
if (!$version -or $version -eq "master") { $version = "1.1.2" }
381+
}
378382
379383
# Create ZIP file
380384
$zipName = "RoutePlanner-$version-Windows-Portable.zip"

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
*All Windows executables and cross-platform packages are automatically built and published using GitHub Actions.*
99

10+
## [1.1.2] - 2025-06-05
11+
12+
### Changed
13+
- **Dynamic Version Management**: Implemented dynamic version fetching across all documentation and build scripts
14+
- **Reduced Maintenance Overhead**: Removed hardcoded version numbers from installation instructions and documentation
15+
- **Centralized Version Control**: All version references now dynamically fetch from `route_planner/__init__.py`
16+
17+
### Fixed
18+
- Eliminated version inconsistencies across documentation files
19+
- Improved maintainability by centralizing version management
20+
1021
## [1.1.1] - 2025-06-05
1122

1223
### Added

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# 🚚 Route Planner - Delivery Route Optimizer
22

3-
![Version](https://img.shields.io/badge/version-1.1.1-blue.svg)
3+
![Version](https://img.shields.io/github/v/release/yammanhammad/Route_Planner?style=flat&logo=github)
44
![License](https://img.shields.io/badge/license-MIT-green.svg)
55
![Python](https://img.shields.io/badge/python-3.8%2B-blue.svg)
66
![Platform](https://img.shields.io/badge/platform-Windows%20%7C%20Linux%20%7C%20macOS-lightgrey.svg)
@@ -49,7 +49,7 @@ Choose the installation method that works best for you. **For non-technical user
4949

5050
**Linux/macOS:**
5151
1. **Download** the cross-platform Python package from [GitHub Releases](https://github.com/yammanhammad/Route_Planner/releases/latest)
52-
- `route_planner-1.1.1-py3-none-any.whl` (Recommended)
52+
- `route_planner-[VERSION]-py3-none-any.whl` (Recommended)
5353
- `install.py` (Automatic installer script)
5454
2. **Easy Installation** (Recommended):
5555
```bash
@@ -61,7 +61,7 @@ Choose the installation method that works best for you. **For non-technical user
6161
```bash
6262
python3 -m venv route-planner-env
6363
source route-planner-env/bin/activate
64-
pip install route_planner-1.1.1-py3-none-any.whl
64+
pip install route_planner-[VERSION]-py3-none-any.whl
6565
```
6666
4. **Run**:
6767
- Find "Route Planner" in your application menu

docs/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@ This directory contains comprehensive documentation for the Route Planner applic
2828
- Extract/install and run `RoutePlanner.exe`
2929

3030
**Linux/macOS:**
31-
- Download `route_planner-1.1.1-py3-none-any.whl` from [GitHub Releases](https://github.com/yammanhammad/Route_Planner/releases/latest)
31+
- Download `route_planner-[VERSION]-py3-none-any.whl` from [GitHub Releases](https://github.com/yammanhammad/Route_Planner/releases/latest)
3232
- Create a virtual environment (recommended):
3333
```bash
3434
python3 -m venv route-planner-env
3535
source route-planner-env/bin/activate
3636
```
37-
- Install: `pip install route_planner-1.1.1-py3-none-any.whl`
37+
- Install: `pip install route_planner-[VERSION]-py3-none-any.whl`
3838
- Run: `route-planner`
3939

4040
*✨ All executables and packages are automatically built using GitHub Actions CI/CD - no compilation needed!*

docs/RELEASE_NOTES.md

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,26 @@ This document contains all release notes for Route Planner, with the most recent
44

55
**🚀 Quick Installation:** Download the latest version from [GitHub Releases](https://github.com/yammanhammad/Route_Planner/releases/latest):
66
- **Windows**: Choose `RoutePlanner-Bundled.zip` for the easiest installation experience
7-
- **Linux/macOS**: Choose `route_planner-1.1.1-py3-none-any.whl` for easy pip installation
7+
- **Linux/macOS**: Choose the latest `.whl` package for easy pip installation
88

99
*All Windows executables and cross-platform packages are automatically built and published using GitHub Actions.*
1010

11-
## Route Planner v1.1.1 (Latest)
11+
## Route Planner v1.1.2 (Latest)
12+
13+
**Release Date:** June 2025
14+
15+
### 🔧 Version Management Modernization
16+
- **Dynamic Version Control**: Implemented centralized version management system
17+
- **Reduced Maintenance Overhead**: Eliminated hardcoded version numbers from documentation
18+
- **Automated Version Fetching**: All build scripts and documentation now dynamically fetch version from package
19+
- **Consistency Improvements**: Centralized version control prevents version mismatches
20+
21+
### 📦 Technical Improvements
22+
- **Build System Enhancement**: Version numbers automatically extracted from `route_planner/__init__.py`
23+
- **Documentation Cleanup**: Removed version-specific package names from installation instructions
24+
- **Future-Proof Design**: Version updates now require changes in only one location
25+
26+
## Route Planner v1.1.1
1227

1328
**Release Date:** June 2025
1429

@@ -19,7 +34,7 @@ This document contains all release notes for Route Planner, with the most recent
1934

2035
### 📦 Installation Options
2136
- **Windows**: Download executable packages (`RoutePlanner-Bundled.zip` or `RoutePlanner-Setup.exe`)
22-
- **Linux/macOS**: Download Python wheel (`route_planner-1.1.1-py3-none-any.whl`) and install with pip
37+
- **Linux/macOS**: Download the latest Python wheel package and install with pip
2338
- **All Platforms**: Standard PyPI installation (`pip install route-planner`) also available
2439

2540
## Route Planner v1.1.0

route_planner/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
and comprehensive offline support.
77
"""
88

9-
__version__ = "1.1.1"
9+
__version__ = "1.1.2"
1010
__author__ = "Route Planner Development Team"
1111

1212
# Ensure config is available at package level

route_planner/app.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
5757
Author: Route Planner Development Team
5858
License: MIT
59-
Version: 1.0.3
59+
Version: Dynamic (from package __version__)
6060
"""
6161

6262
# =============================================================================
@@ -96,6 +96,12 @@
9696
import urllib.error # URL error handling
9797
import socket # Low-level networking interface
9898

99+
# Version information
100+
try:
101+
from route_planner import __version__
102+
except ImportError:
103+
__version__ = "unknown"
104+
99105
# =============================================================================
100106
# CONFIGURATION AND CONSTANTS
101107
# =============================================================================
@@ -3564,10 +3570,10 @@ def _show_about_dialog(self):
35643570
QtWidgets.QMessageBox.about(
35653571
self,
35663572
"About Route Planner",
3567-
"""
3573+
f"""
35683574
<div style="font-family: Arial, sans-serif; max-width: 500px;">
35693575
<h2 style="color: #4a86e8; margin-bottom: 10px;">Delivery Route Planner</h2>
3570-
<p style="font-size: 14px; color: #666;"><b>Version 1.0.3</b> (June 2025)</p>
3576+
<p style="font-size: 14px; color: #666;"><b>Version {__version__}</b> (June 2025)</p>
35713577
35723578
<p style="margin-top: 15px; line-height: 1.4;">
35733579
A sophisticated application for optimizing delivery routes through advanced
@@ -4254,7 +4260,7 @@ def main():
42544260

42554261
# Set application properties
42564262
app.setApplicationName("Delivery Route Planner")
4257-
app.setApplicationVersion("1.0.3")
4263+
app.setApplicationVersion(__version__)
42584264
app.setOrganizationName("Route Optimization Solutions")
42594265

42604266
# Create and show main window

scripts/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ These scripts serve three main functions:
4444
**Method 1: Pre-built Executables & Packages (Easiest)**
4545
- Download from [GitHub Releases](https://github.com/yammanhammad/Route_Planner/releases/latest)
4646
- **Windows**: Run `RoutePlanner.exe`
47-
- **Linux/macOS**: Install `route_planner-1.1.1-py3-none-any.whl` with pip and run `route-planner`
47+
- **Linux/macOS**: Install the latest `.whl` package with pip and run `route-planner`
4848
- *No technical setup required!*
4949

5050
**Method 2: Python Package**

scripts/get_version.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/usr/bin/env python3
2+
"""
3+
Utility script to get the current version from the package.
4+
This ensures version consistency across all files and documentation.
5+
"""
6+
7+
import sys
8+
from pathlib import Path
9+
10+
def get_version():
11+
"""Get the current version from route_planner/__init__.py"""
12+
# Add parent directory to path to import route_planner
13+
script_dir = Path(__file__).parent
14+
project_dir = script_dir.parent
15+
sys.path.insert(0, str(project_dir))
16+
17+
try:
18+
from route_planner import __version__
19+
return __version__
20+
except ImportError:
21+
# Fallback: read directly from file
22+
init_file = project_dir / "route_planner" / "__init__.py"
23+
if init_file.exists():
24+
import re
25+
with open(init_file, 'r', encoding='utf-8') as f:
26+
content = f.read()
27+
match = re.search(r'^__version__ = [\'"]([^\'"]*)[\'"]', content, re.MULTILINE)
28+
if match:
29+
return match.group(1)
30+
31+
raise RuntimeError("Unable to determine version")
32+
33+
if __name__ == "__main__":
34+
print(get_version())

scripts/installer.nsi

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22
;Creates a professional Windows installer with Visual C++ Redistributable
33

44
!define APP_NAME "Route Planner"
5-
!define APP_VERSION "1.1.1"
5+
; APP_VERSION will be passed as a command line parameter via /DAPP_VERSION=x.x.x
6+
!ifndef APP_VERSION
7+
!define APP_VERSION "1.1.2" ; Fallback version
8+
!endif
69
!define APP_PUBLISHER "Route Planner Team"
710
!define APP_URL "https://github.com/yammanhammad/Route_Planner"
811
!define APP_EXECUTABLE "RoutePlanner.exe"
@@ -53,7 +56,7 @@ RequestExecutionLevel admin
5356
!insertmacro MUI_LANGUAGE "English"
5457

5558
;Version Information
56-
VIProductVersion "1.1.0.0"
59+
VIProductVersion "${APP_VERSION}.0"
5760
VIAddVersionKey /LANG=${LANG_ENGLISH} "ProductName" "${APP_NAME}"
5861
VIAddVersionKey /LANG=${LANG_ENGLISH} "CompanyName" "${APP_PUBLISHER}"
5962
VIAddVersionKey /LANG=${LANG_ENGLISH} "LegalCopyright" "© 2025 ${APP_PUBLISHER}"

0 commit comments

Comments
 (0)