git-commit-message 0.5.0__tar.gz → 0.5.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (16) hide show
  1. {git_commit_message-0.5.0 → git_commit_message-0.5.1}/PKG-INFO +19 -10
  2. {git_commit_message-0.5.0 → git_commit_message-0.5.1}/README.md +17 -9
  3. {git_commit_message-0.5.0 → git_commit_message-0.5.1}/pyproject.toml +2 -1
  4. {git_commit_message-0.5.0 → git_commit_message-0.5.1}/src/git_commit_message/_gpt.py +30 -2
  5. {git_commit_message-0.5.0 → git_commit_message-0.5.1}/src/git_commit_message.egg-info/PKG-INFO +19 -10
  6. {git_commit_message-0.5.0 → git_commit_message-0.5.1}/src/git_commit_message.egg-info/requires.txt +1 -0
  7. {git_commit_message-0.5.0 → git_commit_message-0.5.1}/UNLICENSE +0 -0
  8. {git_commit_message-0.5.0 → git_commit_message-0.5.1}/setup.cfg +0 -0
  9. {git_commit_message-0.5.0 → git_commit_message-0.5.1}/src/git_commit_message/__init__.py +0 -0
  10. {git_commit_message-0.5.0 → git_commit_message-0.5.1}/src/git_commit_message/__main__.py +0 -0
  11. {git_commit_message-0.5.0 → git_commit_message-0.5.1}/src/git_commit_message/_cli.py +0 -0
  12. {git_commit_message-0.5.0 → git_commit_message-0.5.1}/src/git_commit_message/_git.py +0 -0
  13. {git_commit_message-0.5.0 → git_commit_message-0.5.1}/src/git_commit_message.egg-info/SOURCES.txt +0 -0
  14. {git_commit_message-0.5.0 → git_commit_message-0.5.1}/src/git_commit_message.egg-info/dependency_links.txt +0 -0
  15. {git_commit_message-0.5.0 → git_commit_message-0.5.1}/src/git_commit_message.egg-info/entry_points.txt +0 -0
  16. {git_commit_message-0.5.0 → git_commit_message-0.5.1}/src/git_commit_message.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: git-commit-message
3
- Version: 0.5.0
3
+ Version: 0.5.1
4
4
  Summary: Generate Git commit messages from staged changes using OpenAI GPT
5
5
  Maintainer-email: Mina Her <minacle@live.com>
6
6
  License: This is free and unencumbered software released into the public domain.
@@ -43,17 +43,20 @@ Classifier: Programming Language :: Python :: 3.13
43
43
  Classifier: Topic :: Software Development :: Version Control :: Git
44
44
  Requires-Python: >=3.13
45
45
  Description-Content-Type: text/markdown
46
+ Requires-Dist: babel>=2.17.0
46
47
  Requires-Dist: openai>=2.6.1
47
48
 
48
49
  # git-commit-message
49
50
 
50
51
  Staged changes -> GPT commit message generator.
51
52
 
