commitizen 4.17.0__tar.gz → 4.17.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 (75) hide show
  1. {commitizen-4.17.0 → commitizen-4.17.1}/PKG-INFO +1 -6
  2. commitizen-4.17.1/commitizen/__version__.py +1 -0
  3. {commitizen-4.17.0 → commitizen-4.17.1}/commitizen/commands/init.py +45 -13
  4. {commitizen-4.17.0 → commitizen-4.17.1}/commitizen/project_info.py +14 -1
  5. {commitizen-4.17.0 → commitizen-4.17.1}/docs/README.md +0 -5
  6. {commitizen-4.17.0 → commitizen-4.17.1}/pyproject.toml +1 -1
  7. {commitizen-4.17.0 → commitizen-4.17.1}/pyproject.toml.orig +1 -1
  8. commitizen-4.17.0/commitizen/__version__.py +0 -1
  9. {commitizen-4.17.0 → commitizen-4.17.1}/LICENSE +0 -0
  10. {commitizen-4.17.0 → commitizen-4.17.1}/commitizen/__init__.py +0 -0
  11. {commitizen-4.17.0 → commitizen-4.17.1}/commitizen/__main__.py +0 -0
  12. {commitizen-4.17.0 → commitizen-4.17.1}/commitizen/bump.py +0 -0
  13. {commitizen-4.17.0 → commitizen-4.17.1}/commitizen/changelog.py +0 -0
  14. {commitizen-4.17.0 → commitizen-4.17.1}/commitizen/changelog_formats/__init__.py +0 -0
  15. {commitizen-4.17.0 → commitizen-4.17.1}/commitizen/changelog_formats/asciidoc.py +0 -0
  16. {commitizen-4.17.0 → commitizen-4.17.1}/commitizen/changelog_formats/base.py +0 -0
  17. {commitizen-4.17.0 → commitizen-4.17.1}/commitizen/changelog_formats/markdown.py +0 -0
  18. {commitizen-4.17.0 → commitizen-4.17.1}/commitizen/changelog_formats/restructuredtext.py +0 -0
  19. {commitizen-4.17.0 → commitizen-4.17.1}/commitizen/changelog_formats/textile.py +0 -0
  20. {commitizen-4.17.0 → commitizen-4.17.1}/commitizen/cli.py +0 -0
  21. {commitizen-4.17.0 → commitizen-4.17.1}/commitizen/cmd.py +0 -0
  22. {commitizen-4.17.0 → commitizen-4.17.1}/commitizen/commands/__init__.py +0 -0
  23. {commitizen-4.17.0 → commitizen-4.17.1}/commitizen/commands/bump.py +0 -0
  24. {commitizen-4.17.0 → commitizen-4.17.1}/commitizen/commands/changelog.py +0 -0
  25. {commitizen-4.17.0 → commitizen-4.17.1}/commitizen/commands/check.py +0 -0
  26. {commitizen-4.17.0 → commitizen-4.17.1}/commitizen/commands/commit.py +0 -0
  27. {commitizen-4.17.0 → commitizen-4.17.1}/commitizen/commands/example.py +0 -0
  28. {commitizen-4.17.0 → commitizen-4.17.1}/commitizen/commands/info.py +0 -0
  29. {commitizen-4.17.0 → commitizen-4.17.1}/commitizen/commands/list_cz.py +0 -0
  30. {commitizen-4.17.0 → commitizen-4.17.1}/commitizen/commands/schema.py +0 -0
  31. {commitizen-4.17.0 → commitizen-4.17.1}/commitizen/commands/version.py +0 -0
  32. {commitizen-4.17.0 → commitizen-4.17.1}/commitizen/config/__init__.py +0 -0
  33. {commitizen-4.17.0 → commitizen-4.17.1}/commitizen/config/base_config.py +0 -0
  34. {commitizen-4.17.0 → commitizen-4.17.1}/commitizen/config/factory.py +0 -0
  35. {commitizen-4.17.0 → commitizen-4.17.1}/commitizen/config/json_config.py +0 -0
  36. {commitizen-4.17.0 → commitizen-4.17.1}/commitizen/config/toml_config.py +0 -0
  37. {commitizen-4.17.0 → commitizen-4.17.1}/commitizen/config/yaml_config.py +0 -0
  38. {commitizen-4.17.0 → commitizen-4.17.1}/commitizen/cz/__init__.py +0 -0
  39. {commitizen-4.17.0 → commitizen-4.17.1}/commitizen/cz/base.py +0 -0
  40. {commitizen-4.17.0 → commitizen-4.17.1}/commitizen/cz/conventional_commits/__init__.py +0 -0
  41. {commitizen-4.17.0 → commitizen-4.17.1}/commitizen/cz/conventional_commits/conventional_commits.py +0 -0
  42. {commitizen-4.17.0 → commitizen-4.17.1}/commitizen/cz/conventional_commits/conventional_commits_info.txt +0 -0
  43. {commitizen-4.17.0 → commitizen-4.17.1}/commitizen/cz/customize/__init__.py +0 -0
  44. {commitizen-4.17.0 → commitizen-4.17.1}/commitizen/cz/customize/customize.py +0 -0
  45. {commitizen-4.17.0 → commitizen-4.17.1}/commitizen/cz/customize/customize_info.txt +0 -0
  46. {commitizen-4.17.0 → commitizen-4.17.1}/commitizen/cz/exceptions.py +0 -0
  47. {commitizen-4.17.0 → commitizen-4.17.1}/commitizen/cz/jira/__init__.py +0 -0
  48. {commitizen-4.17.0 → commitizen-4.17.1}/commitizen/cz/jira/jira.py +0 -0
  49. {commitizen-4.17.0 → commitizen-4.17.1}/commitizen/cz/jira/jira_info.txt +0 -0
  50. {commitizen-4.17.0 → commitizen-4.17.1}/commitizen/cz/utils.py +0 -0
  51. {commitizen-4.17.0 → commitizen-4.17.1}/commitizen/defaults.py +0 -0
  52. {commitizen-4.17.0 → commitizen-4.17.1}/commitizen/exceptions.py +0 -0
  53. {commitizen-4.17.0 → commitizen-4.17.1}/commitizen/factory.py +0 -0
  54. {commitizen-4.17.0 → commitizen-4.17.1}/commitizen/git.py +0 -0
  55. {commitizen-4.17.0 → commitizen-4.17.1}/commitizen/hooks.py +0 -0
  56. {commitizen-4.17.0 → commitizen-4.17.1}/commitizen/out.py +0 -0
  57. {commitizen-4.17.0 → commitizen-4.17.1}/commitizen/providers/__init__.py +0 -0
  58. {commitizen-4.17.0 → commitizen-4.17.1}/commitizen/providers/base_provider.py +0 -0
  59. {commitizen-4.17.0 → commitizen-4.17.1}/commitizen/providers/cargo_provider.py +0 -0
  60. {commitizen-4.17.0 → commitizen-4.17.1}/commitizen/providers/commitizen_provider.py +0 -0
  61. {commitizen-4.17.0 → commitizen-4.17.1}/commitizen/providers/composer_provider.py +0 -0
  62. {commitizen-4.17.0 → commitizen-4.17.1}/commitizen/providers/npm_provider.py +0 -0
  63. {commitizen-4.17.0 → commitizen-4.17.1}/commitizen/providers/pep621_provider.py +0 -0
  64. {commitizen-4.17.0 → commitizen-4.17.1}/commitizen/providers/poetry_provider.py +0 -0
  65. {commitizen-4.17.0 → commitizen-4.17.1}/commitizen/providers/scm_provider.py +0 -0
  66. {commitizen-4.17.0 → commitizen-4.17.1}/commitizen/providers/uv_provider.py +0 -0
  67. {commitizen-4.17.0 → commitizen-4.17.1}/commitizen/py.typed +0 -0
  68. {commitizen-4.17.0 → commitizen-4.17.1}/commitizen/question.py +0 -0
  69. {commitizen-4.17.0 → commitizen-4.17.1}/commitizen/tags.py +0 -0
  70. {commitizen-4.17.0 → commitizen-4.17.1}/commitizen/templates/CHANGELOG.adoc.j2 +0 -0
  71. {commitizen-4.17.0 → commitizen-4.17.1}/commitizen/templates/CHANGELOG.md.j2 +0 -0
  72. {commitizen-4.17.0 → commitizen-4.17.1}/commitizen/templates/CHANGELOG.rst.j2 +0 -0
  73. {commitizen-4.17.0 → commitizen-4.17.1}/commitizen/templates/CHANGELOG.textile.j2 +0 -0
  74. {commitizen-4.17.0 → commitizen-4.17.1}/commitizen/version_increment.py +0 -0
  75. {commitizen-4.17.0 → commitizen-4.17.1}/commitizen/version_schemes.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: commitizen
