commitizen 3.29.1__tar.gz → 3.30.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 (68) hide show
  1. {commitizen-3.29.1 → commitizen-3.30.1}/PKG-INFO +14 -4
  2. commitizen-3.30.1/commitizen/__version__.py +1 -0
  3. {commitizen-3.29.1 → commitizen-3.30.1}/commitizen/cli.py +7 -1
  4. {commitizen-3.29.1 → commitizen-3.30.1}/commitizen/commands/check.py +4 -2
  5. {commitizen-3.29.1 → commitizen-3.30.1}/commitizen/commands/commit.py +24 -0
  6. {commitizen-3.29.1 → commitizen-3.30.1}/commitizen/cz/base.py +5 -5
  7. {commitizen-3.29.1 → commitizen-3.30.1}/commitizen/cz/customize/customize.py +16 -11
  8. {commitizen-3.29.1 → commitizen-3.30.1}/commitizen/defaults.py +1 -1
  9. {commitizen-3.29.1 → commitizen-3.30.1}/commitizen/exceptions.py +1 -1
  10. {commitizen-3.29.1 → commitizen-3.30.1}/commitizen/git.py +7 -0
  11. {commitizen-3.29.1 → commitizen-3.30.1}/docs/README.md +12 -3
  12. {commitizen-3.29.1 → commitizen-3.30.1}/pyproject.toml +3 -3
  13. commitizen-3.29.1/commitizen/__version__.py +0 -1
  14. {commitizen-3.29.1 → commitizen-3.30.1}/LICENSE +0 -0
  15. {commitizen-3.29.1 → commitizen-3.30.1}/commitizen/__init__.py +0 -0
  16. {commitizen-3.29.1 → commitizen-3.30.1}/commitizen/__main__.py +0 -0
  17. {commitizen-3.29.1 → commitizen-3.30.1}/commitizen/bump.py +0 -0
  18. {commitizen-3.29.1 → commitizen-3.30.1}/commitizen/changelog.py +0 -0
  19. {commitizen-3.29.1 → commitizen-3.30.1}/commitizen/changelog_formats/__init__.py +0 -0
  20. {commitizen-3.29.1 → commitizen-3.30.1}/commitizen/changelog_formats/asciidoc.py +0 -0
  21. {commitizen-3.29.1 → commitizen-3.30.1}/commitizen/changelog_formats/base.py +0 -0
  22. {commitizen-3.29.1 → commitizen-3.30.1}/commitizen/changelog_formats/markdown.py +0 -0
  23. {commitizen-3.29.1 → commitizen-3.30.1}/commitizen/changelog_formats/restructuredtext.py +0 -0
  24. {commitizen-3.29.1 → commitizen-3.30.1}/commitizen/changelog_formats/textile.py +0 -0
  25. {commitizen-3.29.1 → commitizen-3.30.1}/commitizen/cmd.py +0 -0
  26. {commitizen-3.29.1 → commitizen-3.30.1}/commitizen/commands/__init__.py +0 -0
  27. {commitizen-3.29.1 → commitizen-3.30.1}/commitizen/commands/bump.py +0 -0
  28. {commitizen-3.29.1 → commitizen-3.30.1}/commitizen/commands/changelog.py +0 -0
  29. {commitizen-3.29.1 → commitizen-3.30.1}/commitizen/commands/example.py +0 -0
  30. {commitizen-3.29.1 → commitizen-3.30.1}/commitizen/commands/info.py +0 -0
  31. {commitizen-3.29.1 → commitizen-3.30.1}/commitizen/commands/init.py +0 -0
  32. {commitizen-3.29.1 → commitizen-3.30.1}/commitizen/commands/list_cz.py +0 -0
  33. {commitizen-3.29.1 → commitizen-3.30.1}/commitizen/commands/schema.py +0 -0
  34. {commitizen-3.29.1 → commitizen-3.30.1}/commitizen/commands/version.py +0 -0
  35. {commitizen-3.29.1 → commitizen-3.30.1}/commitizen/config/__init__.py +0 -0
  36. {commitizen-3.29.1 → commitizen-3.30.1}/commitizen/config/base_config.py +0 -0
  37. {commitizen-3.29.1 → commitizen-3.30.1}/commitizen/config/json_config.py +0 -0
  38. {commitizen-3.29.1 → commitizen-3.30.1}/commitizen/config/toml_config.py +0 -0
  39. {commitizen-3.29.1 → commitizen-3.30.1}/commitizen/config/yaml_config.py +0 -0
  40. {commitizen-3.29.1 → commitizen-3.30.1}/commitizen/cz/__init__.py +0 -0
  41. {commitizen-3.29.1 → commitizen-3.30.1}/commitizen/cz/conventional_commits/__init__.py +0 -0
  42. {commitizen-3.29.1 → commitizen-3.30.1}/commitizen/cz/conventional_commits/conventional_commits.py +0 -0
  43. {commitizen-3.29.1 → commitizen-3.30.1}/commitizen/cz/conventional_commits/conventional_commits_info.txt +0 -0
  44. {commitizen-3.29.1 → commitizen-3.30.1}/commitizen/cz/customize/__init__.py +0 -0
  45. {commitizen-3.29.1 → commitizen-3.30.1}/commitizen/cz/customize/customize_info.txt +0 -0
  46. {commitizen-3.29.1 → commitizen-3.30.1}/commitizen/cz/exceptions.py +0 -0
  47. {commitizen-3.29.1 → commitizen-3.30.1}/commitizen/cz/jira/__init__.py +0 -0
  48. {commitizen-3.29.1 → commitizen-3.30.1}/commitizen/cz/jira/jira.py +0 -0
  49. {commitizen-3.29.1 → commitizen-3.30.1}/commitizen/cz/jira/jira_info.txt +0 -0
  50. {commitizen-3.29.1 → commitizen-3.30.1}/commitizen/cz/utils.py +0 -0
  51. {commitizen-3.29.1 → commitizen-3.30.1}/commitizen/factory.py +0 -0
  52. {commitizen-3.29.1 → commitizen-3.30.1}/commitizen/hooks.py +0 -0
  53. {commitizen-3.29.1 → commitizen-3.30.1}/commitizen/out.py +0 -0
  54. {commitizen-3.29.1 → commitizen-3.30.1}/commitizen/providers/__init__.py +0 -0
  55. {commitizen-3.29.1 → commitizen-3.30.1}/commitizen/providers/base_provider.py +0 -0
  56. {commitizen-3.29.1 → commitizen-3.30.1}/commitizen/providers/cargo_provider.py +0 -0
  57. {commitizen-3.29.1 → commitizen-3.30.1}/commitizen/providers/commitizen_provider.py +0 -0
  58. {commitizen-3.29.1 → commitizen-3.30.1}/commitizen/providers/composer_provider.py +0 -0
  59. {commitizen-3.29.1 → commitizen-3.30.1}/commitizen/providers/npm_provider.py +0 -0
  60. {commitizen-3.29.1 → commitizen-3.30.1}/commitizen/providers/pep621_provider.py +0 -0
  61. {commitizen-3.29.1 → commitizen-3.30.1}/commitizen/providers/poetry_provider.py +0 -0
  62. {commitizen-3.29.1 → commitizen-3.30.1}/commitizen/providers/scm_provider.py +0 -0
  63. {commitizen-3.29.1 → commitizen-3.30.1}/commitizen/py.typed +0 -0
  64. {commitizen-3.29.1 → commitizen-3.30.1}/commitizen/templates/CHANGELOG.adoc.j2 +0 -0
  65. {commitizen-3.29.1 → commitizen-3.30.1}/commitizen/templates/CHANGELOG.md.j2 +0 -0
  66. {commitizen-3.29.1 → commitizen-3.30.1}/commitizen/templates/CHANGELOG.rst.j2 +0 -0
  67. {commitizen-3.29.1 → commitizen-3.30.1}/commitizen/templates/CHANGELOG.textile.j2 +0 -0
  68. {commitizen-3.29.1 → commitizen-3.30.1}/commitizen/version_schemes.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: commitizen
