python-semantic-release 8.4.0__tar.gz → 8.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 (58) hide show
  1. {python-semantic-release-8.4.0/python_semantic_release.egg-info → python-semantic-release-8.5.1}/PKG-INFO +1 -1
  2. {python-semantic-release-8.4.0 → python-semantic-release-8.5.1}/pyproject.toml +1 -1
  3. {python-semantic-release-8.4.0 → python-semantic-release-8.5.1/python_semantic_release.egg-info}/PKG-INFO +1 -1
  4. {python-semantic-release-8.4.0 → python-semantic-release-8.5.1}/semantic_release/__init__.py +1 -1
  5. {python-semantic-release-8.4.0 → python-semantic-release-8.5.1}/semantic_release/changelog/template.py +14 -8
  6. {python-semantic-release-8.4.0 → python-semantic-release-8.5.1}/semantic_release/cli/commands/version.py +25 -10
  7. {python-semantic-release-8.4.0 → python-semantic-release-8.5.1}/semantic_release/cli/config.py +11 -1
  8. {python-semantic-release-8.4.0 → python-semantic-release-8.5.1}/AUTHORS.rst +0 -0
  9. {python-semantic-release-8.4.0 → python-semantic-release-8.5.1}/LICENSE +0 -0
  10. {python-semantic-release-8.4.0 → python-semantic-release-8.5.1}/MANIFEST.in +0 -0
  11. {python-semantic-release-8.4.0 → python-semantic-release-8.5.1}/README.rst +0 -0
  12. {python-semantic-release-8.4.0 → python-semantic-release-8.5.1}/python_semantic_release.egg-info/SOURCES.txt +0 -0
  13. {python-semantic-release-8.4.0 → python-semantic-release-8.5.1}/python_semantic_release.egg-info/dependency_links.txt +0 -0
  14. {python-semantic-release-8.4.0 → python-semantic-release-8.5.1}/python_semantic_release.egg-info/entry_points.txt +0 -0
  15. {python-semantic-release-8.4.0 → python-semantic-release-8.5.1}/python_semantic_release.egg-info/requires.txt +0 -0
  16. {python-semantic-release-8.4.0 → python-semantic-release-8.5.1}/python_semantic_release.egg-info/top_level.txt +0 -0
  17. {python-semantic-release-8.4.0 → python-semantic-release-8.5.1}/semantic_release/__main__.py +0 -0
  18. {python-semantic-release-8.4.0 → python-semantic-release-8.5.1}/semantic_release/changelog/__init__.py +0 -0
  19. {python-semantic-release-8.4.0 → python-semantic-release-8.5.1}/semantic_release/changelog/context.py +0 -0
  20. {python-semantic-release-8.4.0 → python-semantic-release-8.5.1}/semantic_release/changelog/release_history.py +0 -0
  21. {python-semantic-release-8.4.0 → python-semantic-release-8.5.1}/semantic_release/cli/__init__.py +0 -0
  22. {python-semantic-release-8.4.0 → python-semantic-release-8.5.1}/semantic_release/cli/commands/__init__.py +0 -0
  23. {python-semantic-release-8.4.0 → python-semantic-release-8.5.1}/semantic_release/cli/commands/changelog.py +0 -0
  24. {python-semantic-release-8.4.0 → python-semantic-release-8.5.1}/semantic_release/cli/commands/generate_config.py +0 -0
  25. {python-semantic-release-8.4.0 → python-semantic-release-8.5.1}/semantic_release/cli/commands/main.py +0 -0
  26. {python-semantic-release-8.4.0 → python-semantic-release-8.5.1}/semantic_release/cli/commands/publish.py +0 -0
  27. {python-semantic-release-8.4.0 → python-semantic-release-8.5.1}/semantic_release/cli/common.py +0 -0
  28. {python-semantic-release-8.4.0 → python-semantic-release-8.5.1}/semantic_release/cli/const.py +0 -0
  29. {python-semantic-release-8.4.0 → python-semantic-release-8.5.1}/semantic_release/cli/github_actions_output.py +0 -0
  30. {python-semantic-release-8.4.0 → python-semantic-release-8.5.1}/semantic_release/cli/masking_filter.py +0 -0
  31. {python-semantic-release-8.4.0 → python-semantic-release-8.5.1}/semantic_release/cli/util.py +0 -0
  32. {python-semantic-release-8.4.0 → python-semantic-release-8.5.1}/semantic_release/commit_parser/__init__.py +0 -0
  33. {python-semantic-release-8.4.0 → python-semantic-release-8.5.1}/semantic_release/commit_parser/_base.py +0 -0
  34. {python-semantic-release-8.4.0 → python-semantic-release-8.5.1}/semantic_release/commit_parser/angular.py +0 -0
  35. {python-semantic-release-8.4.0 → python-semantic-release-8.5.1}/semantic_release/commit_parser/emoji.py +0 -0
  36. {python-semantic-release-8.4.0 → python-semantic-release-8.5.1}/semantic_release/commit_parser/scipy.py +0 -0
  37. {python-semantic-release-8.4.0 → python-semantic-release-8.5.1}/semantic_release/commit_parser/tag.py +0 -0
  38. {python-semantic-release-8.4.0 → python-semantic-release-8.5.1}/semantic_release/commit_parser/token.py +0 -0
  39. {python-semantic-release-8.4.0 → python-semantic-release-8.5.1}/semantic_release/commit_parser/util.py +0 -0
  40. {python-semantic-release-8.4.0 → python-semantic-release-8.5.1}/semantic_release/const.py +0 -0
  41. {python-semantic-release-8.4.0 → python-semantic-release-8.5.1}/semantic_release/data/templates/CHANGELOG.md.j2 +0 -0
  42. {python-semantic-release-8.4.0 → python-semantic-release-8.5.1}/semantic_release/data/templates/release_notes.md.j2 +0 -0
  43. {python-semantic-release-8.4.0 → python-semantic-release-8.5.1}/semantic_release/enums.py +0 -0
  44. {python-semantic-release-8.4.0 → python-semantic-release-8.5.1}/semantic_release/errors.py +0 -0
  45. {python-semantic-release-8.4.0 → python-semantic-release-8.5.1}/semantic_release/helpers.py +0 -0
  46. {python-semantic-release-8.4.0 → python-semantic-release-8.5.1}/semantic_release/hvcs/__init__.py +0 -0
  47. {python-semantic-release-8.4.0 → python-semantic-release-8.5.1}/semantic_release/hvcs/_base.py +0 -0
  48. {python-semantic-release-8.4.0 → python-semantic-release-8.5.1}/semantic_release/hvcs/gitea.py +0 -0
  49. {python-semantic-release-8.4.0 → python-semantic-release-8.5.1}/semantic_release/hvcs/github.py +0 -0
  50. {python-semantic-release-8.4.0 → python-semantic-release-8.5.1}/semantic_release/hvcs/gitlab.py +0 -0
  51. {python-semantic-release-8.4.0 → python-semantic-release-8.5.1}/semantic_release/hvcs/token_auth.py +0 -0
  52. {python-semantic-release-8.4.0 → python-semantic-release-8.5.1}/semantic_release/hvcs/util.py +0 -0
  53. {python-semantic-release-8.4.0 → python-semantic-release-8.5.1}/semantic_release/version/__init__.py +0 -0
  54. {python-semantic-release-8.4.0 → python-semantic-release-8.5.1}/semantic_release/version/algorithm.py +0 -0
  55. {python-semantic-release-8.4.0 → python-semantic-release-8.5.1}/semantic_release/version/declaration.py +0 -0
  56. {python-semantic-release-8.4.0 → python-semantic-release-8.5.1}/semantic_release/version/translator.py +0 -0
  57. {python-semantic-release-8.4.0 → python-semantic-release-8.5.1}/semantic_release/version/version.py +0 -0
  58. {python-semantic-release-8.4.0 → python-semantic-release-8.5.1}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python-semantic-release
