commitizen 4.6.3__tar.gz → 4.7.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 (71) hide show
  1. {commitizen-4.6.3 → commitizen-4.7.1}/PKG-INFO +1 -1
  2. commitizen-4.7.1/commitizen/__version__.py +1 -0
  3. {commitizen-4.6.3 → commitizen-4.7.1}/commitizen/commands/bump.py +1 -1
  4. {commitizen-4.6.3 → commitizen-4.7.1}/commitizen/commands/changelog.py +1 -1
  5. {commitizen-4.6.3 → commitizen-4.7.1}/commitizen/commands/check.py +3 -3
  6. {commitizen-4.6.3 → commitizen-4.7.1}/commitizen/commands/commit.py +1 -1
  7. {commitizen-4.6.3 → commitizen-4.7.1}/commitizen/commands/example.py +1 -1
  8. {commitizen-4.6.3 → commitizen-4.7.1}/commitizen/commands/info.py +1 -1
  9. {commitizen-4.6.3 → commitizen-4.7.1}/commitizen/commands/init.py +1 -1
  10. {commitizen-4.6.3 → commitizen-4.7.1}/commitizen/commands/schema.py +1 -1
  11. {commitizen-4.6.3 → commitizen-4.7.1}/commitizen/factory.py +1 -1
  12. commitizen-4.7.1/commitizen/providers/cargo_provider.py +57 -0
  13. {commitizen-4.6.3 → commitizen-4.7.1}/commitizen/tags.py +7 -5
  14. {commitizen-4.6.3 → commitizen-4.7.1}/commitizen/version_schemes.py +5 -5
  15. {commitizen-4.6.3 → commitizen-4.7.1}/pyproject.toml +2 -2
  16. commitizen-4.6.3/commitizen/__version__.py +0 -1
  17. commitizen-4.6.3/commitizen/providers/cargo_provider.py +0 -30
  18. {commitizen-4.6.3 → commitizen-4.7.1}/LICENSE +0 -0
  19. {commitizen-4.6.3 → commitizen-4.7.1}/commitizen/__init__.py +0 -0
  20. {commitizen-4.6.3 → commitizen-4.7.1}/commitizen/__main__.py +0 -0
  21. {commitizen-4.6.3 → commitizen-4.7.1}/commitizen/bump.py +0 -0
  22. {commitizen-4.6.3 → commitizen-4.7.1}/commitizen/changelog.py +0 -0
  23. {commitizen-4.6.3 → commitizen-4.7.1}/commitizen/changelog_formats/__init__.py +0 -0
  24. {commitizen-4.6.3 → commitizen-4.7.1}/commitizen/changelog_formats/asciidoc.py +0 -0
  25. {commitizen-4.6.3 → commitizen-4.7.1}/commitizen/changelog_formats/base.py +0 -0
  26. {commitizen-4.6.3 → commitizen-4.7.1}/commitizen/changelog_formats/markdown.py +0 -0
  27. {commitizen-4.6.3 → commitizen-4.7.1}/commitizen/changelog_formats/restructuredtext.py +0 -0
  28. {commitizen-4.6.3 → commitizen-4.7.1}/commitizen/changelog_formats/textile.py +0 -0
  29. {commitizen-4.6.3 → commitizen-4.7.1}/commitizen/cli.py +0 -0
  30. {commitizen-4.6.3 → commitizen-4.7.1}/commitizen/cmd.py +0 -0
  31. {commitizen-4.6.3 → commitizen-4.7.1}/commitizen/commands/__init__.py +0 -0
  32. {commitizen-4.6.3 → commitizen-4.7.1}/commitizen/commands/list_cz.py +0 -0
  33. {commitizen-4.6.3 → commitizen-4.7.1}/commitizen/commands/version.py +0 -0
  34. {commitizen-4.6.3 → commitizen-4.7.1}/commitizen/config/__init__.py +0 -0
  35. {commitizen-4.6.3 → commitizen-4.7.1}/commitizen/config/base_config.py +0 -0
  36. {commitizen-4.6.3 → commitizen-4.7.1}/commitizen/config/json_config.py +0 -0
  37. {commitizen-4.6.3 → commitizen-4.7.1}/commitizen/config/toml_config.py +0 -0
  38. {commitizen-4.6.3 → commitizen-4.7.1}/commitizen/config/yaml_config.py +0 -0
  39. {commitizen-4.6.3 → commitizen-4.7.1}/commitizen/cz/__init__.py +0 -0
  40. {commitizen-4.6.3 → commitizen-4.7.1}/commitizen/cz/base.py +0 -0
  41. {commitizen-4.6.3 → commitizen-4.7.1}/commitizen/cz/conventional_commits/__init__.py +0 -0
  42. {commitizen-4.6.3 → commitizen-4.7.1}/commitizen/cz/conventional_commits/conventional_commits.py +0 -0
  43. {commitizen-4.6.3 → commitizen-4.7.1}/commitizen/cz/conventional_commits/conventional_commits_info.txt +0 -0
  44. {commitizen-4.6.3 → commitizen-4.7.1}/commitizen/cz/customize/__init__.py +0 -0
  45. {commitizen-4.6.3 → commitizen-4.7.1}/commitizen/cz/customize/customize.py +0 -0
  46. {commitizen-4.6.3 → commitizen-4.7.1}/commitizen/cz/customize/customize_info.txt +0 -0
  47. {commitizen-4.6.3 → commitizen-4.7.1}/commitizen/cz/exceptions.py +0 -0
  48. {commitizen-4.6.3 → commitizen-4.7.1}/commitizen/cz/jira/__init__.py +0 -0
  49. {commitizen-4.6.3 → commitizen-4.7.1}/commitizen/cz/jira/jira.py +0 -0
  50. {commitizen-4.6.3 → commitizen-4.7.1}/commitizen/cz/jira/jira_info.txt +0 -0
  51. {commitizen-4.6.3 → commitizen-4.7.1}/commitizen/cz/utils.py +0 -0
  52. {commitizen-4.6.3 → commitizen-4.7.1}/commitizen/defaults.py +0 -0
  53. {commitizen-4.6.3 → commitizen-4.7.1}/commitizen/exceptions.py +0 -0
  54. {commitizen-4.6.3 → commitizen-4.7.1}/commitizen/git.py +0 -0
  55. {commitizen-4.6.3 → commitizen-4.7.1}/commitizen/hooks.py +0 -0
  56. {commitizen-4.6.3 → commitizen-4.7.1}/commitizen/out.py +0 -0
  57. {commitizen-4.6.3 → commitizen-4.7.1}/commitizen/providers/__init__.py +0 -0
  58. {commitizen-4.6.3 → commitizen-4.7.1}/commitizen/providers/base_provider.py +0 -0
  59. {commitizen-4.6.3 → commitizen-4.7.1}/commitizen/providers/commitizen_provider.py +0 -0
  60. {commitizen-4.6.3 → commitizen-4.7.1}/commitizen/providers/composer_provider.py +0 -0
  61. {commitizen-4.6.3 → commitizen-4.7.1}/commitizen/providers/npm_provider.py +0 -0
  62. {commitizen-4.6.3 → commitizen-4.7.1}/commitizen/providers/pep621_provider.py +0 -0
  63. {commitizen-4.6.3 → commitizen-4.7.1}/commitizen/providers/poetry_provider.py +0 -0
  64. {commitizen-4.6.3 → commitizen-4.7.1}/commitizen/providers/scm_provider.py +0 -0
  65. {commitizen-4.6.3 → commitizen-4.7.1}/commitizen/providers/uv_provider.py +0 -0
  66. {commitizen-4.6.3 → commitizen-4.7.1}/commitizen/py.typed +0 -0
  67. {commitizen-4.6.3 → commitizen-4.7.1}/commitizen/templates/CHANGELOG.adoc.j2 +0 -0
  68. {commitizen-4.6.3 → commitizen-4.7.1}/commitizen/templates/CHANGELOG.md.j2 +0 -0
  69. {commitizen-4.6.3 → commitizen-4.7.1}/commitizen/templates/CHANGELOG.rst.j2 +0 -0
  70. {commitizen-4.6.3 → commitizen-4.7.1}/commitizen/templates/CHANGELOG.textile.j2 +0 -0
  71. {commitizen-4.6.3 → commitizen-4.7.1}/docs/README.md +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: commitizen
