commit-maker 0.1.2__tar.gz → 0.2.0__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.
@@ -1,18 +1,21 @@
1
1
  Metadata-Version: 2.4
2
- Name: commit_maker
3
- Version: 0.1.2
2
+ Name: commit-maker
3
+ Version: 0.2.0
4
4
  Summary: CLI-утилита для генерации git-коммитов с помощью ИИ
5
+ Home-page: https://github.com/Sashayerty/commit_maker
5
6
  Author: Alex Bulgakov
6
7
  Author-email: Alex Bulgakov <sashayerty@ya.ru>
7
8
  License: MIT
9
+ Project-URL: Homepage, https://github.com/sashayerty/commit_maker
8
10
  Requires-Python: >=3.8
9
11
  Description-Content-Type: text/markdown
10
12
  License-File: LICENSE
11
13
  Dynamic: author
14
+ Dynamic: home-page
12
15
  Dynamic: license-file
13
16
  Dynamic: requires-python
14
17
 
15
- # Commit Maker [![Created with Python](https://img.shields.io/badge/Created_with-Python-blue)](https://www.python.org/) [![Created with uv](https://img.shields.io/badge/Created_with-uv-purple)](https://docs.astral.sh/uv/) [![Created with ollama](https://img.shields.io/badge/Created_with-ollama-white)](https://ollama.com/)
18
+ # Commit Maker [![Created with Python](https://img.shields.io/badge/Created_with-Python-blue)](https://www.python.org/) [![Created with uv](https://img.shields.io/badge/Created_with-uv-purple)](https://docs.astral.sh/uv/) [![Created with ollama](https://img.shields.io/badge/Created_with-ollama-white)](https://ollama.com/) [![PyPi](https://img.shields.io/badge/Available_on-pypi-orange)](https://pypi.org/project/commit-maker/)
16
19
 
17
20
  ![Демонстрация](./commit_maker.svg)
18
21
 
@@ -92,14 +95,6 @@ pip3 install commit_maker
92
95
 
93
96
  ## Использование
94
97
 
95
- ### Windows
96
-
97
- ```cmd
98
- commit_maker [OPTION] [VALUE]
99
- ```
100
-
101
- ### Linux/MacOS
102
-
103
98
  ```bash
104
99
  commit_maker [OPTION] [VALUE]
105
100
  ```
@@ -1,4 +1,4 @@
1
- # Commit Maker [![Created with Python](https://img.shields.io/badge/Created_with-Python-blue)](https://www.python.org/) [![Created with uv](https://img.shields.io/badge/Created_with-uv-purple)](https://docs.astral.sh/uv/) [![Created with ollama](https://img.shields.io/badge/Created_with-ollama-white)](https://ollama.com/)
1
+ # Commit Maker [![Created with Python](https://img.shields.io/badge/Created_with-Python-blue)](https://www.python.org/) [![Created with uv](https://img.shields.io/badge/Created_with-uv-purple)](https://docs.astral.sh/uv/) [![Created with ollama](https://img.shields.io/badge/Created_with-ollama-white)](https://ollama.com/) [![PyPi](https://img.shields.io/badge/Available_on-pypi-orange)](https://pypi.org/project/commit-maker/)
2
2
 
3
3
  ![Демонстрация](./commit_maker.svg)
4
4
 
@@ -78,14 +78,6 @@ pip3 install commit_maker
78
78
 
79
79
  ## Использование
80
80
 
81
- ### Windows
82
-
83
- ```cmd
84
- commit_maker [OPTION] [VALUE]
85
- ```
86
-
87
- ### Linux/MacOS
88
-
89
81
  ```bash
90
82
  commit_maker [OPTION] [VALUE]
91
83
  ```
@@ -1,6 +1,6 @@
1
1
  [project]
2
- name = "commit_maker"
3
- version = "0.1.2"
2
+ name = "commit-maker"
3
+ version = "0.2.0"
4
4
  authors = [
5
5
  { name="Alex Bulgakov", email="sashayerty@ya.ru" }
6
6
  ]
@@ -11,4 +11,7 @@ requires-python = ">=3.8"
11
11
  dependencies = []
12
12
 
13
13
  [project.scripts]
14
- commit_maker = "commit_maker.main:main"
14
+ commit_maker = "commit_maker.main:main"
15
+
16
+ [project.urls]
17
+ Homepage = "https://github.com/sashayerty/commit_maker"
@@ -1,8 +1,8 @@
1
1
  from setuptools import find_packages, setup
2
2
 
