Make your commit messages extremely catchy.
Project description
clickbait-commit-messages
Make your commit messages extremely catchy.
Example:
$ git commit -m "remove useless comment"
make-clickbaity..........................................................Passed
- hook id: make-clickbaity
- duration: 2.39s
[master 9c72b79] 🚨 Developers Rejoice: Unnecessary Comment 🗑VANISHES in Shocking Git Commit! 😱
1 file changed, 2 insertions(+), 1 deletion(-)
Prerequisites
- Hugging Face access token (if using the Hugging Face provider): https://huggingface.co/settings/tokens
- Groq API token (if using the Groq provider): https://console.groq.com/keys
How to use
This tool is meant to be used in conjunction with pre-commit. In order to use it, you should:
-
Install
clickbait-commit-messages
pip install clickbait-commit-messages
-
Add the following entry to your
.pre-commit-config.yaml
file:default_install_hook_types: [pre-commit, prepare-commit-msg] repos: - repo: local hooks: - id: make-clickbaity name: make-clickbaity entry: make-clickbaity language: python stages: [prepare-commit-msg] verbose: true
Please note a couple of things:
default_install_hook_types: [pre-commit, prepare-commit-msg]
tells pre-commit to install themake-clickbaity
git hook at a different stage than the default one (which ispre-commit
). If you omit this line,pre-commit
will not install this hook to run during theprepare-commit-msg
stage (i.e. after the commit is done but before the commit message is confirmed), which is indeed the only stage this hook is meant to run at (that's why we setstages: [prepare-commit-msg]
by the way)- Rather than specifying the repo URL in the
repo
field, you must put "local". This is because in order to run properly, this hook has to have access to your local environment. In particular, it needs to be able to access theHF_TOKEN
and/or theGROQ_API_TOKEN
environment variable (see step 3)
-
Run
pre-commit install
to install the hook -
Based on which provider (external API service to generate clickbait commit messages) you wish to use, run:
export HF_TOKEN=hf_**********************************
export GROQ_API_TOKEN=gsk_****************************************************
Where obviously you need to replace the values above with your own token. If you'd rather avoid doing this every time, add that line to your
~/.bashrc
(or equivalents if you're using another shell other than Bash)
Configuration options
The behavior of this hook can be customized using the following configuration options:
--provider
: The provider to use for generating clickbait commit messages. Options: [huggingface
,groq
]. Defaults tohuggingface
--model-name
: The actual model to use to turn regular commit messages into clickbaity ones. Each provider has its own available models. Defaults tomistralai/Mixtral-8x7B-Instruct-v0.1
list-models -p <provider_name>
lists all the available models for a given provider
--style
: The style of clickbait to generate. Supported values:youtube
(akin to a catchy title of a YouTube video),news
(akin to a clickbaity title of a news article). Defaults toyoutube
--use-emojis
: Use emojis in the clickbaity message
As an example, here's how you would specify a custom configuration:
hooks:
- id: make-clickbaity
name: make-clickbaity
entry: make-clickbaity
args: [
"--provider", "huggingface",
"--model-name", "mistralai/Mixtral-8x7B-Instruct-v0.1",
"--style", "news",
"--use-emojis"
]
language: python
stages: [prepare-commit-msg]
verbose: true
Things to keep in mind
For the Hugging Face provider
-
Some models, such as
mistralai/Mixtral-8x7B-Instruct-v0.1
, are gated, meaning that you need to explicitly request access to them before you can use them via the API. To do that, visit the home page of the model in Hugging Face and follow the instructions to request access to it -
Some models, such as
meta-llama/Meta-Llama-3-70B-Instruct
, may not be usable on the free tier of the API. When trying to use them to generate a clickbait commit message, you might get an error saying you need a Pro subscription or something similar. In order to probe whether a model will be usable or not on the free tier, you can shoot a cURL request like the following and check the response (replace${MODEL_NAME}
and${API_TOKEN}
appropriately):curl https://api-inference.huggingface.co/models/${MODEL_NAME} \ -X POST \ -d '{"inputs": "Some dummy prompt, the format and content are not important"}' \ -H "Content-Type: application/json" \ -H "Authorization: Bearer ${API_TOKEN}"
If you don't receive any error message, that means you're good to go 👍
For the Groq provider
- For some reason, Llama3 models hosted on Groq (but not those hosted on Hugging Face) don't seem to like the default prompt I'm using to generate clickbait commit messages, so most of the time they just return empty responses. If you wish to use the Groq provider, consider using models other than Llama3
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 clickbait_commit_messages-1.0.0.tar.gz
.
File metadata
- Download URL: clickbait_commit_messages-1.0.0.tar.gz
- Upload date:
- Size: 8.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.6.1 CPython/3.11.6 Linux/6.5.0-28-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8ea67d06f78d9f3f0bc682508cb46e9b5edb809428b6e1b59c9a1a231f075dd0 |
|
MD5 | 5644f6c811eb6947170a02d998093188 |
|
BLAKE2b-256 | 695536f23810ece77059747bd12d84deaf01b66c2cb2379aec32d80a2a07fecb |
File details
Details for the file clickbait_commit_messages-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: clickbait_commit_messages-1.0.0-py3-none-any.whl
- Upload date:
- Size: 9.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.6.1 CPython/3.11.6 Linux/6.5.0-28-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f5f3db5ce2480fd399e1e92fccf6ec61d244e68d05857b36b5d61ed03630ce5d |
|
MD5 | 106b92d48e6f3443aeca79fa38cf6047 |
|
BLAKE2b-256 | ae0545caaa3cfd3fef2e0ca12b618e01936ed509274d0a8e61ae2406c85843d2 |