3
- Version: 4.6.3
3
+ Version: 4.7.1
4
4
  Summary: Python commitizen client tool
5
5
  License: MIT License
6
6
 
@@ -0,0 +1 @@
1
+ __version__ = "4.7.1"
@@ -68,7 +68,7 @@ class Bump:
68
68
  if arguments[key] is not None
69
69
  },
70
70
  }
71
- self.cz = factory.commiter_factory(self.config)
71
+ self.cz = factory.committer_factory(self.config)
72
72
  self.changelog_flag = arguments["changelog"]
73
73
  self.changelog_config = self.config.settings.get("update_changelog_on_bump")
74
74
  self.changelog_to_stdout = arguments["changelog_to_stdout"]
@@ -49,7 +49,7 @@ class Changelog:
49
49
  )
50
50
 
51
51
  self.encoding = self.config.settings["encoding"]
52
- self.cz = factory.commiter_factory(self.config)
52
+ self.cz = factory.committer_factory(self.config)
53
53
 
54
54
  self.start_rev = args.get("start_rev") or self.config.settings.get(
55
55
  "changelog_start_rev"
@@ -46,7 +46,7 @@ class Check:
46
46
 
47
47
  self.config: BaseConfig = config
48
48
  self.encoding = config.settings["encoding"]
49
- self.cz = factory.commiter_factory(self.config)
49
+ self.cz = factory.committer_factory(self.config)
50
50
 
51
51
  def _valid_command_argument(self):
52
52
  num_exclusive_args_provided = sum(
@@ -72,7 +72,7 @@ class Check:
72
72
  raise NoCommitsFoundError(f"No commit found with range: '{self.rev_range}'")
73
73
 
74
74
  pattern = self.cz.schema_pattern()
75
- ill_formated_commits = [
75
+ ill_formatted_commits = [
76
76
  commit
77
77
  for commit in commits
78
78
  if not self.validate_commit_message(commit.message, pattern)
@@ -80,7 +80,7 @@ class Check:
80
80
  displayed_msgs_content = "\n".join(
81
81
  [
82
82
  f'commit "{commit.rev}": "{commit.message}"'
83
- for commit in ill_formated_commits
83
+ for commit in ill_formatted_commits
84
84
  ]
85
85
  )
86
86
  if displayed_msgs_content:
@@ -35,7 +35,7 @@ class Commit:
35
35
 
36
36
  self.config: BaseConfig = config
37
37
  self.encoding = config.settings["encoding"]
38
- self.cz = factory.commiter_factory(self.config)
38
+ self.cz = factory.committer_factory(self.config)
39
39
  self.arguments = arguments
40
40
  self.temp_file: str = get_backup_file_path()
41
41
 
@@ -7,7 +7,7 @@ class Example:
7
7
 
8
8
  def __init__(self, config: BaseConfig, *args):
9
9
  self.config: BaseConfig = config
10
- self.cz = factory.commiter_factory(self.config)
10
+ self.cz = factory.committer_factory(self.config)
11
11
 
12
12
  def __call__(self):
13
13
  out.write(self.cz.example())
@@ -7,7 +7,7 @@ class Info:
7
7
 
8
8
  def __init__(self, config: BaseConfig, *args):
9
9
  self.config: BaseConfig = config
10
- self.cz = factory.commiter_factory(self.config)
10
+ self.cz = factory.committer_factory(self.config)
11
11
 
12
12
  def __call__(self):
13
13
  out.write(self.cz.info())
@@ -82,7 +82,7 @@ class Init:
82
82
  def __init__(self, config: BaseConfig, *args):
83
83
  self.config: BaseConfig = config
84
84
  self.encoding = config.settings["encoding"]
85
- self.cz = factory.commiter_factory(self.config)
85
+ self.cz = factory.committer_factory(self.config)
86
86
  self.project_info = ProjectInfo()
87
87
 
88
88
  def __call__(self):
@@ -7,7 +7,7 @@ class Schema:
7
7
 
8
8
  def __init__(self, config: BaseConfig, *args):
9
9
  self.config: BaseConfig = config
10
- self.cz = factory.commiter_factory(self.config)
10
+ self.cz = factory.committer_factory(self.config)
11
11
 
12
12
  def __call__(self):
13
13
  out.write(self.cz.schema())
@@ -4,7 +4,7 @@ from commitizen.cz import registry
4
4
  from commitizen.exceptions import NoCommitizenFoundException
5
5
 
6
6
 
7
- def commiter_factory(config: BaseConfig) -> BaseCommitizen:
7
+ def committer_factory(config: BaseConfig) -> BaseCommitizen:
8
8
  """Return the correct commitizen existing in the registry."""
9
9
  name: str = config.settings["name"]
10
10
  try:
@@ -0,0 +1,57 @@
1
+ from __future__ import annotations
2
+
3
+ from pathlib import Path
4
+
5
+ import tomlkit
6
+
7
+ from commitizen.providers.base_provider import TomlProvider
8
+
9
+
10
+ class CargoProvider(TomlProvider):
11
+ """
12
+ Cargo version management
13
+
14
+ With support for `workspaces`
15
+ """
16
+
17
+ filename = "Cargo.toml"
18
+ lock_filename = "Cargo.lock"
19
+
20
+ @property
21
+ def lock_file(self) -> Path:
22
+ return Path() / self.lock_filename
23
+
24
+ def get(self, document: tomlkit.TOMLDocument) -> str:
25
+ try:
26
+ return document["package"]["version"] # type: ignore
27
+ except tomlkit.exceptions.NonExistentKey:
28
+ ...
29
+ return document["workspace"]["package"]["version"] # type: ignore
30
+
31
+ def set(self, document: tomlkit.TOMLDocument, version: str):
32
+ try:
33
+ document["workspace"]["package"]["version"] = version # type: ignore
34
+ return
35
+ except tomlkit.exceptions.NonExistentKey:
36
+ ...
37
+ document["package"]["version"] = version # type: ignore
38
+
39
+ def set_version(self, version: str) -> None:
40
+ super().set_version(version)
41
+ if self.lock_file.exists():
42
+ self.set_lock_version(version)
43
+
44
+ def set_lock_version(self, version: str) -> None:
45
+ cargo_toml_content = tomlkit.parse(self.file.read_text())
46
+ try:
47
+ package_name = cargo_toml_content["package"]["name"] # type: ignore
48
+ except tomlkit.exceptions.NonExistentKey:
49
+ package_name = cargo_toml_content["workspace"]["package"]["name"] # type: ignore
50
+
51
+ cargo_lock_content = tomlkit.parse(self.lock_file.read_text())
52
+ packages: tomlkit.items.AoT = cargo_lock_content["package"] # type: ignore[assignment]
53
+ for i, package in enumerate(packages):
54
+ if package["name"] == package_name:
55
+ cargo_lock_content["package"][i]["version"] = version # type: ignore[index]
56
+ break
57
+ self.lock_file.write_text(tomlkit.dumps(cargo_lock_content))
@@ -113,6 +113,10 @@ class TagRules:
113
113
  format_regex = format_regex.replace(pattern, regex)
114
114
  return format_regex
115
115
 
116
+ def _version_tag_error(self, tag: str) -> str:
117
+ """Format the error message for an invalid version tag"""
118
+ return f"Invalid version tag: '{tag}' does not match any configured tag format"
119
+
116
120
  def is_version_tag(self, tag: str | GitTag, warn: bool = False) -> bool:
117
121
  """
118
122
  True if a given tag is a legit version tag.
@@ -120,9 +124,9 @@ class TagRules:
120
124
  if `warn` is `True`, it will print a warning message if the tag is not a version tag.
121
125
  """
122
126
  tag = tag.name if isinstance(tag, GitTag) else tag
123
- is_legit = any(regex.match(tag) for regex in self.version_regexes)
127
+ is_legit = any(regex.fullmatch(tag) for regex in self.version_regexes)
124
128
  if warn and not is_legit and not self.is_ignored_tag(tag):
125
- out.warn(f"InvalidVersion {tag} doesn't match any configured tag format")
129
+ out.warn(self._version_tag_error(tag))
126
130
  return is_legit
127
131
 
128
132
  def is_ignored_tag(self, tag: str | GitTag) -> bool:
@@ -146,9 +150,7 @@ class TagRules:
146
150
  m for regex in self.version_regexes if (m := regex.fullmatch(tag.name))
147
151
  )
148
152
  if not (m := next(candidates, None)):
149
- raise InvalidVersion(
150
- f"Invalid version tag: '{tag.name}' does not match any configured tag format"
151
- )
153
+ raise InvalidVersion(self._version_tag_error(tag.name))
152
154
  if "version" in m.groupdict():
153
155
  return self.scheme(m.group("version"))
154
156
 
@@ -19,7 +19,7 @@ if sys.version_info >= (3, 10):
19
19
  else:
20
20
  import importlib_metadata as metadata
21
21
 
22
- from packaging.version import InvalidVersion # noqa: F401: Rexpose the common exception
22
+ from packaging.version import InvalidVersion # noqa: F401: expose the common exception
23
23
  from packaging.version import Version as _BaseVersion
24
24
 
25
25
  from commitizen.defaults import MAJOR, MINOR, PATCH, Settings
@@ -78,7 +78,7 @@ class VersionProtocol(Protocol):
78
78
 
79
79
  @property
80
80
  def prerelease(self) -> str | None:
81
- """The prelease potion of the version is this is a prerelease."""
81
+ """The prerelease potion of the version is this is a prerelease."""
82
82
  raise NotImplementedError("must be implemented")
83
83
 
84
84
  @property
@@ -142,7 +142,7 @@ class VersionProtocol(Protocol):
142
142
  prerelease: The type of prerelease, if Any
143
143
  is_local_version: Whether to increment the local version instead
144
144
  exact_increment: Treat the increment and prerelease arguments explicitly. Disables logic
145
- that attempts to deduce the correct increment when a prelease suffix is present.
145
+ that attempts to deduce the correct increment when a prerelease suffix is present.
146
146
  """
147
147
 
148
148
 
@@ -351,7 +351,7 @@ class SemVer2(SemVer):
351
351
  See: https://semver.org/spec/v2.0.0.html
352
352
  """
353
353
 
354
- _STD_PRELEASES = {
354
+ _STD_PRERELEASES = {
355
355
  "a": "alpha",
356
356
  "b": "beta",
357
357
  }
@@ -359,7 +359,7 @@ class SemVer2(SemVer):
359
359
  @property
360
360
  def prerelease(self) -> str | None:
361
361
  if self.is_prerelease and self.pre:
362
- prerelease_type = self._STD_PRELEASES.get(self.pre[0], self.pre[0])
362
+ prerelease_type = self._STD_PRERELEASES.get(self.pre[0], self.pre[0])
363
363
  return f"{prerelease_type}.{self.pre[1]}"
364
364
  return None
365
365
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "commitizen"
3
- version = "4.6.3"
3
+ version = "4.7.1"
4
4
  description = "Python commitizen client tool"
5
5
  authors = [{ name = "Santiago Fraire", email = "santiwilly@gmail.com" }]
6
6
  maintainers = [
@@ -88,7 +88,7 @@ build-backend = "poetry.core.masonry.api"
88
88
 
89
89
 
90
90
  [tool.commitizen]
91
- version = "4.6.3"
91
+ version = "4.7.1"
92
92
  tag_format = "v$version"
93
93
  version_files = [
94
94
  "pyproject.toml:version",
@@ -1 +0,0 @@
1
- __version__ = "4.6.3"
@@ -1,30 +0,0 @@
1
- from __future__ import annotations
2
-
3
- import tomlkit
4
-
5
- from commitizen.providers.base_provider import TomlProvider
6
-
7
-
8
- class CargoProvider(TomlProvider):
9
- """
10
- Cargo version management
11
-
12
- With support for `workspaces`
13
- """
14
-
15
- filename = "Cargo.toml"
16
-
17
- def get(self, document: tomlkit.TOMLDocument) -> str:
18
- try:
19
- return document["package"]["version"] # type: ignore
20
- except tomlkit.exceptions.NonExistentKey:
21
- ...
22
- return document["workspace"]["package"]["version"] # type: ignore
23
-
24
- def set(self, document: tomlkit.TOMLDocument, version: str):
25
- try:
26
- document["workspace"]["package"]["version"] = version # type: ignore
27
- return
28
- except tomlkit.exceptions.NonExistentKey:
29
- ...
30
- document["package"]["version"] = version # type: ignore
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes