🛠️ToolsShed

Changelog Generator

Generate CHANGELOG.md files in Keep a Changelog format with semantic versioning.

ChangelogGenerator.releases

# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [X.Y.Z] - 2026-03-25

Preguntas Frecuentes

Implementación de Código

from datetime import date
from typing import List, Dict, Optional

CATEGORIES = ["Added", "Changed", "Deprecated", "Removed", "Fixed", "Security"]

def format_release(version: str, release_date: Optional[str],
                   changes: Dict[str, List[str]]) -> str:
    lines = []
    date_str = release_date or str(date.today())
    lines.append(f"## [{version}] - {date_str}")
    for cat in CATEGORIES:
        items = changes.get(cat, [])
        if items:
            lines.append(f"### {cat}")
            for item in items:
                lines.append(f"- {item}")
            lines.append("")
    return "\n".join(lines)

def generate_changelog(releases: list) -> str:
    header = "# Changelog\n\nAll notable changes to this project will be documented in this file.\n\nThe format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),\nand this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).\n"
    body = "\n".join(format_release(**r) for r in releases)
    return header + "\n" + body

releases = [
    {
        "version": "1.2.0",
        "release_date": "2025-06-01",
        "changes": {
            "Added": ["New feature X", "New feature Y"],
            "Fixed": ["Bug in component Z"],
        },
    },
    {
        "version": "1.1.0",
        "release_date": "2025-04-15",
        "changes": {
            "Changed": ["Updated API endpoint"],
        },
    },
]
print(generate_changelog(releases))

Comments & Feedback

Comments are powered by Giscus. Sign in with GitHub to leave a comment.