python-semantic-release 10.3.0__py3-none-any.whl → 10.3.2__py3-none-any.whl

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,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-semantic-release
3
- Version: 10.3.0
3
+ Version: 10.3.2
4
4
  Summary: Automatic Semantic Versioning for Python projects
5
5
  Author-email: Rolf Erik Lekang <me@rolflekang.com>
6
6
  License: MIT
@@ -17,7 +17,7 @@ Classifier: Programming Language :: Python :: 3.10
17
17
  Classifier: Programming Language :: Python :: 3.11
18
18
  Classifier: Programming Language :: Python :: 3.12
19
19
  Classifier: Programming Language :: Python :: 3.13
20
- Requires-Python: >=3.8
20
+ Requires-Python: ~=3.8
21
21
  Description-Content-Type: text/x-rst
22
22
  License-File: LICENSE
23
23
  Requires-Dist: click~=8.1.0
@@ -1,4 +1,4 @@
1
- python_semantic_release-10.3.0.dist-info/licenses/LICENSE,sha256=NE85nszX252sdQdu0xgS9qwfYES0k8qS6gW3uO4jRGE,1083
1
+ python_semantic_release-10.3.2.dist-info/licenses/LICENSE,sha256=NE85nszX252sdQdu0xgS9qwfYES0k8qS6gW3uO4jRGE,1083
2
2
  semantic_release/__init__.py,sha256=tRJWhrn_dUt0QycXD2DoJSfEP5uwmxngH7jvbG2i-hA,1317
3
3
  semantic_release/__main__.py,sha256=pksxr6g1vkKq98Q1lShsxG8tk55IMiSMHzAHKyFU5x0,1704
4
4
  semantic_release/const.py,sha256=wInJR7vcOgT1ysm5VuJQ6lD_ZGYnCwRVKz7Uz3htQc4,861
@@ -17,7 +17,7 @@ semantic_release/cli/changelog_writer.py,sha256=2jP5b0LK61Y2tb22GQSFFmwHwXd2Wjbo
17
17
  semantic_release/cli/cli_context.py,sha256=Nop71LdVCJOeSUHgTXunMyK3xAu_QKQC2cRp1QBVkX0,4134
18
18
  semantic_release/cli/config.py,sha256=4UCx4-jzKpggb7dZM3fnZoi8rPiUGWtEmLiCfWlro7I,33458
19
19
  semantic_release/cli/const.py,sha256=h7XE2D0D__TAZSrUUtVszwvzpkHTMOiQCf97XQNbEvA,163
20
- semantic_release/cli/github_actions_output.py,sha256=3oWCUfOqa2qVV9DBgwYx2pvhYecVBF6DkzILNnDBikQ,4965
20
+ semantic_release/cli/github_actions_output.py,sha256=yC0nsMvEFGACjDwB8DdmGKwNGI8aIIhDxRHrmcS7tzA,5410
21
21
  semantic_release/cli/masking_filter.py,sha256=GsTyaoZbUVJLXVMqeXhCttXK84UnBQ8cNDSHxd52sOc,3218
22
22
  semantic_release/cli/util.py,sha256=4rf4xDHb7l-XpdcFNtslFz1xHslnBu6cTgWHXVnQXQs,3746
23
23
  semantic_release/cli/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -25,7 +25,7 @@ semantic_release/cli/commands/changelog.py,sha256=wJfd4VVfrGnu2jnIpG25cdVcbXIX-E
25
25
  semantic_release/cli/commands/generate_config.py,sha256=2xZOu3NpyhBp0pWr7d8ugKl_kjqQgpSsSMHq5wHTfrE,1699
26
26
  semantic_release/cli/commands/main.py,sha256=u1zhkkvKCZ2TtUqjzvdFTe5UZsvfws_pjqqo6CY0bBo,4351
27
27
  semantic_release/cli/commands/publish.py,sha256=CE_LJTxFnc337MfpsfdJopi7QCwwE13GqGNQ-dNgWis,2871
28
- semantic_release/cli/commands/version.py,sha256=lV4GiDbo27-du_pF1ImxmdX569BgyzryhP9UZxDKYAk,26434
28
+ semantic_release/cli/commands/version.py,sha256=CwFwoBP896Y9dc_p5bAyjZFbuD78tCS-q5IueQsOVSU,26634
29
29
  semantic_release/commit_parser/__init__.py,sha256=6euiDgj9bwOx1rP96vUjq090usviXkbo7OVOnRBGfcw,742
30
30
  semantic_release/commit_parser/_base.py,sha256=DLsHnbXG-39JkUbcnsBCSV2GmV35w1rasyoMhK8G0UE,3058
31
31
  semantic_release/commit_parser/angular.py,sha256=MY_fo9F4EZ-ac8wYzBR0uD94O5Li2D-8zEMR01wss4c,18534
@@ -64,7 +64,7 @@ semantic_release/hvcs/remote_hvcs_base.py,sha256=QtkjdMy9l-c7UOtyPz25cqVOkCk4IU-
64
64
  semantic_release/hvcs/token_auth.py,sha256=ZjT56-NIPB4OKIt1qwHCu1TavXnrWFIBl9ARlg56hgU,663
