This document explains the automated version synchronization system for the iqtoolkit-analyzer project.
When you update the VERSION file, you need to remember to update version references in:
iqtoolkit_analyzer/__init__.py(__version__)pyproject.toml(version)Dockerfile(multiple version labels)- Any Chart.yaml files (if present)
Automatically runs on every commit/push:
# One-time setup
bash scripts/setup-hooks.sh
# Now every time you commit, versions sync automatically!
echo "0.1.9" > VERSION
git add VERSION
git commit -m "feat: bump version to 0.1.9"
# ✅ Hook automatically updates all version files and stages themWhat it does:
- Pre-commit: When
VERSIONfile changes, automatically updates all other files - Pre-push: Verifies all versions are consistent before allowing push
Quick manual commands:
# Update all versions to match VERSION file
make sync-version
# Check if all versions are consistent
make check-version
# Full development workflow
make dev-check # format + lint + test + version checkDirect script usage:
# Update all version references
python scripts/propagate_version.py
# Verify consistency (exit code 0 = success, 1 = inconsistent)
python scripts/propagate_version.py --verifyAutomatically checks version consistency in CI pipeline - no action needed, just ensures consistency.
# Complete setup with virtual environment and dependencies
bash scripts/setup-dev-environment.sh
# Then activate the virtual environment
source venv/bin/activate
# Install git hooks
bash scripts/setup-hooks.sh# Install dependencies and hooks
make setup# Install dependencies
poetry install --with dev,test
# Install git hooks
bash scripts/setup-hooks.shThe git hooks will:
- ✅ Auto-sync versions when
VERSIONfile changes in commits - ✅ Verify consistency before pushes
- ✅ Run basic linting on Python files
- ✅ Automatically detect and use your virtual environment
With hooks installed, your workflow becomes:
# 1. Update version (triggers auto-sync on commit)
echo "0.1.9" > VERSION
# 2. Make your changes
# ... edit code ...
# 3. Commit normally (versions sync automatically)
git add .
git commit -m "feat: add new feature"
# 4. Push (automatically verified)
git push origin feature/my-branchTo check if versions are consistent:
# Quick check
make check-version
# Or direct script
python scripts/propagate_version.py --verify
# Expected output:
# Verifying all versions match: 0.1.8
# ✅ All versions are consistent!# Fix it automatically
make sync-version
# or
python scripts/propagate_version.py
# Then commit the changes
git add -u
git commit -m "chore: sync version references"# Reinstall hooks
bash scripts/setup-hooks.sh
# Verify hooks are installed
ls -la .git/hooks/pre-*# Skip pre-commit hook (not recommended)
git commit --no-verify -m "emergency fix"
# Skip pre-push hook (not recommended)
git push --no-verifyThe version propagation script updates these patterns:
__version__ = "0.1.8" # ← Updated[project]
version = "0.1.8" # ← UpdatedENV IQTOOLKIT_ANALYZER_VERSION=0.1.8 # ← Updated
LABEL version="0.1.8" # ← Updated
LABEL org.opencontainers.image.version="0.1.8" # ← Updated- Always update VERSION file first - other files sync automatically
- Use semantic versioning - MAJOR.MINOR.PATCH (e.g., 1.2.3)
- Install git hooks - prevents inconsistency issues
- Run
make check-version- before important releases - Let CI verify - GitHub Actions also check consistency
The project follows PEP 440 for Python package versions:
- VERSION file: PEP 440 compliant version string (e.g.,
0.2.3a1) - pyproject.toml: PEP 440 compliant format (e.g.,
0.2.3a1) - Git tags: Use 'v' prefix for GitHub releases (e.g.,
v0.2.3)
The propagation script uses PEP 440 normalized format:
0.2.0a1(VERSION file) →0.2.0a1(pyproject.toml) - no conversion needed0.2.0b1→0.2.0b10.2.0rc1→0.2.0rc1
- Alpha:
a(e.g.,0.2.0a1) - Beta:
b(e.g.,0.2.0b1) - Release Candidate:
rc(e.g.,0.2.0rc1)
- Check version status:
make check-version - Fix inconsistencies:
make sync-version - Full dev check:
make dev-check - View all commands:
make help
With this system, you'll never have mismatched versions again! 🎉