3
- Version: 4.17.0
3
+ Version: 4.17.1
4
4
  Summary: Python commitizen client tool
5
5
  Keywords: commitizen,conventional,commits,git
6
6
  Author: Santiago Fraire
@@ -349,11 +349,6 @@ After installation, you can verify the completion is working by:
349
349
 
350
350
  For more detailed information about argcomplete configuration and troubleshooting, visit the [argcomplete documentation](https://kislyuk.github.io/argcomplete/).
351
351
 
352
- ## Star History
353
-
354
- [![Star History Chart](https://api.star-history.com/svg?repos=commitizen-tools/commitizen)](https://star-history.com/#commitizen-tools/commitizen)
355
-
356
-
357
352
  ## Sponsors
358
353
 
359
354
  These are our cool sponsors!
@@ -0,0 +1 @@
1
+ __version__ = "4.17.1"
@@ -109,13 +109,7 @@ class Init:
109
109
  tag_format = self._ask_tag_format(tag) # confirm & text
110
110
  update_changelog_on_bump = self._ask_update_changelog_on_bump() # confirm
111
111
  major_version_zero = self._ask_major_version_zero(version) # confirm
112
- hook_types: list[str] | None = questionary.checkbox(
113
- "What types of pre-commit hook you want to install? (Leave blank if you don't want to install)",
114
- choices=[
115
- questionary.Choice("commit-msg", checked=False),
116
- questionary.Choice("pre-push", checked=False),
117
- ],
118
- ).unsafe_ask()
112
+ hook_types = self._ask_hook_types()
119
113
  except KeyboardInterrupt:
120
114
  raise InitFailedError("Stopped by user")
121
115
 
@@ -128,13 +122,9 @@ class Init:
128
122
  ) as config_file:
129
123
  yaml.safe_dump(config_data, stream=config_file)
130
124
 
131
- if not project_info.is_pre_commit_installed():
132
- raise InitFailedError(
133
- "Failed to install pre-commit hook.\n"
134
- "pre-commit is not installed in current environment."
135
- )
125
+ installer = self._ask_hook_installer()
136
126
 
137
- cmd_args = ["pre-commit", "install"]
127
+ cmd_args = [installer, "install"]
138
128
  for ty in hook_types:
139
129
  cmd_args.extend(["--hook-type", ty])
140
130
  c = cmd.run(cmd_args)
@@ -164,6 +154,48 @@ class Init:
164
154
  out.info("\tcz bump\n")
165
155
  out.success("Configuration complete 🚀")
166
156
 
157
+ def _ask_hook_types(self) -> list[str] | None:
158
+ """Ask which pre-commit hook types to install.
159
+
160
+ Skip the question when neither ``pre-commit`` nor ``prek`` is
161
+ installed, so users who do not use those tools are not prompted.
162
+ """
163
+ if not project_info.available_hook_installers():
164
+ out.info("No pre-commit hook detected, skipping question")
165
+ return None
166
+
167
+ hook_types: list[str] | None = questionary.checkbox(
168
+ "What types of pre-commit hook you want to install? (Leave blank if you don't want to install)",
169
+ choices=[
170
+ questionary.Choice("commit-msg", checked=False),
171
+ questionary.Choice("pre-push", checked=False),
172
+ ],
173
+ ).unsafe_ask()
174
+ return hook_types
175
+
176
+ def _ask_hook_installer(self) -> str:
177
+ """Choose ``pre-commit`` or ``prek`` when installing Git hooks.
178
+
179
+ Detection already accepts either tool, but install used to
180
+ hard-code ``pre-commit``. Use the only available installer, or
181
+ ask when both are on PATH.
182
+ """
183
+ installers = project_info.available_hook_installers()
184
+ if not installers:
185
+ raise InitFailedError(
186
+ "Failed to install pre-commit hook.\n"
187
+ "Neither pre-commit nor prek is installed in the current environment."
188
+ )
189
+ if len(installers) == 1:
190
+ return installers[0]
191
+
192
+ installer: str = questionary.select(
193
+ "Which hook installer do you want to use?",
194
+ choices=installers,
195
+ style=self.cz.style,
196
+ ).unsafe_ask()
197
+ return installer
198
+
167
199
  def _ask_config_path(self) -> Path:
168
200
  filename: str = questionary.select(
169
201
  "Please choose a supported config file: ",
@@ -4,9 +4,22 @@ import shutil
4
4
  from pathlib import Path
5
5
  from typing import Literal
6
6
 
7
+ _HOOK_INSTALLERS = ("pre-commit", "prek")
8
+
9
+
10
+ def available_hook_installers() -> list[str]:
11
+ """Return hook installer CLIs found on PATH.
12
+
13
+ ``pre-commit`` and ``prek`` are interchangeable. ``pre-commit`` is
14
+ listed first when both are present so existing setups keep a stable
15
+ default unless the user is asked to choose.
16
+ """
17
+ return [tool for tool in _HOOK_INSTALLERS if shutil.which(tool)]
18
+
7
19
 
8
20
  def is_pre_commit_installed() -> bool:
9
- return any(shutil.which(tool) for tool in ("pre-commit", "prek"))
21
+ """Return whether any supported hook installer is on PATH."""
22
+ return bool(available_hook_installers())
10
23
 
11
24
 
12
25
  def get_default_version_provider() -> Literal[
@@ -303,11 +303,6 @@ After installation, you can verify the completion is working by:
303
303
 
304
304
  For more detailed information about argcomplete configuration and troubleshooting, visit the [argcomplete documentation](https://kislyuk.github.io/argcomplete/).
305
305
 
306
- ## Star History
307
-
308
- [![Star History Chart](https://api.star-history.com/svg?repos=commitizen-tools/commitizen)](https://star-history.com/#commitizen-tools/commitizen)
309
-
310
-
311
306
  ## Sponsors
312
307
 
313
308
  These are our cool sponsors!
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "commitizen"
3
- version = "4.17.0"
3
+ version = "4.17.1"
4
4
  description = "Python commitizen client tool"
5
5
  license = "MIT"
6
6
  license-files = ["LICENSE"]
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "commitizen"
3
- version = "4.17.0"
3
+ version = "4.17.1"
4
4
  description = "Python commitizen client tool"
5
5
  authors = [{ name = "Santiago Fraire", email = "santiwilly@gmail.com" }]
6
6
  maintainers = [
@@ -1 +0,0 @@
1
- __version__ = "4.17.0"
File without changes