65
65
  semantic_release/hvcs/util.py,sha256=PUNV4yUlpzDtNCFmh2joaPdU4JyfUBnVp0zaQsT9EDQ,2871
66
66
  semantic_release/version/__init__.py,sha256=CLhtGQry9dLIij5XyRa9ZevxU_1p8tjMTSQ-K_GMpWM,270
67
- semantic_release/version/algorithm.py,sha256=84N2pisD-W9z2WuCNqwq1WHteGlnM4ECKt1maAXP8N8,16687
67
+ semantic_release/version/algorithm.py,sha256=IxgYNF78W7qdMzdV4WsoljwfJgB-sn2XdfkevD0aZlo,16254
68
68
  semantic_release/version/declaration.py,sha256=eot_lUyFaEhzK4bPncfv9tahf51LdxZP6EaS54h3aAs,3635
69
69
  semantic_release/version/translator.py,sha256=LjmsMHWJJOG8ES6lRhjQsP2t8pmw4Ux1XVYzvROMR_M,3047
70
70
  semantic_release/version/version.py,sha256=3QlPKsrmNnFH71GlsYvpI-WwhpkJEs_JrDBbMaepwJY,14183
@@ -73,8 +73,8 @@ semantic_release/version/declarations/enum.py,sha256=3n5Py9DoFkmItIdsmtQrJgmAhep
73
73
  semantic_release/version/declarations/i_version_replacer.py,sha256=oP6BxJuxwI44roI6448tomShv1sMoy9ry8TlhhIQtfc,2416
74
74
  semantic_release/version/declarations/pattern.py,sha256=MpUmsHYGAVAuFSKSb29FLcWeUCEHG_TRyhMO-2DWAAs,8308
75
75
  semantic_release/version/declarations/toml.py,sha256=2K4DtX5Qq1iHT8cG8mISPTMmp50w6Av0KmLAKZPYqq8,4931
76
- python_semantic_release-10.3.0.dist-info/METADATA,sha256=KC3FGBwckcF-gL-W3C-Xnvd-T1XHSQjwAgIinftCf4o,3927
77
- python_semantic_release-10.3.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
78
- python_semantic_release-10.3.0.dist-info/entry_points.txt,sha256=kzkCyDJsMOwgpFwEWKE9wxN1tXaUP6g6GIO4xtc0QuE,162
79
- python_semantic_release-10.3.0.dist-info/top_level.txt,sha256=qYA24nyg3eP-ti5UW7Vuj2aXVmM0wqVHx4mREdRZNAA,17
80
- python_semantic_release-10.3.0.dist-info/RECORD,,
76
+ python_semantic_release-10.3.2.dist-info/METADATA,sha256=Hvdc-N4cJe-GX8gGtD08rfqjASK0I93EaYxuCU6pNK4,3927
77
+ python_semantic_release-10.3.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
78
+ python_semantic_release-10.3.2.dist-info/entry_points.txt,sha256=kzkCyDJsMOwgpFwEWKE9wxN1tXaUP6g6GIO4xtc0QuE,162
79
+ python_semantic_release-10.3.2.dist-info/top_level.txt,sha256=qYA24nyg3eP-ti5UW7Vuj2aXVmM0wqVHx4mREdRZNAA,17
80
+ python_semantic_release-10.3.2.dist-info/RECORD,,
@@ -18,7 +18,10 @@ from semantic_release.cli.changelog_writer import (
18
18
  generate_release_notes,
19
19
  write_changelog_files,
20
20
  )
21
- from semantic_release.cli.github_actions_output import VersionGitHubActionsOutput
21
+ from semantic_release.cli.github_actions_output import (
22
+ PersistenceMode,
23
+ VersionGitHubActionsOutput,
24
+ )
22
25
  from semantic_release.cli.util import noop_report, rprint
23
26
  from semantic_release.const import DEFAULT_SHELL, DEFAULT_VERSION
24
27
  from semantic_release.enums import LevelBump
