Skip to main content

Automatically generate a changelog using AI

Project description

GPT Changelog

GPT Changelog is a powerful tool that automatically generates high-quality changelogs using OpenAI's advanced language models. By analyzing commit messages since the most recent tag, GPT Changelog creates a well-structured, markdown-formatted changelog and seamlessly integrates it into your CHANGELOG.md file.

Features

  • Fast and Efficient: Quickly generates changelogs by leveraging OpenAI's GPT models.
  • High Quality: Produces clear, concise, and informative changelogs to keep your project documentation up-to-date.
  • Seamless Integration: Automatically prepends the generated changelog to your existing CHANGELOG.md file or creates one if it doesn't exist.
  • Customizable: Supports configuration of the OpenAI model and context token limits.
  • Semantic Versioning: Determines the next version number based on semantic versioning principles.

Installation

Prerequisites

  • Python 3.6 or higher: Ensure that Python is installed on your system.
  • OpenAI API Key: You need an OpenAI API key to use this tool. Sign up at OpenAI to obtain one.

Using pip

Install GPT Changelog via pip:

pip install gptchangelog

Configuration

Before using GPT Changelog, you need to configure your OpenAI API key and settings. You can initialize the configuration using the built-in command:

gptchangelog config init

This command will guide you through setting up your configuration file, where you can specify your OpenAI API key, the model to use, and other settings.

By default, the configuration file is created in one of the following locations:

  • Global Configuration: $HOME/.config/gptchangelog/config.ini
  • Project Configuration: ./.gptchangelog/config.ini

Manual Configuration

Alternatively, you can manually create a configuration file named config.ini with the following content:

[openai]
api_key = your_openai_api_key_here
model = gpt-4
max_context_tokens = 8000
  • Replace your_openai_api_key_here with your actual OpenAI API key.
  • Set the model parameter to the desired OpenAI model (e.g., gpt-4 or gpt-3.5-turbo).
  • Optionally adjust max_context_tokens based on your model's token limit.

Usage

Navigate to your Git repository directory and run:

gptchangelog

This command will:

  1. Fetch commit messages since the most recent tag or specified commit.
  2. Refine commit messages for clarity and conciseness.
  3. Determine the next version number based on semantic versioning.
  4. Generate a changelog using the specified OpenAI model.
  5. Prepend the generated changelog to the CHANGELOG.md file. If the file doesn't exist, it will create one.

Command-Line Options

  • --since <commit>: Specify the commit hash or tag to start fetching commit messages from. If not provided, it uses the most recent tag.

Example:

gptchangelog --since v1.2.3

Configuration Commands

  • gptchangelog config init: Initialize the configuration file.
  • gptchangelog config show: Display the current configuration.

Example

Here's how to use GPT Changelog:

cd /path/to/your/repo
gptchangelog

Within seconds, your CHANGELOG.md will be updated with the latest changes, keeping your project documentation current and professional.

Sample Generated Changelog

## [1.3.0] - 2023-10-18

### Added

- Implemented user authentication feature.

### Fixed

- Resolved bug in the payment processing module.

### Changed

- Updated the API documentation for clarity.

### Removed

- Deprecated endpoints removed from the API.

Templates

GPT Changelog uses customizable templates for prompts. You can modify the templates located in the templates directory within the gptchangelog package to tailor the prompts to your needs.

  • commits_prompt.txt: Template for refining commit messages.
  • version_prompt.txt: Template for determining the next version number.
  • changelog_prompt.txt: Template for generating the changelog.

Development

Project Structure

gptchangelog/
├── __init__.py
├── main.py
├── config.py
├── git_utils.py
├── openai_utils.py
├── utils.py
└── templates/
    ├── commits_prompt.txt
    ├── version_prompt.txt
    └── changelog_prompt.txt
  • main.py: Entry point of the application.
  • config.py: Handles configuration management.
  • git_utils.py: Contains Git-related utility functions.
  • openai_utils.py: Manages interactions with the OpenAI API.
  • utils.py: Contains shared utility functions.
  • templates/: Contains prompt templates used by the application.

Contributing

Contributions are welcome! If you'd like to contribute:

  1. Fork the repository.
  2. Create a new branch for your feature or bug fix.
  3. Make your changes and commit them with clear messages.
  4. Submit a pull request to the main branch.

Please ensure that your code adheres to the project's coding standards and passes all tests.

License

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

Contact

For questions or support, please open an issue on the GitHub repository.

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

gptchangelog-0.7.0.tar.gz (13.5 kB view details)

Uploaded Source

Built Distribution

gptchangelog-0.7.0-py3-none-any.whl (14.4 kB view details)

Uploaded Python 3

File details

Details for the file gptchangelog-0.7.0.tar.gz.

File metadata

  • Download URL: gptchangelog-0.7.0.tar.gz
  • Upload date:
  • Size: 13.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.11.10

File hashes

Hashes for gptchangelog-0.7.0.tar.gz
Algorithm Hash digest
SHA256 8356bf677755c869431a40738ac0cecbdae80b48e7983ea004dc1bb193315c5a
MD5 624aca9c92b7943a77a82257b2382cbb
BLAKE2b-256 1c0654b52d2ab3209db6a4ae866332ec409b8f1d534f8d898da2d59f5749e829

See more details on using hashes here.

File details

Details for the file gptchangelog-0.7.0-py3-none-any.whl.

File metadata

  • Download URL: gptchangelog-0.7.0-py3-none-any.whl
  • Upload date:
  • Size: 14.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.11.10

File hashes

Hashes for gptchangelog-0.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5d89c525ac79cce8931ef9fa3a55cc3655e4f8815c6cbc290a83aa6464d9adf7
MD5 77307c20f8c29b44163ba217143d5756
BLAKE2b-256 e141aac2df21019452fc930fa14f251e6317131ccee5febdf2d30f6895b7668a

See more details on using hashes here.

Supported by

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