Skip to main content

No project description provided

Project description

Painy

Comments for this repository commits are written with Painy itself.

Star the repository to support the project.

Features

  • Painy is a simple tool which allows you to automatically generate commit messages via OpenAI API. It automatically check the changes in your repository and generate a commit message based on the changes.

  • Works well with Jupyter Notebooks (.ipynb files) by using nbdime for diffing.

  • Painy is capable of reviewing past commits and creating new ones that follow the same style.

  • You can add your own rules/requests as additional prompts for model.

  • Interactive mode

Prerequisites

  • OpenAI API key. You can get one here.

  • Python 3.7.1 or higher and pip package manager.

Installation

  • Install the package via pip:

    pip install painy
    
  • Set the environment variable OPENAI_API_KEY to your OpenAI API key.

  • By default, Painy will use the gpt-3.5-turbo (ChatGPT), if you want to use a different model, set the environment variable OPENAI_MODEL_NAME to the model you want to use. You must have access to the model you want to use.

  • Max context length depends on the model you use. Try to use the tool on not too big changes, ideally on a single file.

Usage

  • (Recommended) Go to the folder with your repository and run the following command:

    • Add something to stage:

      git add <files>
      
    • Then use Painy:

      painy comment
      
    • Or with the environment variable OPENAI_API_KEY set inplace:

      OPENAI_API_KEY=<your-openai-api-key> painy comment
      

      This will generate a commit message based on the staged changes in your repository.

  • Commit staged changes with a generated commit message:

painy commit
  • Interactive mode:
painy <comment|commit> -i

This will generate a commit message based on the staged changes in your repository and will ask you if you want to regenerate the commit message.

  • If you want to generate a commit message for all the changes in your repository, run the following command (this files must be registered in git before in order to have a diff to compare):
painy <comment|commit> --check-all
  • By default the use_commit_history_style is set to True. If you want to disable it, run the following command:

    painy config --set use-commit-history-style False
    
  • To get the actual value of config option run the following command:

    painy config --get use-commit-history-style
    
  • List of options:

    • use_commit_history_style - whether to use the style of the former commits in the repository.
    • max_num_commits_style - the maximum number of last commits to use for the style.
    • max_characters (used as a property in one of default rules) - the desired maximum number of characters in the commit message.
  • To get the list of rules run the following command:

    painy rules
    
    • To add a new rule run the following command:

      painy rules --add "rule-string"
      
    • To remove i-th rule from the list run the following command:

      painy rules --remove <i>
      

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

Painy-0.2.1.tar.gz (14.1 kB view details)

Uploaded Source

Built Distribution

Painy-0.2.1-py3-none-any.whl (15.1 kB view details)

Uploaded Python 3

File details

Details for the file Painy-0.2.1.tar.gz.

File metadata

  • Download URL: Painy-0.2.1.tar.gz
  • Upload date:
  • Size: 14.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.7

File hashes

Hashes for Painy-0.2.1.tar.gz
Algorithm Hash digest
SHA256 3e18d4ce8313c778a866d374724c56f8ee8b4097652327a6e40103c1b6a15ed2
MD5 8df0c128d95b7190c7fe3dbf9ed19ebc
BLAKE2b-256 6be6c2ca16dc1e19ed58040a8b54d99c3764192602cc36a18d155f0342e8dcec

See more details on using hashes here.

File details

Details for the file Painy-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: Painy-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 15.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.7

File hashes

Hashes for Painy-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6e9cacd0607ff204b5338428dbb762940468dcefcdf5cad3b593f0a98e65d89d
MD5 1e8d4b413a2d4a54eee1bc46a85c71e6
BLAKE2b-256 28cce095caba7bcfd8dafdad1e49c9916079be139e1c88d7249ee2e077e29743

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