3
3
  setup(
4
- name="commit_maker",
5
- version="0.1.2",
4
+ name="commit-maker",
5
+ version="0.2.0",
6
6
  author="Alex Bulgakov",
7
7
  author_email="sashayerty@ya.ru",
8
8
  description="CLI-утилита для генерации git-коммитов с помощью ИИ",
@@ -24,4 +24,5 @@ setup(
24
24
  "License :: OSI Approved :: MIT License",
25
25
  "Operating System :: OS Independent",
26
26
  ],
27
+ url="https://github.com/Sashayerty/commit_maker",
27
28
  )
@@ -9,25 +9,7 @@ import urllib
9
9
  import urllib.request
10
10
 
11
11
  # Константы
12
- mistral_api_key = os.environ["MISTRAL_API_KEY"]
13
-
14
- # Для цветных логов
15
- COLOR_RED = "\033[31m"
16
- COLOR_GREEN = "\033[32m"
17
- COLOR_YELLOW = "\033[33m"
18
- COLOR_BLUE = "\033[94m"
19
- COLOR_MAGENTA = "\033[95m"
20
- COLOR_CYAN = "\033[96m"
21
- COLOR_RESET = "\033[0m"
22
- COLORS_DICT = {
23
- "red": COLOR_RED,
24
- "green": COLOR_GREEN,
25
- "yellow": COLOR_YELLOW,
26
- "blue": COLOR_BLUE,
27
- "magenta": COLOR_MAGENTA,
28
- "cyan": COLOR_CYAN,
29
- "reset": COLOR_RESET,
30
- }
12
+ mistral_api_key = os.environ.get("MISTRAL_API_KEY")
31
13
 
32
14
  # Парсер параметров
