A tool for managing semantic versioning in Git repositories
Project description
Semver Tools
A Python tool for managing semantic versioning in Git repositories. This tool automatically handles version bumping and Git tagging based on commit messages and branch names.
Features
- Automatic version bumping based on commit messages
- Git tag management
- Support for major, minor, patch, and hotfix versions
- Branch-aware versioning (develop, hotfix branches)
- Version file generation
Installation
- Install from source: a. Clone the repository:
git clone https://github.com/your-repo/semver-tools.git
cd semver-tools
b. Install the dependencies:
pip install -r requirements.txt
- Install from PyPI:
pip install semver-tools
Usage
Basic Usage
- Run the tool in your Git repository:
python -m semver_tools.main --repo-path /path/to/your/repo
If no path is specified, it uses the current directory.
- Run as cli tool:
semver-tools --repo-path /path/to/your/repo
Version Bumping Rules
The tool determines version bumps based on commit messages:
[major]in commit message: Bumps major version (1.0.0 → 2.0.0)[minor]in commit message: Bumps minor version (1.0.0 → 1.1.0)[hotfix]in commit message: Adds hotfix suffix (1.0.0 → 1.0.0+hotfix.1)- No special tag: Bumps patch version (1.0.0 → 1.0.1)
Branch Behavior
- On
developordevbranches: Creates new version tags - On
hotfixbranches: Creates hotfix versions - On other branches: Only displays current version without creating tags
Version File
The tool generates a version.env file in your repository with the current version:
VERSION=1.0.0
Development
Running Tests
pytest tests/
Project Structure
semver_tools/
├── __init__.py
├── git_utils.py # Git repository operations
├── main.py # CLI entry point
└── version_manager.py # Version management logic
tests/
├── __init__.py
├── test_git_utils.py
├── test_main.py
└── test_version_manager.py
Requirements
- Python 3.6+
- GitPython
- semantic_version
- pytest (for development)
Contributing
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m '[minor] Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
- semantic_version for version parsing
- GitPython for Git operations
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file semver_tools-0.1.0.tar.gz.
File metadata
- Download URL: semver_tools-0.1.0.tar.gz
- Upload date:
- Size: 5.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dcf7ccbb662c082c2c9ac009d34ffa500a46bd4b7e634f64523ca06cd7e03cef
|
|
| MD5 |
510ebfde309a6e9c13874f7fea6febfd
|
|
| BLAKE2b-256 |
67f62d40b1e20121ae2610d82ac44e49586d456b2328f28318f07207aca47184
|
File details
Details for the file semver_tools-0.1.0-py3-none-any.whl.
File metadata
- Download URL: semver_tools-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
54bcde7c74ab586d49b70200669af58b810e32c62cb91e1aba35a9a373a8e908
|
|
| MD5 |
762744e80549d3460da8b777fdc02b4b
|
|
| BLAKE2b-256 |
c2191e53c7a40ebf8a58483141e416fba5b735b4af0ee98cd096708a38faa385
|