3
- Version: 3.29.1
3
+ Version: 3.30.1
4
4
  Summary: Python commitizen client tool
5
5
  Home-page: https://github.com/commitizen-tools/commitizen
6
6
  License: MIT
@@ -21,6 +21,7 @@ Classifier: Programming Language :: Python :: 3.9
21
21
  Classifier: Programming Language :: Python :: 3.10
22
22
  Classifier: Programming Language :: Python :: 3.11
23
23
  Classifier: Programming Language :: Python :: 3.12
24
+ Classifier: Programming Language :: Python :: 3.13
24
25
  Classifier: Programming Language :: Python :: Implementation :: CPython
25
26
  Requires-Dist: argcomplete (>=1.12.1,<3.6)
26
27
  Requires-Dist: charset-normalizer (>=2.1.0,<4)
@@ -41,6 +42,7 @@ Description-Content-Type: text/markdown
41
42
  [![PyPI Package latest release](https://img.shields.io/pypi/v/commitizen.svg?style=flat-square)](https://pypi.org/project/commitizen/)
42
43
  [![PyPI Package download count (per month)](https://img.shields.io/pypi/dm/commitizen?style=flat-square)](https://pypi.org/project/commitizen/)
43
44
  [![Supported versions](https://img.shields.io/pypi/pyversions/commitizen.svg?style=flat-square)](https://pypi.org/project/commitizen/)
45
+ [![Conda Version](https://img.shields.io/conda/vn/conda-forge/commitizen?style=flat-square)](https://anaconda.org/conda-forge/commitizen)
44
46
  [![homebrew](https://img.shields.io/homebrew/v/commitizen?color=teal&style=flat-square)](https://formulae.brew.sh/formula/commitizen)
45
47
  [![Codecov](https://img.shields.io/codecov/c/github/commitizen-tools/commitizen.svg?style=flat-square)](https://codecov.io/gh/commitizen-tools/commitizen)
46
48
  [![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?style=flat-square&logo=pre-commit&logoColor=white)](https://github.com/pre-commit/pre-commit)
@@ -100,19 +102,27 @@ pip install --user -U commitizen
100
102
 
101
103
  ### Python project
102
104
 
103
- You can add it to your local project using one of these:
105
+ You can add it to your local project using one of the following.
106
+
107
+ With `pip`:
104
108
 
105
109
  ```bash
106
110
  pip install -U commitizen
107
111
  ```
108
112
 
109
- for Poetry >= 1.2.0:
113
+ With `conda`:
114
+
115
+ ```bash
116
+ conda install -c conda-forge commitizen
117
+ ```
118
+
119
+ With Poetry >= 1.2.0:
110
120
 
111
121
  ```bash
112
122
  poetry add commitizen --group dev
113
123
  ```
114
124
 
115
- for Poetry < 1.2.0:
125
+ With Poetry < 1.2.0:
116
126
 
117
127
  ```bash
118
128
  poetry add commitizen --dev
@@ -0,0 +1 @@
1
+ __version__ = "3.30.1"
@@ -156,6 +156,12 @@ data = {
156
156
  "action": "store_true",
157
157
  "help": "Tell the command to automatically stage files that have been modified and deleted, but new files you have not told Git about are not affected.",
158
158
  },
159
+ {
160
+ "name": ["-e", "--edit"],
161
+ "action": "store_true",
162
+ "default": False,
163
+ "help": "edit the commit message before committing",
164
+ },
159
165
  {
160
166
  "name": ["-l", "--message-length-limit"],
161
167
  "type": int,
@@ -541,7 +547,7 @@ def commitizen_excepthook(
541
547
  original_excepthook(type, value, traceback)
542
548
  exit_code = value.exit_code
543
549
  if exit_code in no_raise:
544
- exit_code = 0
550
+ exit_code = ExitCode.EXPECTED_EXIT
545
551
  sys.exit(exit_code)
546
552
  else:
547
553
  original_excepthook(type, value, traceback)
@@ -54,7 +54,7 @@ class Check:
54
54
  for arg in (self.commit_msg_file, self.commit_msg, self.rev_range)
55
55
  )
56
56
  if num_exclusive_args_provided == 0 and not sys.stdin.isatty():
57
- self.commit_msg: str | None = sys.stdin.read()
57
+ self.commit_msg = sys.stdin.read()
58
58
  elif num_exclusive_args_provided != 1:
59
59
  raise InvalidCommandArgumentError(
60
60
  "Only one of --rev-range, --message, and --commit-msg-file is permitted by check command! "
@@ -107,7 +107,9 @@ class Check:
107
107
  return [git.GitCommit(rev="", title="", body=msg)]
108
108
 
109
109
  # Get commit messages from git log (--rev-range)
110
- return git.get_commits(end=self.rev_range)
110
+ if self.rev_range:
111
+ return git.get_commits(end=self.rev_range)
112
+ return git.get_commits()
111
113
 
112
114
  @staticmethod
113
115
  def _filter_comments(msg: str) -> str:
@@ -2,6 +2,9 @@ from __future__ import annotations
2
2
 
3
3
  import contextlib
4
4
  import os
5
+ import shutil
6
+ import subprocess
7
+ import tempfile
5
8
 
6
9
  import questionary
7
10
 
@@ -72,9 +75,27 @@ class Commit:
72
75
 
73
76
  return message
74
77
 
78
+ def manual_edit(self, message: str) -> str:
79
+ editor = git.get_core_editor()
80
+ if editor is None:
81
+ raise RuntimeError("No 'editor' value given and no default available.")
82
+ exec_path = shutil.which(editor)
83
+ if exec_path is None:
84
+ raise RuntimeError(f"Editor '{editor}' not found.")
85
+ with tempfile.NamedTemporaryFile(mode="w", delete=False) as file:
86
+ file.write(message)
87
+ file_path = file.name
88
+ argv = [exec_path, file_path]
89
+ subprocess.call(argv)
90
+ with open(file_path) as temp_file:
91
+ message = temp_file.read().strip()
92
+ file.unlink()
93
+ return message
94
+
75
95
  def __call__(self):
76
96
  dry_run: bool = self.arguments.get("dry_run")
77
97
  write_message_to_file: bool = self.arguments.get("write_message_to_file")
98
+ manual_edit: bool = self.arguments.get("edit")
78
99
 
79
100
  is_all: bool = self.arguments.get("all")
80
101
  if is_all:
@@ -101,6 +122,9 @@ class Commit:
101
122
  else:
102
123
  m = self.prompt_commit_questions()
103
124
 
125
+ if manual_edit:
126
+ m = self.manual_edit(m)
127
+
104
128
  out.info(f"\n{m}\n")
105
129
 
106
130
  if write_message_to_file:
@@ -61,7 +61,7 @@ class BaseCommitizen(metaclass=ABCMeta):
61
61
  template_loader: BaseLoader = PackageLoader("commitizen", "templates")
62
62
  template_extras: dict[str, Any] = {}
63
63
 
64
- def __init__(self, config: BaseConfig):
64
+ def __init__(self, config: BaseConfig) -> None:
65
65
  self.config = config
66
66
  if not self.config.settings.get("style"):
67
67
  self.config.settings.update({"style": BaseCommitizen.default_style_config})
@@ -83,19 +83,19 @@ class BaseCommitizen(metaclass=ABCMeta):
83
83
  ]
84
84
  )
85
85
 
86
- def example(self) -> str | None:
86
+ def example(self) -> str:
87
87
  """Example of the commit message."""
88
88
  raise NotImplementedError("Not Implemented yet")
89
89
 
90
- def schema(self) -> str | None:
90
+ def schema(self) -> str:
91
91
  """Schema definition of the commit message."""
92
92
  raise NotImplementedError("Not Implemented yet")
93
93
 
94
- def schema_pattern(self) -> str | None:
94
+ def schema_pattern(self) -> str:
95
95
  """Regex matching the schema used for message validation."""
96
96
  raise NotImplementedError("Not Implemented yet")
97
97
 
98
- def info(self) -> str | None:
98
+ def info(self) -> str:
99
99
  """Information about the standardized commit message."""
100
100
  raise NotImplementedError("Not Implemented yet")
101
101
 
@@ -1,9 +1,14 @@
1
1
  from __future__ import annotations
2
2
 
3
- try:
3
+ from typing import TYPE_CHECKING
4
+
5
+ if TYPE_CHECKING:
4
6
  from jinja2 import Template
5
- except ImportError:
6
- from string import Template # type: ignore
7
+ else:
8
+ try:
9
+ from jinja2 import Template
10
+ except ImportError:
11
+ from string import Template
7
12
 
8
13
 
9
14
  from commitizen import defaults
@@ -68,16 +73,16 @@ class CustomizeCommitsCz(BaseCommitizen):
68
73
  else:
69
74
  return message_template.render(**answers)
70
75
 
71
- def example(self) -> str | None:
72
- return self.custom_settings.get("example")
76
+ def example(self) -> str:
77
+ return self.custom_settings.get("example") or ""
73
78
 
74
- def schema_pattern(self) -> str | None:
75
- return self.custom_settings.get("schema_pattern")
79
+ def schema_pattern(self) -> str:
80
+ return self.custom_settings.get("schema_pattern") or ""
76
81
 
77
- def schema(self) -> str | None:
78
- return self.custom_settings.get("schema")
82
+ def schema(self) -> str:
83
+ return self.custom_settings.get("schema") or ""
79
84
 
80
- def info(self) -> str | None:
85
+ def info(self) -> str:
81
86
  info_path = self.custom_settings.get("info_path")
82
87
  info = self.custom_settings.get("info")
83
88
  if info_path:
@@ -86,4 +91,4 @@ class CustomizeCommitsCz(BaseCommitizen):
86
91
  return content
87
92
  elif info:
88
93
  return info
89
- return None
94
+ return ""
@@ -45,7 +45,7 @@ class Settings(TypedDict, total=False):
45
45
  changelog_merge_prerelease: bool
46
46
  update_changelog_on_bump: bool
47
47
  use_shortcuts: bool
48
- style: list[tuple[str, str]] | None
48
+ style: list[tuple[str, str]]
49
49
  customize: CzSettings
50
50
  major_version_zero: bool
51
51
  pre_bump_hooks: list[str] | None
@@ -42,7 +42,7 @@ class ExitCode(enum.IntEnum):
42
42
  class CommitizenException(Exception):
43
43
  def __init__(self, *args, **kwargs):
44
44
  self.output_method = kwargs.get("output_method") or out.error
45
- self.exit_code = self.__class__.exit_code
45
+ self.exit_code: ExitCode = self.__class__.exit_code
46
46
  if args:
47
47
  self.message = args[0]
48
48
  elif hasattr(self.__class__, "message"):
@@ -271,6 +271,13 @@ def get_eol_style() -> EOLTypes:
271
271
  return map["native"]
272
272
 
273
273
 
274
+ def get_core_editor() -> str | None:
275
+ c = cmd.run("git var GIT_EDITOR")
276
+ if c.out:
277
+ return c.out.strip()
278
+ return None
279
+
280
+
274
281
  def smart_open(*args, **kargs):
275
282
  """Open a file with the EOL style determined from Git."""
276
283
  return open(*args, newline=get_eol_style().get_eol_for_open(), **kargs)
@@ -3,6 +3,7 @@
3
3
  [![PyPI Package latest release](https://img.shields.io/pypi/v/commitizen.svg?style=flat-square)](https://pypi.org/project/commitizen/)
4
4
  [![PyPI Package download count (per month)](https://img.shields.io/pypi/dm/commitizen?style=flat-square)](https://pypi.org/project/commitizen/)
5
5
  [![Supported versions](https://img.shields.io/pypi/pyversions/commitizen.svg?style=flat-square)](https://pypi.org/project/commitizen/)
6
+ [![Conda Version](https://img.shields.io/conda/vn/conda-forge/commitizen?style=flat-square)](https://anaconda.org/conda-forge/commitizen)
6
7
  [![homebrew](https://img.shields.io/homebrew/v/commitizen?color=teal&style=flat-square)](https://formulae.brew.sh/formula/commitizen)
7
8
  [![Codecov](https://img.shields.io/codecov/c/github/commitizen-tools/commitizen.svg?style=flat-square)](https://codecov.io/gh/commitizen-tools/commitizen)
8
9
  [![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?style=flat-square&logo=pre-commit&logoColor=white)](https://github.com/pre-commit/pre-commit)
@@ -62,19 +63,27 @@ pip install --user -U commitizen
62
63
 
63
64
  ### Python project
64
65
 
65
- You can add it to your local project using one of these:
66
+ You can add it to your local project using one of the following.
67
+
68
+ With `pip`:
66
69
 
67
70
  ```bash
68
71
  pip install -U commitizen
69
72
  ```
70
73
 
71
- for Poetry >= 1.2.0:
74
+ With `conda`:
75
+
76
+ ```bash
77
+ conda install -c conda-forge commitizen
78
+ ```
79
+
80
+ With Poetry >= 1.2.0:
72
81
 
73
82
  ```bash
74
83
  poetry add commitizen --group dev
75
84
  ```
76
85
 
77
- for Poetry < 1.2.0:
86
+ With Poetry < 1.2.0:
78
87
 
79
88
  ```bash
80
89
  poetry add commitizen --dev
@@ -1,5 +1,5 @@
1
1
  [tool.commitizen]
2
- version = "3.29.1"
2
+ version = "3.30.1"
3
3
  tag_format = "v$version"
4
4
  version_files = [
5
5
  "pyproject.toml:version",
@@ -9,7 +9,7 @@ version_files = [
9
9
 
10
10
  [tool.poetry]
11
11
  name = "commitizen"
12
- version = "3.29.1"
12
+ version = "3.30.1"
13
13
  description = "Python commitizen client tool"
14
14
  authors = ["Santiago Fraire <santiwilly@gmail.com>"]
15
15
  license = "MIT"
@@ -64,7 +64,7 @@ pytest-regressions = "^2.4.0"
64
64
  pytest-freezer = "^0.4.6"
65
65
  pytest-xdist = "^3.1.0"
66
66
  # linter
67
- ruff = ">=0.5.0,<0.7.0"
67
+ ruff = ">=0.5.0,<0.8.0"
68
68
  pre-commit = ">=2.18,<4.0"
69
69
  mypy = "^1.4"
70
70
  types-PyYAML = ">=5.4.3,<7.0.0"
@@ -1 +0,0 @@
1
- __version__ = "3.29.1"
File without changes