33
15
  parser = argparse.ArgumentParser(
@@ -48,9 +30,9 @@ parser.add_argument(
48
30
  "-m",
49
31
  "--max-symbols",
50
32
  type=int,
51
- default=250,
33
+ default=200,
52
34
  metavar="[max_symbols]",
53
- help="Длина сообщения коммита. Defaults to 150",
35
+ help="Длина сообщения коммита. Defaults to 200",
54
36
  )
55
37
  parser.add_argument(
56
38
  "-M",
@@ -67,22 +49,15 @@ parser.add_argument(
67
49
  help="Запуск с выводом сообщения на основе зайстейдженных "
68
50
  "изменений, без создания коммита",
69
51
  )
70
-
71
- # Парсинг аргументов
72
- parsed_args = parser.parse_args()
73
- use_local_models = parsed_args.local_models
74
- max_symbols = parsed_args.max_symbols
75
- model = parsed_args.model
76
- dry_run = parsed_args.dry_run
77
-
78
- # Промпт для ИИ
79
- prompt_for_ai = f"""Привет! Ты составитель коммитов для git.
80
- Сгенерируй коммит-месседж на РУССКОМ языке, который:
81
- 1. Точно отражает суть изменений
82
- 2. Не превышает {max_symbols} символов
83
- Опирайся на данные от 'git status' и 'git diff'.
84
- В ответ на это сообщение тебе нужно предоставить
85
- ТОЛЬКО коммит. Пиши просто обычный текст, без markdown!"""
52
+ parser.add_argument(
53
+ "-t",
54
+ "--temperature",
55
+ default=1.0,
56
+ type=float,
57
+ help="Температура модели при создании месседжа.\
58
+ Находится на отрезке [0.0, 1.5]. Defaults to 1.0",
59
+ metavar="[temperature]",
60
+ )
86
61
 
87
62
 
88
63
  # Класс для использования API Mistral AI
@@ -252,7 +227,22 @@ def colored(
252
227
  `print(colored(string='Success!', color='green'))` # Выводит 'Success!'
253
228
  зеленого цвета
254
229
  """
255
- global COLORS_DICT
230
+ COLOR_RED = "\033[31m"
231
+ COLOR_GREEN = "\033[32m"
232
+ COLOR_YELLOW = "\033[33m"
233
+ COLOR_BLUE = "\033[94m"
234
+ COLOR_MAGENTA = "\033[95m"
235
+ COLOR_CYAN = "\033[96m"
236
+ COLOR_RESET = "\033[0m"
237
+ COLORS_DICT = {
238
+ "red": COLOR_RED,
239
+ "green": COLOR_GREEN,
240
+ "yellow": COLOR_YELLOW,
241
+ "blue": COLOR_BLUE,
242
+ "magenta": COLOR_MAGENTA,
243
+ "cyan": COLOR_CYAN,
244
+ "reset": COLOR_RESET,
245
+ }
256
246
  return (
257
247
  bold(f"{COLORS_DICT[color]}{string}{COLORS_DICT['reset']}")
258
248
  if text_bold
@@ -264,8 +254,30 @@ def colored(
264
254
 
265
255
 
266
256
  def main() -> None:
267
- global mistral_api_key, prompt_for_ai, use_local_models, model, dry_run
257
+ # Парсинг аргументов
258
+ parsed_args = parser.parse_args()
259
+ use_local_models = parsed_args.local_models
260
+ max_symbols = parsed_args.max_symbols
261
+ model = parsed_args.model
262
+ dry_run = parsed_args.dry_run
263
+ temperature = parsed_args.temperature
264
+
265
+ # Промпт для ИИ
266
+ prompt_for_ai = f"""Привет! Ты составитель коммитов для git.
267
+ Сгенерируй коммит-месседж на РУССКОМ языке, который:
268
+ 1. Точно отражает суть изменений
269
+ 2. Не превышает {max_symbols} символов
270
+ Опирайся на данные от 'git status' и 'git diff'.
271
+ В ответ на это сообщение тебе нужно предоставить
272
+ ТОЛЬКО коммит. Пиши просто обычный текст, без markdown!"""
273
+
268
274
  try:
275
+ if not use_local_models and not mistral_api_key:
276
+ print(
277
+ colored("Не найден MISTRAL_API_KEY для работы с API!", "red")
278
+ )
279
+ return
280
+
269
281
  # Получаем версию git, если он есть
270
282
  git_version = subprocess.run( # noqa
271
283
  ["git", "--version"],
@@ -409,8 +421,6 @@ def main() -> None:
409
421
  ):
410
422
  subprocess.run(
411
423
  ["git", "add", "-A"],
412
- capture_output=True,
413
- encoding="utf-8",
414
424
  )
415
425
  else:
416
426
  print(
@@ -464,7 +474,7 @@ def main() -> None:
464
474
  + git_status.stdout
465
475
  + "Git diff: "
466
476
  + git_diff.stdout,
467
- temperature=1.0,
477
+ temperature=temperature,
468
478
  )
469
479
  commit_with_message_from_ai = input(
470
480
  "Закоммитить с сообщением "
@@ -487,7 +497,7 @@ def main() -> None:
487
497
  + git_status.stdout
488
498
  + "Git diff: "
489
499
  + git_diff.stdout,
490
- temperature=1.0,
500
+ temperature=temperature,
491
501
  )
492
502
  print(
493
503
  colored(
@@ -527,8 +537,6 @@ def main() -> None:
527
537
  (
528
538
  subprocess.run(
529
539
  ["git", "add", "-A"],
530
- capture_output=True,
531
- encoding="utf-8",
532
540
  ),
533
541
  subprocess.run(
534
542
  [
@@ -1,18 +1,21 @@
1
1
  Metadata-Version: 2.4
2
- Name: commit_maker
3
- Version: 0.1.2
2
+ Name: commit-maker
3
+ Version: 0.2.0
4
4
  Summary: CLI-утилита для генерации git-коммитов с помощью ИИ
5
+ Home-page: https://github.com/Sashayerty/commit_maker
5
6
  Author: Alex Bulgakov
6
7
  Author-email: Alex Bulgakov <sashayerty@ya.ru>
7
8
  License: MIT
9
+ Project-URL: Homepage, https://github.com/sashayerty/commit_maker
8
10
  Requires-Python: >=3.8
9
11
  Description-Content-Type: text/markdown
10
12
  License-File: LICENSE
11
13
  Dynamic: author
14
+ Dynamic: home-page
12
15
  Dynamic: license-file
13
16
  Dynamic: requires-python
14
17
 
15
- # Commit Maker [![Created with Python](https://img.shields.io/badge/Created_with-Python-blue)](https://www.python.org/) [![Created with uv](https://img.shields.io/badge/Created_with-uv-purple)](https://docs.astral.sh/uv/) [![Created with ollama](https://img.shields.io/badge/Created_with-ollama-white)](https://ollama.com/)
18
+ # Commit Maker [![Created with Python](https://img.shields.io/badge/Created_with-Python-blue)](https://www.python.org/) [![Created with uv](https://img.shields.io/badge/Created_with-uv-purple)](https://docs.astral.sh/uv/) [![Created with ollama](https://img.shields.io/badge/Created_with-ollama-white)](https://ollama.com/) [![PyPi](https://img.shields.io/badge/Available_on-pypi-orange)](https://pypi.org/project/commit-maker/)
16
19
 
17
20
  ![Демонстрация](./commit_maker.svg)
18
21
 
@@ -92,14 +95,6 @@ pip3 install commit_maker
92
95
 
93
96
  ## Использование
94
97
 
95
- ### Windows
96
-
97
- ```cmd
98
- commit_maker [OPTION] [VALUE]
99
- ```
100
-
101
- ### Linux/MacOS
102
-
103
98
  ```bash
104
99
  commit_maker [OPTION] [VALUE]
105
100
  ```
File without changes
File without changes