3
- Version: 8.4.0
3
+ Version: 8.5.1
4
4
  Summary: Automatic Semantic Versioning for Python projects
5
5
  Author-email: Rolf Erik Lekang <me@rolflekang.com>
6
6
  License: MIT
@@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta"
6
6
 
7
7
  [project]
8
8
  name = "python-semantic-release"
9
- version = "8.4.0"
9
+ version = "8.5.1"
10
10
  description = "Automatic Semantic Versioning for Python projects"
11
11
  requires-python = ">=3.7"
12
12
  license = { text = "MIT" }
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python-semantic-release
3
- Version: 8.4.0
3
+ Version: 8.5.1
4
4
  Summary: Automatic Semantic Versioning for Python projects
5
5
  Author-email: Rolf Erik Lekang <me@rolflekang.com>
6
6
  License: MIT
@@ -23,7 +23,7 @@ from semantic_release.version import (
23
23
  tags_and_versions,
24
24
  )
25
25
 
26
- __version__ = "8.4.0"
26
+ __version__ = "8.5.1"
27
27
 
28
28
 
29
29
  def setup_hook(argv: list[str]) -> None:
@@ -81,22 +81,28 @@ def recursive_render(
81
81
  ) -> list[str]:
82
82
  rendered_paths: list[str] = []
83
83
  for root, file in (
84
- (root, file)
84
+ (Path(root), file)
85
85
  for root, _, files in os.walk(template_dir)
86
86
  for file in files
87
- if not any(elem.startswith(".") for elem in root.split(os.sep))
87
+ # we slice relpath.parts[1:] to allow the top-level
88
+ # template folder to have a dot prefix.
89
+ # e.g. to permit ".github/psr-templates" to contain the templates,
90
+ # rather than enforcing a top-level, non-hidden directory
91
+ if not any(
92
+ elem.startswith(".")
93
+ for elem in Path(root).relative_to(template_dir).parts[1:]
94
+ )
88
95
  and not file.startswith(".")
89
96
  ):
90
- src_path = Path(root)
91
- output_path = (_root_dir / src_path.relative_to(template_dir)).resolve()
92
- log.info("Rendering templates from %s to %s", src_path, output_path)
93
- os.makedirs(str(output_path), exist_ok=True)
97
+ output_path = (_root_dir / root.relative_to(template_dir)).resolve()
98
+ log.info("Rendering templates from %s to %s", root, output_path)
99
+ output_path.mkdir(parents=True, exist_ok=True)
94
100
  if file.endswith(".j2"):