53
+ [![asciicast](https://asciinema.org/a/jk0phFqNnc5vaCiIZEYBwZOyN.svg)](https://asciinema.org/a/jk0phFqNnc5vaCiIZEYBwZOyN)
54
+
52
55
  ## Install (PyPI)
53
56
 
54
57
  Install the latest released version from PyPI:
55
58
 
56
- ```fish
59
+ ```sh
57
60
  # User environment (recommended)
58
61
  python -m pip install --user git-commit-message
59
62
 
@@ -69,11 +72,17 @@ python -m pip install --upgrade git-commit-message
69
72
 
70
73
  Quick check:
71
74
 
72
- ```fish
75
+ ```sh
73
76
  git-commit-message --help
74
77
  ```
75
78
 
76
- Set your API key (fish):
79
+ Set your API key (POSIX sh):
80
+
81
+ ```sh
82
+ export OPENAI_API_KEY="sk-..."
83
+ ```
84
+
85
+ Note (fish): In fish, set it as follows.
77
86
 
78
87
  ```fish
79
88
  set -x OPENAI_API_KEY "sk-..."
@@ -81,7 +90,7 @@ set -x OPENAI_API_KEY "sk-..."
81
90
 
82
91
  ## Install (editable)
83
92
 
84
- ```fish
93
+ ```sh
85
94
  python -m pip install -e .
86
95
  ```
87
96
 
@@ -89,32 +98,32 @@ python -m pip install -e .
89
98
 
90
99
  - Print commit message only:
91
100
 
92
- ```fish
101
+ ```sh
93
102
  git add -A
94
103
  git-commit-message "optional extra context about the change"
95
104
  ```
96
105
 
97
106
  - Force single-line subject only:
98
107
 
99
- ```fish
108
+ ```sh
100
109
  git-commit-message --one-line "optional context"
101
110
  ```
102
111
 
103
112
  - Limit subject length (default 72):
104
113
 
105
- ```fish
114
+ ```sh
106
115
  git-commit-message --one-line --max-length 50 "optional context"
107
116
  ```
108
117
 
109
118
  - Commit immediately with editor:
110
119
 
111
- ```fish
120
+ ```sh
112
121
  git-commit-message --commit --edit "refactor parser for speed"
113
122
  ```
114
123
 
115
124
  - Select output language/locale (default: en-GB):
116
125
 
117
- ```fish
126
+ ```sh
118
127
  # American English
119
128
  git-commit-message --language en-US "optional context"
120
129
 
@@ -2,11 +2,13 @@
2
2
 
3
3
  Staged changes -> GPT commit message generator.
4
4
 
5
+ [![asciicast](https://asciinema.org/a/jk0phFqNnc5vaCiIZEYBwZOyN.svg)](https://asciinema.org/a/jk0phFqNnc5vaCiIZEYBwZOyN)
6
+
5
7
  ## Install (PyPI)
6
8
 
7
9
  Install the latest released version from PyPI:
8
10
 
9
- ```fish
11
+ ```sh
10
12
  # User environment (recommended)
11
13
  python -m pip install --user git-commit-message
12
14
 
@@ -22,11 +24,17 @@ python -m pip install --upgrade git-commit-message
22
24
 
23
25
  Quick check:
24
26
 
25
- ```fish
27
+ ```sh
26
28
  git-commit-message --help
27
29
  ```
28
30
 
29
- Set your API key (fish):
31
+ Set your API key (POSIX sh):
32
+
33
+ ```sh
34
+ export OPENAI_API_KEY="sk-..."
35
+ ```
36
+
37
+ Note (fish): In fish, set it as follows.
30
38
 
31
39
  ```fish
32
40
  set -x OPENAI_API_KEY "sk-..."
@@ -34,7 +42,7 @@ set -x OPENAI_API_KEY "sk-..."
34
42
 
35
43
  ## Install (editable)
36
44
 
37
- ```fish
45
+ ```sh
38
46
  python -m pip install -e .
39
47
  ```
40
48
 
@@ -42,32 +50,32 @@ python -m pip install -e .
42
50
 
43
51
  - Print commit message only:
44
52
 
45
- ```fish
53
+ ```sh
46
54
  git add -A
47
55
  git-commit-message "optional extra context about the change"
48
56
  ```
49
57
 
50
58
  - Force single-line subject only:
51
59
 
52
- ```fish
60
+ ```sh
53
61
  git-commit-message --one-line "optional context"
54
62
  ```
55
63
 
56
64
  - Limit subject length (default 72):
57
65
 
58
- ```fish
66
+ ```sh
59
67
  git-commit-message --one-line --max-length 50 "optional context"
60
68
  ```
61
69
 
62
70
  - Commit immediately with editor:
63
71
 
64
- ```fish
72
+ ```sh
65
73
  git-commit-message --commit --edit "refactor parser for speed"
66
74
  ```
67
75
 
68
76
  - Select output language/locale (default: en-GB):
69
77
 
70
- ```fish
78
+ ```sh
71
79
  # American English
72
80
  git-commit-message --language en-US "optional context"
73
81
 
@@ -1,10 +1,11 @@
1
1
  [project]
2
2
  name = "git-commit-message"
3
- version = "0.5.0"
3
+ version = "0.5.1"
4
4
  description = "Generate Git commit messages from staged changes using OpenAI GPT"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.13"
7
7
  dependencies = [
8
+ "babel>=2.17.0",
8
9
  "openai>=2.6.1",
9
10
  ]
10
11
  maintainers = [{ name = "Mina Her", email = "minacle@live.com" }]
@@ -9,6 +9,7 @@ Migrated to use OpenAI Responses API (client.responses.create).
9
9
 
10
10
  import os
11
11
  from typing import Final
12
+ from babel import Locale
12
13
  from openai import OpenAI
13
14
 
14
15
 
@@ -21,11 +22,12 @@ def _build_system_prompt(
21
22
  subject_max: int | None,
22
23
  language: str,
23
24
  ) -> str:
25
+ display_language: str = _language_display(language)
24
26
  max_len = subject_max or 72
25
27
  if single_line:
26
28
  return (
27
29
  f"You are an expert Git commit message generator. "
28
- f"Always use '{language}' spelling and style. "
30
+ f"Always use '{display_language}' spelling and style. "
29
31
  f"Return a single-line imperative subject only (<= {max_len} chars). "
30
32
  f"Do not include a body, bullet points, or any rationale. Do not include any line breaks. "
31
33
  f"Consider the user-provided auxiliary context if present. "
@@ -33,7 +35,7 @@ def _build_system_prompt(
33
35
  )
34
36
  return (
35
37
  f"You are an expert Git commit message generator. "
36
- f"Always use '{language}' spelling and style. "
38
+ f"Always use '{display_language}' spelling and style. "
37
39
  f"The subject line is mandatory: you MUST start the output with the subject as the very first non-empty line, "
38
40
  f"in imperative mood, and keep it <= {max_len} chars. Insert exactly one blank line after the subject. "
39
41
  f"Never start with bullets, headings, labels, or any other text. Then include a body in this format.\n\n"
@@ -52,6 +54,7 @@ def _build_system_prompt(
52
54
  f"- Prefer imperative mood verbs (Add, Fix, Update, Remove, Refactor, Document, etc.).\n"
53
55
  f"- Focus on what changed and why; avoid copying diff hunks verbatim.\n"
54
56
  f"- The only allowed label is the equivalent of 'Rationale:' translated into the target language; do not add other headings or prefaces.\n"
57
+ f"- All text (subject, bullets, rationale label, rationale content) MUST be in the target language: '{display_language}'. Do not mix other languages.\n"
55
58
  f"- Do not include the '---' delimiter lines, code fences, or any surrounding labels like 'Commit message:'.\n"
56
59
  f"- Do not copy or reuse any example text verbatim; produce original content based on the provided diff and context.\n"
57
60
  f"- If few details are necessary, include at least one bullet summarising the key change.\n"
@@ -61,6 +64,31 @@ def _build_system_prompt(
61
64
  )
62
65
 
63
66
 
67
+ def _language_display(language: str) -> str:
68
+ """Return a human-friendly language display like 'ko-KR, Korean (South Korea)'."""
69
+
70
+ try:
71
+ locale = Locale.parse(language, sep="-")
72
+ except Exception:
73
+ return language
74
+
75
+ tag_parts = [
76
+ locale.language,
77
+ locale.script,
78
+ locale.territory,
79
+ locale.variant,
80
+ ]
81
+ tag = "-".join(part for part in tag_parts if part)
82
+ if not tag:
83
+ return language
84
+
85
+ english_name = locale.get_display_name("en") or ""
86
+ if not english_name:
87
+ return f"[{tag}]"
88
+
89
+ return f"{english_name.capitalize()} [{tag}]"
90
+
91
+
64
92
  def _instructions(
65
93
  *,
66
94
  single_line: bool,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: git-commit-message
3
- Version: 0.5.0
3
+ Version: 0.5.1
4
4
  Summary: Generate Git commit messages from staged changes using OpenAI GPT
5
5
  Maintainer-email: Mina Her <minacle@live.com>
6
6
  License: This is free and unencumbered software released into the public domain.
@@ -43,17 +43,20 @@ Classifier: Programming Language :: Python :: 3.13
43
43
  Classifier: Topic :: Software Development :: Version Control :: Git
44
44
  Requires-Python: >=3.13
45
45
  Description-Content-Type: text/markdown
46
+ Requires-Dist: babel>=2.17.0
46
47
  Requires-Dist: openai>=2.6.1
47
48
 
48
49
  # git-commit-message
49
50
 
50
51
  Staged changes -> GPT commit message generator.
51
52
 
53
+ [![asciicast](https://asciinema.org/a/jk0phFqNnc5vaCiIZEYBwZOyN.svg)](https://asciinema.org/a/jk0phFqNnc5vaCiIZEYBwZOyN)
54
+
52
55
  ## Install (PyPI)
53
56
 
54
57
  Install the latest released version from PyPI:
55
58
 
56
- ```fish
59
+ ```sh
57
60
  # User environment (recommended)
58
61
  python -m pip install --user git-commit-message
59
62
 
@@ -69,11 +72,17 @@ python -m pip install --upgrade git-commit-message
69
72
 
70
73
  Quick check:
71
74
 
72
- ```fish
75
+ ```sh
73
76
  git-commit-message --help
74
77
  ```
75
78
 
76
- Set your API key (fish):
79
+ Set your API key (POSIX sh):
80
+
81
+ ```sh
82
+ export OPENAI_API_KEY="sk-..."
83
+ ```
84
+
85
+ Note (fish): In fish, set it as follows.
77
86
 
78
87
  ```fish
79
88
  set -x OPENAI_API_KEY "sk-..."
@@ -81,7 +90,7 @@ set -x OPENAI_API_KEY "sk-..."
81
90
 
82
91
  ## Install (editable)
83
92
 
84
- ```fish
93
+ ```sh
85
94
  python -m pip install -e .
86
95
  ```
87
96
 
@@ -89,32 +98,32 @@ python -m pip install -e .
89
98
 
90
99
  - Print commit message only:
91
100
 
92
- ```fish
101
+ ```sh
93
102
  git add -A
94
103
  git-commit-message "optional extra context about the change"
95
104
  ```
96
105
 
97
106
  - Force single-line subject only:
98
107
 
99
- ```fish
108
+ ```sh
100
109
  git-commit-message --one-line "optional context"
101
110
  ```
102
111
 
103
112
  - Limit subject length (default 72):
104
113
 
105
- ```fish
114
+ ```sh
106
115
  git-commit-message --one-line --max-length 50 "optional context"
107
116
  ```
108
117
 
109
118
  - Commit immediately with editor:
110
119
 
111
- ```fish
120
+ ```sh
112
121
  git-commit-message --commit --edit "refactor parser for speed"
113
122
  ```
114
123
 
115
124
  - Select output language/locale (default: en-GB):
116
125
 
117
- ```fish
126
+ ```sh
118
127
  # American English
119
128
  git-commit-message --language en-US "optional context"
120
129