@@ -468,9 +471,12 @@ def version( # noqa: C901
468
471
  no_verify = runtime.no_git_verify
469
472
  opts = runtime.global_cli_options
470
473
  gha_output = VersionGitHubActionsOutput(
471
- hvcs_client
472
- if isinstance(hvcs_client, Github)
473
- else Github(hvcs_client.remote_url(use_token=False)),
474
+ gh_client=hvcs_client if isinstance(hvcs_client, Github) else None,
475
+ mode=(
476
+ PersistenceMode.TEMPORARY
477
+ if opts.noop or (not commit_changes and not create_tag)
478
+ else PersistenceMode.PERMANENT
479
+ ),
474
480
  released=False,
475
481
  )
476
482
 
@@ -543,7 +549,8 @@ def version( # noqa: C901
543
549
 
544
550
  # Update GitHub Actions output value with new version & set delayed write
545
551
  gha_output.version = new_version
546
- ctx.call_on_close(gha_output.write_if_possible)
552
+ if isinstance(hvcs_client, Github):
553
+ ctx.call_on_close(gha_output.write_if_possible)
547
554
 
548
555
  # Make string variant of version or appropriate tag as necessary
549
556
  version_to_print = str(new_version) if not print_only_tag else new_version.as_tag()
@@ -1,6 +1,7 @@
1
1
  from __future__ import annotations
2
2
 
3
3
  import os
4
+ from enum import Enum
4
5
  from re import compile as regexp
5
6
  from typing import TYPE_CHECKING
6
7
 
@@ -13,12 +14,18 @@ if TYPE_CHECKING:
13
14
  from semantic_release.hvcs.github import Github
14
15
 
15
16
 
17
+ class PersistenceMode(Enum):
18
+ TEMPORARY = "temporary"
19
+ PERMANENT = "permanent"
20
+
21
+
16
22
  class VersionGitHubActionsOutput:
17
23
  OUTPUT_ENV_VAR = "GITHUB_OUTPUT"
18
24
 
19
25
  def __init__(
20
26
  self,
21
- gh_client: Github,
27
+ gh_client: Github | None = None,
28
+ mode: PersistenceMode = PersistenceMode.PERMANENT,
22
29
  released: bool | None = None,
23
30
  version: Version | None = None,
24
31
  commit_sha: str | None = None,
@@ -26,6 +33,7 @@ class VersionGitHubActionsOutput:
26
33
  prev_version: Version | None = None,
27
34
  ) -> None:
28
35
  self._gh_client = gh_client
36
+ self._mode = mode
29
37
  self._released = released
30
38
  self._version = version
31
39
  self._commit_sha = commit_sha
@@ -98,16 +106,23 @@ class VersionGitHubActionsOutput:
98
106
  raise TypeError("output 'prev_version' should be a Version")
99
107
  self._prev_version = value
100
108
 
109
+ @property
110
+ def gh_client(self) -> Github:
111
+ if not self._gh_client:
112
+ raise ValueError("GitHub client not set, cannot create links")
113
+ return self._gh_client
114
+
101
115
  def to_output_text(self) -> str:
102
116
  missing: set[str] = set()
103
117
  if self.version is None:
104
118
  missing.add("version")
105
119
  if self.released is None:
106
120
  missing.add("released")
107
- if self.released and self.commit_sha is None:
108
- missing.add("commit_sha")
109
- if self.released and self.release_notes is None:
110
- missing.add("release_notes")
121
+ if self.released:
122
+ if self.release_notes is None:
123
+ missing.add("release_notes")
124
+ if self._mode is PersistenceMode.PERMANENT and self.commit_sha is None:
125
+ missing.add("commit_sha")
111
126
 
112
127
  if missing:
113
128
  raise ValueError(
@@ -119,7 +134,7 @@ class VersionGitHubActionsOutput:
119
134
  "version": str(self.version),
120
135
  "tag": self.tag,
121
136
  "is_prerelease": str(self.is_prerelease).lower(),
122
- "link": self._gh_client.create_release_url(self.tag) if self.tag else "",
137
+ "link": self.gh_client.create_release_url(self.tag) if self.tag else "",
123
138
  "previous_version": str(self.prev_version) if self.prev_version else "",
124
139
  "commit_sha": self.commit_sha if self.commit_sha else "",
125
140
  }
@@ -346,24 +346,7 @@ def next_version(
346
346
  # Step 5. apply the parser to each commit in the history (could return multiple results per commit)
347
347
  parsed_results = list(map(commit_parser.parse, commits_since_last_release))
348
348
 
349
- # Step 5A. Validation type check for the parser results (important because of possible custom parsers)
350
- for parsed_result in parsed_results:
351
- if not any(
352
- (
353
- isinstance(parsed_result, (ParseError, ParsedCommit)),
354
- type(parsed_result) == list
355
- and validate_types_in_sequence(
356
- parsed_result, (ParseError, ParsedCommit)
357
- ),
358
- type(parsed_result) == tuple
359
- and validate_types_in_sequence(
360
- parsed_result, (ParseError, ParsedCommit)
361
- ),
362
- )
363
- ):
364
- raise TypeError("Unexpected type returned from commit_parser.parse")
365
-
366
- # Step 5B. Accumulate all parsed results into a single list accounting for possible multiple results per commit
349
+ # Step 5A. Accumulate all parsed results into a single list accounting for possible multiple results per commit
367
350
  consolidated_results: list[ParseResult] = reduce(
368
351
  lambda accumulated_results, p_results: [
369
352
  *accumulated_results,
@@ -378,6 +361,10 @@ def next_version(
378
361
  [],
379
362
  )
380
363
 
364
+ # Step 5B. Validation type check for the parser results (important because of possible custom parsers)
365
+ if not validate_types_in_sequence(consolidated_results, (ParseError, ParsedCommit)):
366
+ raise TypeError("Unexpected type returned from commit_parser.parse")
367
+
381
368
  # Step 5C. Parse the commits to determine the bump level that should be applied
382
369
  parsed_levels: set[LevelBump] = {
383
370
  parsed_result.bump # type: ignore[union-attr] # too complex for type checkers