95
101
  # We know the file ends with .j2 by the filter in the for-loop
96
102
  output_filename = file[:-3]
97
103
  # Strip off the template directory from the front of the root path -
98
104
  # that's the output location relative to the repo root
99
- src_file_path = str((src_path / file).relative_to(template_dir))
105
+ src_file_path = str((root / file).relative_to(template_dir))
100
106
  output_file_path = str((output_path / output_filename).resolve())
101
107
 
102
108
  log.debug("rendering %s to %s", src_file_path, output_file_path)
@@ -107,7 +113,7 @@ def recursive_render(
107
113
 
108
114
  rendered_paths.append(output_file_path)
109
115
  else:
110
- src_file = str((src_path / file).resolve())
116
+ src_file = str((root / file).resolve())
111
117
  target_file = str((output_path / file).resolve())
112
118
  log.debug(
113
119
  "source file %s is not a template, copying to %s", src_file, target_file
@@ -9,6 +9,7 @@ from typing import TYPE_CHECKING, ContextManager, Iterable
9
9
 
10
10
  import click
11
11
  import shellingham # type: ignore[import]
12
+ from git.exc import GitCommandError
12
13
 
13
14
  from semantic_release.changelog import ReleaseHistory, environment, recursive_render
14
15
  from semantic_release.changelog.context import make_changelog_context
@@ -243,15 +244,13 @@ def version( # noqa: C901
243
244
  translator.prerelease_token = prerelease_token
244
245
 
245
246
  # Only push if we're committing changes
246
- if push_changes and not commit_changes:
247
- if not create_tag:
248
- log.info("changes will not be pushed because --no-commit disables pushing")
249
- push_changes &= commit_changes
247
+ if push_changes and not commit_changes and not create_tag:
248
+ log.info("changes will not be pushed because --no-commit disables pushing")
249
+ push_changes &= commit_changes
250
250
  # Only push if we're creating a tag
251
- if push_changes and not create_tag:
252
- if not commit_changes:
253
- log.info("new tag will not be pushed because --no-tag disables pushing")
254
- push_changes &= create_tag
251
+ if push_changes and not create_tag and not commit_changes:
252
+ log.info("new tag will not be pushed because --no-tag disables pushing")
253
+ push_changes &= create_tag
255
254
  # Only make a release if we're pushing the changes
256
255
  if make_vcs_release and not push_changes:
257
256
  log.info("No vcs release will be created because pushing changes is disabled")
@@ -371,7 +370,15 @@ def version( # noqa: C901
371
370
  )
372
371
 
373
372
  elif commit_changes:
374
- repo.git.add(all_paths_to_add)
373
+ # TODO: in future this loop should be 1 line:
374
+ # repo.index.add(all_paths_to_add, force=False)
375
+ # but since 'force' is deliberally ineffective (as in docstring) in gitpython 3.1.18
376
+ # we have to do manually add each filepath, and catch the exception if it is an ignored file
377
+ for updated_path in all_paths_to_add:
378
+ try:
379
+ repo.git.add(updated_path)
380
+ except GitCommandError:
381
+ log.warning("Failed to add path (%s) to index", updated_path)
375
382
 
376
383
  rh = ReleaseHistory.from_git_history(
377
384
  repo=repo,
@@ -437,7 +444,15 @@ def version( # noqa: C901
437
444
  )
438
445
  elif commit_changes:
439
446
  # Anything changed here should be staged.
440
- repo.git.add(updated_paths)
447
+ # TODO: in future this loop should be 1 line:
448
+ # repo.index.add(updated_paths, force=False)
449
+ # but since 'force' is deliberally ineffective (as in docstring) in gitpython 3.1.18
450
+ # we have to do manually add each filepath, and catch the exception if it is an ignored file
451
+ for updated_path in updated_paths:
452
+ try:
453
+ repo.git.add(updated_path)
454
+ except GitCommandError:
455
+ log.warning("Failed to add path (%s) to index", updated_path)
441
456
 
442
457
  def custom_git_environment() -> ContextManager[None]:
443
458
  """
@@ -257,8 +257,18 @@ class RuntimeContext:
257
257
  ##
258
258
  # credentials masking for logging
259
259
  masker = MaskingFilter(_use_named_masks=raw.logging_use_named_masks)
260
+
261
+ try:
262
+ active_branch = repo.active_branch.name
263
+ except TypeError as err:
264
+ raise NotAReleaseBranch(
265
+ "Detached HEAD state cannot match any release groups; "
266
+ "no release will be made"
267
+ ) from err
268
+
260
269
  # branch-specific configuration
261
- branch_config = cls.select_branch_options(raw.branches, repo.active_branch.name)
270
+ branch_config = cls.select_branch_options(raw.branches, active_branch)
271
+
262
272
  # commit_parser
263
273
  commit_parser_cls = (
264
274
  _known_commit_parsers[raw.commit_parser]