Skip to main content

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

  1. 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
  1. Install from PyPI:
pip install semver-tools

Usage

Basic Usage

  1. 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.

  1. 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 develop or dev branches: Creates new version tags
  • On hotfix branches: 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

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m '[minor] Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

semver_tools-0.1.0.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

semver_tools-0.1.0-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

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

Hashes for semver_tools-0.1.0.tar.gz
Algorithm Hash digest
SHA256 dcf7ccbb662c082c2c9ac009d34ffa500a46bd4b7e634f64523ca06cd7e03cef
MD5 510ebfde309a6e9c13874f7fea6febfd
BLAKE2b-256 67f62d40b1e20121ae2610d82ac44e49586d456b2328f28318f07207aca47184

See more details on using hashes here.

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

Hashes for semver_tools-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 54bcde7c74ab586d49b70200669af58b810e32c62cb91e1aba35a9a373a8e908
MD5 762744e80549d3460da8b777fdc02b4b
BLAKE2b-256 c2191e53c7a40ebf8a58483141e416fba5b735b4af0ee98cd096708a38faa385

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page