Skip to main content

AutoCommitMessage

AutoCommitMessage is a command-line tool that uses the power of Large Language Models (LLMs) to automatically generate descriptive and well-formatted git commit messages based on your staged changes.

Features

  • AI-Powered Commits: Leverages Google's Gemini models via LangChain to analyze your code differences and generate meaningful commit messages.
  • Free to Use: This tool includes a wrapper around the Google API to ensure that your usage stays within the free tier, so you can use it without charge with your own Google API key.
  • Conventional Commits: Follows the Conventional Commits specification to produce a clean and readable commit history. The generated messages include a type (e.g., feat, fix, refactor), an optional scope, and a concise description.
  • Seamless Git Integration: Integrates directly with your local Git repository to automatically detect staged files.
  • Extensible and Testable: Built with a modular structure, making it easy to test and extend. The project includes unit, end-to-end, and LLM quality tests.

Installation

  1. Install from PyPI (Recommended): You can install the tool directly using pip.

    pip install autocommitmessage
    
  2. Or, Install from source (for development): If you want to contribute to the project, you can install it from the source code.

    • Clone the repository:

      git clone <your-repo-url>
      cd autocommitmessage
      
    • Install dependencies: The project uses setuptools for packaging. It's recommended to do this in a virtual environment.

      pip install .
      

      For development and running tests, install the testing dependencies:

      pip install .[dev]
      

Usage

After installing, you can use autocommitmessage in any of your own Git repositories.

Setting Your API Key

The tool requires a Google API key to function. You must set this key in a .env file within the root directory of the repository you are working on.

  1. Navigate to your project's root directory:
    cd /path/to/your-project
    
  2. Create a .env file. If you cloned the repository for development, you can copy the example file:
    cp .env.example .env
    
    Then, add your API key:
    # your-project/.env
    GOOGLE_API_KEY="your_google_api_key_here"
    

Generating a Commit Message

  1. Stage your changes: Use git add to stage the changes you want to commit.

    git add <file1> <file2>
    
  2. Generate the commit message: Run the autocommitmessage command.

    autocommitmessage
    

The tool will then output a generated commit message based on the staged diff.

Development and Testing

If you are contributing to the project, you will need to set up your environment for testing.

Langsmith Setup (for LLM Quality Tests)

  1. Add Langsmith keys to your .env file:
    LANGCHAIN_API_KEY="your_langchain_api_key"
    LANGCHAIN_TRACING_V2="true"
    LANGCHAIN_ENDPOINT="[https://api.smith.langchain.com](https://api.smith.langchain.com)"
    LANGCHAIN_PROJECT="your_project_name"
    
  2. You can get the LANGCHAIN_PROJECT name by running the langsmith_ini.py script:
    python tests/langsmith/langsmith_ini.py
    

Running Tests

This project uses pytest for testing. The tests are organized into three categories: unit, end-to-end (e2e), and LLM quality (llm).

To run all tests:

pytest

Metadata

Release files for autocommitmessage 0.1.4

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

Source distribution (sdist)

Source distribution for autocommitmessage 0.1.4
File Size Uploaded Provenance
autocommitmessage-0.1.4.tar.gz 8.3 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for autocommitmessage 0.1.4
File Interpreter ABI Platform
autocommitmessage-0.1.4-py3-none-any.whl Python 3 none any Details

Total release size: 16.3 kB

Release files / autocommitmessage-0.1.4.tar.gz

Download URL autocommitmessage-0.1.4.tar.gz
Size 8.3 kB
Tags Source
SHA-256 checksum
How to use checksums
1b2e395532e62078cb3b668ff8477a6cc6ea5d9dcc1b016358eb1dbd272ed252
BLAKE2b-256 checksum
How to use checksums
7c357a854e7109eca523aa064a959350eb50325ba04b36cf7018c58631f4535a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.13

Release files / autocommitmessage-0.1.4-py3-none-any.whl

Download URL autocommitmessage-0.1.4-py3-none-any.whl
Size 8.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1f105b599817af4f50e5e746dbb71f165f2152a441b84bfb792456af6f65bd84
BLAKE2b-256 checksum
How to use checksums
92cd835c125e873a3f49c9d4d270fd01d2a9cc14a615931c385854f85e0203d7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.13

Security for autocommitmessage 0.1.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.1.4 This release

2 release files No provenance

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