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 with the help of OpenAI models. It automatically check the staged changes in your repository and generate a commit message based on the changes.
-
Works well with Jupyter Notebooks (
.ipynb
files) by usingnbdime
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. For example, set maximum number of characters/sentences in the commit message.
-
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 variableOPENAI_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 toTrue
. 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. By default it is set tofalse
. (Experimental)max_num_commits_style
- the maximum number of last commits to use for the style. By default it is set to5
.max_characters
(used as a property in one of default rules) - the desired maximum number of characters in the commit message. By default it is set to100
.
-
To get the list of rules run the following command:
painy rules
-
To add a new rule run the following command:
painy rules --add "Your own rule"
-
To remove i-th rule from the list run the following command:
painy rules --remove <i>
-
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file Painy-0.2.2.tar.gz
.
File metadata
- Download URL: Painy-0.2.2.tar.gz
- Upload date:
- Size: 14.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e9f7701d93b624bb46db5184ae87aec7d9d77b48d7f338d70f150ed8c21a6038 |
|
MD5 | abb8d83282830ce32c3bc36d955cdf76 |
|
BLAKE2b-256 | bba3f2c0c4cb4f384e134d7aba63fa4b5354675ad67e4deba5ef814aae6ccb76 |
File details
Details for the file Painy-0.2.2-py3-none-any.whl
.
File metadata
- Download URL: Painy-0.2.2-py3-none-any.whl
- Upload date:
- Size: 15.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 76eb6d635622c991b6d0dbb3c0877d2616d414c09544de597056db1d74fdfdd0 |
|
MD5 | c66bf67746724269bd9c68e8f46b9e27 |
|
BLAKE2b-256 | bf0d56e01e10749ead7ffaa7422a91df97aeb8f59547df6413c5e66a61b2df00 |