Skip to main content

Install via PyPI

Install git-cliff from PyPI using pip.

Quick Install

pip install git-cliff

Installation Steps

1

Ensure Python is installed

Check your Python version:
python --version
# or
python3 --version
Python 3.7 or higher is recommended.
2

Install git-cliff

Install globally:
pip install git-cliff
Or with Python 3:
pip3 install git-cliff
3

Verify installation

git-cliff --version
Expected output:
git-cliff 2.7.0
4

Test in a repository

cd /path/to/your/git/repo
git-cliff --help

Using in Python Projects

Add to requirements.txt

requirements.txt
git-cliff==2.7.0
Install dependencies:
pip install -r requirements.txt

Add to pyproject.toml

pyproject.toml
[project.optional-dependencies]
dev = [
    "git-cliff>=2.7.0",
]
Install with dev dependencies:
pip install -e ".[dev]"

Add to setup.py

setup.py
from setuptools import setup

setup(
    name="your-package",
    extras_require={
        "dev": [
            "git-cliff>=2.7.0",
        ],
    },
)

Integration Examples

Call git-cliff from Python:
generate_changelog.py
#!/usr/bin/env python3
import subprocess
import sys

def generate_changelog(output_file="CHANGELOG.md"):
    """Generate changelog using git-cliff."""
    try:
        result = subprocess.run(
            ["git-cliff", "-o", output_file],
            check=True,
            capture_output=True,
            text=True,
        )
        print(f"Changelog generated: {output_file}")
        return result.returncode
    except subprocess.CalledProcessError as e:
        print(f"Error generating changelog: {e.stderr}", file=sys.stderr)
        return e.returncode
    except FileNotFoundError:
        print("Error: git-cliff not found. Install with 'pip install git-cliff'", file=sys.stderr)
        return 1

if __name__ == "__main__":
    sys.exit(generate_changelog())
Usage:
python generate_changelog.py

Upgrading

Upgrade to the latest version:
pip install --upgrade git-cliff
Upgrade to a specific version:
pip install --upgrade git-cliff==2.7.0

Uninstalling

Remove git-cliff:
pip uninstall git-cliff

Troubleshooting

Install pip:Linux (Debian/Ubuntu):
sudo apt-get update
sudo apt-get install python3-pip
Linux (Fedora):
sudo dnf install python3-pip
macOS:
python3 -m ensurepip --upgrade
The installation directory may not be in your PATH.Check installation location:
pip show -f git-cliff
Add to PATH (Linux/macOS):
# Add to ~/.bashrc or ~/.zshrc
export PATH="$HOME/.local/bin:$PATH"
Add to PATH (Windows): Add %USERPROFILE%\AppData\Local\Programs\Python\Python3x\Scripts to your PATH environment variable.
If you get permission errors during installation:
  1. Use --user flag:
    pip install --user git-cliff
    
  2. Or use a virtual environment:
    python -m venv venv
    source venv/bin/activate
    pip install git-cliff
    
  3. Avoid using sudo pip install as it can cause issues.
Use pipx for isolated installation:
pip install pipx
pipx install git-cliff
Or use a virtual environment for your project.
If you encounter SSL errors:
pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org git-cliff
Better solution: Update your CA certificates:
pip install --upgrade certifi

Next Steps

Configuration

Configure git-cliff for your project

Usage Examples

Learn how to use git-cliff

Build docs developers (and LLMs) love