Skip to main content

ai_changelog

License: MIT python

Publish to PyPI GitHub tag (with filter)

Push to Docker Hub Docker Image Size (tag)

Code Climate maintainability Code Climate issues Code Climate technical debt

pre-commit Ruff Checked with mypy Code style: black

security: bandit Known Vulnerabilities

Update AI Changelog on Push to Main

ai_changelog is a Python project that automatically generates changelog files summarizing code changes, using AI.

It uses LangChain and OpenAI models to analyze Git commit diffs and generate natural language descriptions of the changes. This allows maintaining an up-to-date changelog without manual effort.

This README was originally written by Claude, an LLM from Anthropic.

Usage

usage: ai_changelog [-h] [--provider {openai,anthropic,anyscale}] [--model MODEL] [--temperature TEMPERATURE] [--max_tokens MAX_TOKENS] [--hub_prompt HUB_PROMPT]
                    [--context_lines CONTEXT_LINES] [--max_concurrency MAX_CONCURRENCY] [-v]
                    refs

Process command line arguments.

positional arguments:
  refs                  Reference comparison with standard git syntax

options:
  -h, --help            show this help message and exit
  --provider {openai,anthropic,anyscale}
                        Model API provider
  --model MODEL         Model name
  --temperature TEMPERATURE
                        Model temperature
  --max_tokens MAX_TOKENS
                        Max tokens in output
  --hub_prompt HUB_PROMPT
                        Prompt to pull from LangChain Hub
  --context_lines CONTEXT_LINES
                        Number of context lines for each commit
  --max_concurrency MAX_CONCURRENCY
                        Number of concurrent connections to llm provider (0 means no limit)
  -v, --verbose         Run LangChain in verbose mode

http://github.com/joshuasundance-swca/ai_changelog

Local install

To generate a changelog locally:

pip install ai_changelog

ai_changelog --help
ai_changelog main..HEAD  # to summarize changes locally

Docker

docker pull joshuasundance/ai_changelog:latest
docker run \
    --env-file .env \
    -v /local_repo_dir:/container_dir_in_repo \
    -w /container_dir_in_repo \
    joshuasundance/ai_changelog:latest \
    main..HEAD

GitHub Workflow

The ai_changelog_main_pr.yml workflow runs on pushes to main.

It generates summaries for the new commits and appends them to AI_CHANGELOG.md. The updated file is then committed back to the PR branch.

ai_changelog origin/main^..origin/main  # in a GitHub action to summarize changes in response to a push to main
ai_changelog origin/main..HEAD  # in a GitHub action to summarize changes in response to a PR

Another flow was made to commit an updated changelog to an incoming PR before it was merged, but that seemed less useful although it did work well.

Configuration

  • Set environment variables as needed for your provider of choice (default requires OPENAI_API_KEY).
  • Set LangSmith environment variables to enable LangSmith integration, if applicable.
  • Use command line arguments.

License

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

TODO

  • Testing
  • Get CodeLlama working reliably in CICD (currently hit or miss on structured output)

Metadata

Release files for ai-changelog 0.0.14

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ai-changelog 0.0.14
File Size Uploaded
ai_changelog-0.0.14.tar.gz 10.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ai-changelog 0.0.14
File Interpreter ABI Platform
ai_changelog-0.0.14-py3-none-any.whl Python 3 none any Details

Total release size: 20.8 kB

Release files / ai_changelog-0.0.14.tar.gz

Download URL ai_changelog-0.0.14.tar.gz
Size 10.7 kB
Tags Source
SHA-256 checksum
How to use checksums
49cb4ea4b339a6547dcfb529f6f7b17834240c3ebd8905933a508c50f0a2b6be
BLAKE2b-256 checksum
How to use checksums
b9978409d7a1c3e60e8bd13dd05ff12d365e5c938c1ef338742d641622816ede
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/4.0.2 CPython/3.11.7

Release files / ai_changelog-0.0.14-py3-none-any.whl

Download URL ai_changelog-0.0.14-py3-none-any.whl
Size 10.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cd20e710b1291ea60a7048e0b88cf73072367585617822a25b737494576485e1
BLAKE2b-256 checksum
How to use checksums
dce160ad34da9200d853a090d683115410f9c9a698b8ee1e875454bfd880874f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/4.0.2 CPython/3.11.7

Release history Release notifications | RSS feed

This release

0.0.14 This release

2 release files

0.0.11

2 release files

0.0.10

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.3

2 release files

0.0.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page