python-semantic-release 9.19.1__tar.gz → 9.21.0__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 (212) hide show
  1. {python_semantic_release-9.19.1/src/python_semantic_release.egg-info → python_semantic_release-9.21.0}/PKG-INFO +3 -1
  2. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/docs/automatic-releases/github-actions.rst +66 -16
  3. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/docs/configuration.rst +171 -18
  4. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/pyproject.toml +8 -1
  5. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0/src/python_semantic_release.egg-info}/PKG-INFO +3 -1
  6. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/src/python_semantic_release.egg-info/SOURCES.txt +9 -2
  7. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/src/python_semantic_release.egg-info/entry_points.txt +1 -0
  8. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/src/python_semantic_release.egg-info/requires.txt +2 -0
  9. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/src/semantic_release/__init__.py +1 -1
  10. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/src/semantic_release/cli/commands/version.py +30 -15
  11. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/src/semantic_release/cli/config.py +37 -42
  12. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/src/semantic_release/cli/util.py +1 -1
  13. python_semantic_release-9.21.0/src/semantic_release/version/declaration.py +107 -0
  14. python_semantic_release-9.21.0/src/semantic_release/version/declarations/enum.py +12 -0
  15. python_semantic_release-9.21.0/src/semantic_release/version/declarations/i_version_replacer.py +67 -0
  16. python_semantic_release-9.21.0/src/semantic_release/version/declarations/pattern.py +241 -0
  17. python_semantic_release-9.21.0/src/semantic_release/version/declarations/toml.py +148 -0
  18. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/tests/e2e/cmd_version/bump_version/git_flow/test_repo_1_channel.py +6 -8
  19. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/tests/e2e/cmd_version/bump_version/git_flow/test_repo_2_channels.py +6 -8
  20. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/tests/e2e/cmd_version/bump_version/git_flow/test_repo_3_channels.py +7 -9
  21. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/tests/e2e/cmd_version/bump_version/git_flow/test_repo_4_channels.py +6 -8
  22. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/tests/e2e/cmd_version/bump_version/github_flow/test_repo_1_channel.py +6 -8
  23. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/tests/e2e/cmd_version/bump_version/github_flow/test_repo_2_channels.py +6 -8
  24. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/tests/e2e/cmd_version/bump_version/trunk_based_dev/test_repo_trunk_dual_version_support.py +6 -8
  25. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/tests/e2e/cmd_version/bump_version/trunk_based_dev/test_repo_trunk_dual_version_support_w_prereleases.py +6 -8
  26. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/tests/e2e/cmd_version/bump_version/trunk_based_dev/test_repo_trunk_w_prereleases.py +6 -8
  27. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/tests/e2e/cmd_version/test_version_bump.py +585 -633
  28. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/tests/e2e/cmd_version/test_version_release_notes.py +7 -3
  29. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/tests/e2e/cmd_version/test_version_stamp.py +197 -5
  30. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/tests/e2e/test_main.py +33 -17
  31. python_semantic_release-9.21.0/tests/unit/semantic_release/version/__init__.py +0 -0
  32. python_semantic_release-9.21.0/tests/unit/semantic_release/version/declarations/__init__.py +0 -0
  33. python_semantic_release-9.21.0/tests/unit/semantic_release/version/declarations/test_pattern_declaration.py +472 -0
  34. python_semantic_release-9.21.0/tests/unit/semantic_release/version/declarations/test_toml_declaration.py +350 -0
  35. python_semantic_release-9.19.1/src/semantic_release/version/declaration.py +0 -201
  36. python_semantic_release-9.19.1/tests/unit/semantic_release/version/test_declaration.py +0 -138
  37. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/AUTHORS.rst +0 -0
  38. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/LICENSE +0 -0
  39. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/MANIFEST.in +0 -0
  40. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/README.rst +0 -0
  41. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/docs/Makefile +0 -0
  42. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/docs/algorithm.rst +0 -0
  43. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/docs/automatic-releases/cronjobs.rst +0 -0
  44. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/docs/automatic-releases/index.rst +0 -0
  45. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/docs/automatic-releases/travis.rst +0 -0
  46. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/docs/changelog_templates.rst +0 -0
  47. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/docs/commands.rst +0 -0
  48. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/docs/commit_parsing.rst +0 -0
  49. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/docs/conf.py +0 -0
  50. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/docs/contributing.rst +0 -0
  51. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/docs/contributors.rst +0 -0
  52. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/docs/index.rst +0 -0
  53. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/docs/make.bat +0 -0
  54. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/docs/migrating_from_v7.rst +0 -0
  55. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/docs/multibranch_releases.rst +0 -0
  56. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/docs/psr_changelog.rst +0 -0
  57. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/docs/strict_mode.rst +0 -0
  58. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/docs/troubleshooting.rst +0 -0
  59. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/setup.cfg +0 -0
  60. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/src/python_semantic_release.egg-info/dependency_links.txt +0 -0
  61. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/src/python_semantic_release.egg-info/top_level.txt +0 -0
  62. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/src/semantic_release/__main__.py +0 -0
  63. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/src/semantic_release/changelog/__init__.py +0 -0
  64. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/src/semantic_release/changelog/context.py +0 -0
  65. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/src/semantic_release/changelog/release_history.py +0 -0
  66. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/src/semantic_release/changelog/template.py +0 -0
  67. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/src/semantic_release/cli/__init__.py +0 -0
  68. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/src/semantic_release/cli/changelog_writer.py +0 -0
  69. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/src/semantic_release/cli/cli_context.py +0 -0
  70. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/src/semantic_release/cli/commands/__init__.py +0 -0
  71. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/src/semantic_release/cli/commands/changelog.py +0 -0
  72. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/src/semantic_release/cli/commands/generate_config.py +0 -0
  73. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/src/semantic_release/cli/commands/main.py +0 -0
  74. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/src/semantic_release/cli/commands/publish.py +0 -0
  75. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/src/semantic_release/cli/const.py +0 -0
  76. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/src/semantic_release/cli/github_actions_output.py +0 -0
  77. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/src/semantic_release/cli/masking_filter.py +0 -0
  78. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/src/semantic_release/commit_parser/__init__.py +0 -0
  79. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/src/semantic_release/commit_parser/_base.py +0 -0
  80. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/src/semantic_release/commit_parser/angular.py +0 -0
  81. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/src/semantic_release/commit_parser/conventional.py +0 -0
  82. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/src/semantic_release/commit_parser/emoji.py +0 -0
  83. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/src/semantic_release/commit_parser/scipy.py +0 -0
  84. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/src/semantic_release/commit_parser/tag.py +0 -0
  85. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/src/semantic_release/commit_parser/token.py +0 -0
  86. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/src/semantic_release/commit_parser/util.py +0 -0
  87. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/src/semantic_release/const.py +0 -0
  88. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/src/semantic_release/data/templates/angular/md/.components/changelog_header.md.j2 +0 -0
  89. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/src/semantic_release/data/templates/angular/md/.components/changelog_init.md.j2 +0 -0
  90. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/src/semantic_release/data/templates/angular/md/.components/changelog_update.md.j2 +0 -0
  91. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/src/semantic_release/data/templates/angular/md/.components/changes.md.j2 +0 -0
  92. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/src/semantic_release/data/templates/angular/md/.components/first_release.md.j2 +0 -0
  93. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/src/semantic_release/data/templates/angular/md/.components/macros.md.j2 +0 -0
  94. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/src/semantic_release/data/templates/angular/md/.components/unreleased_changes.md.j2 +0 -0
  95. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/src/semantic_release/data/templates/angular/md/.components/versioned_changes.md.j2 +0 -0
  96. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/src/semantic_release/data/templates/angular/md/.release_notes.md.j2 +0 -0
  97. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/src/semantic_release/data/templates/angular/md/CHANGELOG.md.j2 +0 -0
  98. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/src/semantic_release/data/templates/angular/rst/.components/changelog_header.rst.j2 +0 -0
  99. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/src/semantic_release/data/templates/angular/rst/.components/changelog_init.rst.j2 +0 -0
  100. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/src/semantic_release/data/templates/angular/rst/.components/changelog_update.rst.j2 +0 -0
  101. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/src/semantic_release/data/templates/angular/rst/.components/changes.rst.j2 +0 -0
  102. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/src/semantic_release/data/templates/angular/rst/.components/first_release.rst.j2 +0 -0
  103. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/src/semantic_release/data/templates/angular/rst/.components/macros.rst.j2 +0 -0
  104. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/src/semantic_release/data/templates/angular/rst/.components/unreleased_changes.rst.j2 +0 -0
  105. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/src/semantic_release/data/templates/angular/rst/.components/versioned_changes.rst.j2 +0 -0
  106. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/src/semantic_release/data/templates/angular/rst/CHANGELOG.rst.j2 +0 -0
  107. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/src/semantic_release/enums.py +0 -0
  108. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/src/semantic_release/errors.py +0 -0
  109. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/src/semantic_release/gitproject.py +0 -0
  110. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/src/semantic_release/globals.py +0 -0
  111. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/src/semantic_release/helpers.py +0 -0
  112. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/src/semantic_release/hvcs/__init__.py +0 -0
  113. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/src/semantic_release/hvcs/_base.py +0 -0
  114. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/src/semantic_release/hvcs/bitbucket.py +0 -0
  115. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/src/semantic_release/hvcs/gitea.py +0 -0
  116. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/src/semantic_release/hvcs/github.py +0 -0
  117. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/src/semantic_release/hvcs/gitlab.py +0 -0
  118. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/src/semantic_release/hvcs/remote_hvcs_base.py +0 -0
  119. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/src/semantic_release/hvcs/token_auth.py +0 -0
  120. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/src/semantic_release/hvcs/util.py +0 -0
  121. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/src/semantic_release/py.typed +0 -0
  122. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/src/semantic_release/version/__init__.py +0 -0
  123. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/src/semantic_release/version/algorithm.py +0 -0
  124. {python_semantic_release-9.19.1/tests → python_semantic_release-9.21.0/src/semantic_release/version/declarations}/__init__.py +0 -0
  125. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/src/semantic_release/version/translator.py +0 -0
  126. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/src/semantic_release/version/version.py +0 -0
  127. {python_semantic_release-9.19.1/tests/e2e → python_semantic_release-9.21.0/tests}/__init__.py +0 -0
  128. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/tests/conftest.py +0 -0
  129. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/tests/const.py +0 -0
  130. {python_semantic_release-9.19.1/tests/e2e/cmd_changelog → python_semantic_release-9.21.0/tests/e2e}/__init__.py +0 -0
  131. {python_semantic_release-9.19.1/tests/e2e/cmd_config → python_semantic_release-9.21.0/tests/e2e/cmd_changelog}/__init__.py +0 -0
  132. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/tests/e2e/cmd_changelog/test_changelog.py +0 -0
  133. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/tests/e2e/cmd_changelog/test_changelog_custom_parser.py +0 -0
  134. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/tests/e2e/cmd_changelog/test_changelog_parsing.py +0 -0
  135. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/tests/e2e/cmd_changelog/test_changelog_release_notes.py +0 -0
  136. {python_semantic_release-9.19.1/tests/e2e/cmd_publish → python_semantic_release-9.21.0/tests/e2e/cmd_config}/__init__.py +0 -0
  137. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/tests/e2e/cmd_config/test_generate_config.py +0 -0
  138. {python_semantic_release-9.19.1/tests/e2e/cmd_version → python_semantic_release-9.21.0/tests/e2e/cmd_publish}/__init__.py +0 -0
  139. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/tests/e2e/cmd_publish/test_publish.py +0 -0
  140. {python_semantic_release-9.19.1/tests/e2e/cmd_version/bump_version → python_semantic_release-9.21.0/tests/e2e/cmd_version}/__init__.py +0 -0
  141. {python_semantic_release-9.19.1/tests/e2e/cmd_version/bump_version/git_flow → python_semantic_release-9.21.0/tests/e2e/cmd_version/bump_version}/__init__.py +0 -0
  142. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/tests/e2e/cmd_version/bump_version/conftest.py +0 -0
  143. {python_semantic_release-9.19.1/tests/e2e/cmd_version/bump_version/github_flow → python_semantic_release-9.21.0/tests/e2e/cmd_version/bump_version/git_flow}/__init__.py +0 -0
  144. {python_semantic_release-9.19.1/tests/e2e/cmd_version/bump_version/trunk_based_dev → python_semantic_release-9.21.0/tests/e2e/cmd_version/bump_version/github_flow}/__init__.py +0 -0
  145. {python_semantic_release-9.19.1/tests/unit → python_semantic_release-9.21.0/tests/e2e/cmd_version/bump_version/trunk_based_dev}/__init__.py +0 -0
  146. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/tests/e2e/cmd_version/bump_version/trunk_based_dev/test_repo_trunk.py +0 -0
  147. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/tests/e2e/cmd_version/test_version.py +0 -0
  148. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/tests/e2e/cmd_version/test_version_build.py +0 -0
  149. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/tests/e2e/cmd_version/test_version_changelog.py +0 -0
  150. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/tests/e2e/cmd_version/test_version_changelog_custom_commit_msg.py +0 -0
  151. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/tests/e2e/cmd_version/test_version_github_actions.py +0 -0
  152. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/tests/e2e/cmd_version/test_version_print.py +0 -0
  153. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/tests/e2e/cmd_version/test_version_strict.py +0 -0
  154. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/tests/e2e/conftest.py +0 -0
  155. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/tests/e2e/test_help.py +0 -0
  156. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/tests/fixtures/__init__.py +0 -0
  157. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/tests/fixtures/commit_parsers.py +0 -0
  158. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/tests/fixtures/example_project.py +0 -0
  159. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/tests/fixtures/git_repo.py +0 -0
  160. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/tests/fixtures/repos/__init__.py +0 -0
  161. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/tests/fixtures/repos/git_flow/__init__.py +0 -0
  162. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/tests/fixtures/repos/git_flow/repo_w_1_release_channel.py +0 -0
  163. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/tests/fixtures/repos/git_flow/repo_w_2_release_channels.py +0 -0
  164. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/tests/fixtures/repos/git_flow/repo_w_3_release_channels.py +0 -0
  165. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/tests/fixtures/repos/git_flow/repo_w_4_release_channels.py +0 -0
  166. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/tests/fixtures/repos/github_flow/__init__.py +0 -0
  167. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/tests/fixtures/repos/github_flow/repo_w_default_release.py +0 -0
  168. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/tests/fixtures/repos/github_flow/repo_w_release_channels.py +0 -0
  169. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/tests/fixtures/repos/repo_initial_commit.py +0 -0
  170. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/tests/fixtures/repos/trunk_based_dev/__init__.py +0 -0
  171. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/tests/fixtures/repos/trunk_based_dev/repo_w_dual_version_support.py +0 -0
  172. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/tests/fixtures/repos/trunk_based_dev/repo_w_dual_version_support_w_prereleases.py +0 -0
  173. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/tests/fixtures/repos/trunk_based_dev/repo_w_no_tags.py +0 -0
  174. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/tests/fixtures/repos/trunk_based_dev/repo_w_prereleases.py +0 -0
  175. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/tests/fixtures/repos/trunk_based_dev/repo_w_tags.py +0 -0
  176. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/tests/fixtures/scipy.py +0 -0
  177. {python_semantic_release-9.19.1/tests/unit/semantic_release → python_semantic_release-9.21.0/tests/unit}/__init__.py +0 -0
  178. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/tests/unit/conftest.py +0 -0
  179. {python_semantic_release-9.19.1/tests/unit/semantic_release/changelog → python_semantic_release-9.21.0/tests/unit/semantic_release}/__init__.py +0 -0
  180. {python_semantic_release-9.19.1/tests/unit/semantic_release/cli → python_semantic_release-9.21.0/tests/unit/semantic_release/changelog}/__init__.py +0 -0
  181. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/tests/unit/semantic_release/changelog/conftest.py +0 -0
  182. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/tests/unit/semantic_release/changelog/test_changelog_context.py +0 -0
  183. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/tests/unit/semantic_release/changelog/test_default_changelog.py +0 -0
  184. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/tests/unit/semantic_release/changelog/test_release_history.py +0 -0
  185. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/tests/unit/semantic_release/changelog/test_release_notes.py +0 -0
  186. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/tests/unit/semantic_release/changelog/test_template.py +0 -0
  187. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/tests/unit/semantic_release/changelog/test_template_render.py +0 -0
  188. {python_semantic_release-9.19.1/tests/unit/semantic_release/commit_parser → python_semantic_release-9.21.0/tests/unit/semantic_release/cli}/__init__.py +0 -0
  189. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/tests/unit/semantic_release/cli/test_config.py +0 -0
  190. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/tests/unit/semantic_release/cli/test_github_actions_output.py +0 -0
  191. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/tests/unit/semantic_release/cli/test_masking_filter.py +0 -0
  192. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/tests/unit/semantic_release/cli/test_util.py +0 -0
  193. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/tests/unit/semantic_release/cli/test_version.py +0 -0
  194. {python_semantic_release-9.19.1/tests/unit/semantic_release/hvcs → python_semantic_release-9.21.0/tests/unit/semantic_release/commit_parser}/__init__.py +0 -0
  195. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/tests/unit/semantic_release/commit_parser/test_conventional.py +0 -0
  196. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/tests/unit/semantic_release/commit_parser/test_emoji.py +0 -0
  197. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/tests/unit/semantic_release/commit_parser/test_parsed_commit.py +0 -0
  198. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/tests/unit/semantic_release/commit_parser/test_scipy.py +0 -0
  199. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/tests/unit/semantic_release/commit_parser/test_util.py +0 -0
  200. {python_semantic_release-9.19.1/tests/unit/semantic_release/version → python_semantic_release-9.21.0/tests/unit/semantic_release/hvcs}/__init__.py +0 -0
  201. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/tests/unit/semantic_release/hvcs/test__base.py +0 -0
  202. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/tests/unit/semantic_release/hvcs/test_bitbucket.py +0 -0
  203. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/tests/unit/semantic_release/hvcs/test_gitea.py +0 -0
  204. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/tests/unit/semantic_release/hvcs/test_github.py +0 -0
  205. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/tests/unit/semantic_release/hvcs/test_gitlab.py +0 -0
  206. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/tests/unit/semantic_release/hvcs/test_token_auth.py +0 -0
  207. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/tests/unit/semantic_release/hvcs/test_util.py +0 -0
  208. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/tests/unit/semantic_release/test_helpers.py +0 -0
  209. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/tests/unit/semantic_release/version/test_algorithm.py +0 -0
  210. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/tests/unit/semantic_release/version/test_translator.py +0 -0
  211. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/tests/unit/semantic_release/version/test_version.py +0 -0
  212. {python_semantic_release-9.19.1 → python_semantic_release-9.21.0}/tests/util.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python-semantic-release
3
- Version: 9.19.1
3
+ Version: 9.21.0
4
4
  Summary: Automatic Semantic Versioning for Python projects
5
5
  Author-email: Rolf Erik Lekang <me@rolflekang.com>
6
6
  License: MIT
@@ -33,6 +33,7 @@ Requires-Dist: importlib-resources~=6.0
33
33
  Requires-Dist: pydantic~=2.0
34
34
  Requires-Dist: rich~=13.0
35
35
  Requires-Dist: shellingham~=1.5
36
+ Requires-Dist: Deprecated~=1.2
36
37
  Provides-Extra: build
37
38
  Requires-Dist: build~=1.2; extra == "build"
38
39
  Provides-Extra: docs
@@ -63,6 +64,7 @@ Requires-Dist: tox~=4.11; extra == "dev"
63
64
  Requires-Dist: ruff==0.6.1; extra == "dev"
64
65
  Provides-Extra: mypy
65
66
  Requires-Dist: mypy==1.15.0; extra == "mypy"
67
+ Requires-Dist: types-Deprecated~=1.2; extra == "mypy"
66
68
  Requires-Dist: types-requests~=2.32.0; extra == "mypy"
67
69
  Requires-Dist: types-pyyaml~=6.0; extra == "mypy"
68
70
 
@@ -337,7 +337,7 @@ before the :ref:`version <cmd-version>` subcommand.
337
337
 
338
338
  .. code:: yaml
339
339
 
340
- - uses: python-semantic-release/python-semantic-release@v9.19.0
340
+ - uses: python-semantic-release/python-semantic-release@v9.20.0
341
341
  with:
342
342
  root_options: "-vv --noop"
343
343
 
@@ -576,7 +576,7 @@ before the :ref:`publish <cmd-publish>` subcommand.
576
576
 
577
577
  .. code:: yaml
578
578
 
579
- - uses: python-semantic-release/publish-action@v9.19.0
579
+ - uses: python-semantic-release/publish-action@v9.20.0
580
580
  with:
581
581
  root_options: "-vv --noop"
582
582
 
@@ -643,7 +643,7 @@ Examples
643
643
  Common Workflow Example
644
644
  -----------------------
645
645
 
646
- The following is a common workflow example that uses both the Python Semantic Release Action
646
+ The following is a simple common workflow example that uses both the Python Semantic Release Action
647
647
  and the Python Semantic Release Publish Action. This workflow will run on every push to the
648
648
  ``main`` branch and will create a new release upon a successful version determination. If a
649
649
  version is released, the workflow will then publish the package to PyPI and upload the package
@@ -661,30 +661,74 @@ to the GitHub Release Assets as well.
661
661
  jobs:
662
662
  release:
663
663
  runs-on: ubuntu-latest
664
- concurrency: release
664
+ concurrency:
665
+ group: ${{ github.workflow }}-release-${{ github.ref_name }}
666
+ cancel-in-progress: false
665
667
 
666
668
  permissions:
667
669
  id-token: write
668
670
  contents: write
669
671
 
670
672
  steps:
671
- # Note: we need to checkout the repository at the workflow sha in case during the workflow
672
- # the branch was updated. To keep PSR working with the configured release branches,
673
- # we force a checkout of the desired release branch but at the workflow sha HEAD.
674
- - name: Setup | Checkout Repository at workflow sha
673
+ # Note: We checkout the repository at the branch that triggered the workflow
674
+ # with the entire history to ensure to match PSR's release branch detection
675
+ # and history evaluation.
676
+ # However, we forcefully reset the branch to the workflow sha because it is
677
+ # possible that the branch was updated while the workflow was running. This
678
+ # prevents accidentally releasing un-evaluated changes.
679
+ - name: Setup | Checkout Repository on Release Branch
675
680
  uses: actions/checkout@v4
676
681
  with:
682
+ ref: ${{ github.ref_name }}
677
683
  fetch-depth: 0
678
- ref: ${{ github.sha }}
679
684
 
680
- - name: Setup | Force correct release branch on workflow sha
685
+ - name: Setup | Force release branch to be at workflow sha
681
686
  run: |
682
- git checkout -B ${{ github.ref_name }} ${{ github.sha }}
687
+ git reset --hard ${{ github.sha }}
688
+
689
+ - name: Evaluate | Verify upstream has NOT changed
690
+ # Last chance to abort before causing an error as another PR/push was applied to
691
+ # the upstream branch while this workflow was running. This is important
692
+ # because we are committing a version change (--commit). You may omit this step
693
+ # if you have 'commit: false' in your configuration.
694
+ #
695
+ # You may consider moving this to a repo script and call it from this step instead
696
+ # of writing it in-line.
697
+ shell: bash
698
+ run: |
699
+ set +o pipefail
700
+
701
+ UPSTREAM_BRANCH_NAME="$(git status -sb | head -n 1 | cut -d' ' -f2 | grep -E '\.{3}' | cut -d'.' -f4)"
702
+ printf '%s\n' "Upstream branch name: $UPSTREAM_BRANCH_NAME"
703
+
704
+ set -o pipefail
705
+
706
+ if [ -z "$UPSTREAM_BRANCH_NAME" ]; then
707
+ printf >&2 '%s\n' "::error::Unable to determine upstream branch name!"
708
+ exit 1
709
+ fi
710
+
711
+ git fetch "${UPSTREAM_BRANCH_NAME%%/*}"
712
+
713
+ if ! UPSTREAM_SHA="$(git rev-parse "$UPSTREAM_BRANCH_NAME")"; then
714
+ printf >&2 '%s\n' "::error::Unable to determine upstream branch sha!"
715
+ exit 1
716
+ fi
717
+
718
+ HEAD_SHA="$(git rev-parse HEAD)"
719
+
720
+ if [ "$HEAD_SHA" != "$UPSTREAM_SHA" ]; then
721
+ printf >&2 '%s\n' "[HEAD SHA] $HEAD_SHA != $UPSTREAM_SHA [UPSTREAM SHA]"
722
+ printf >&2 '%s\n' "::error::Upstream has changed, aborting release..."
723
+ exit 1
724
+ fi
725
+
726
+ printf '%s\n' "Verified upstream branch has not changed, continuing with release..."
683
727
 
684
728
  - name: Action | Semantic Version Release
685
729
  id: release
686
730
  # Adjust tag with desired version if applicable.
687
- uses: python-semantic-release/python-semantic-release@v9.19.0
731
+ uses: python-semantic-release/python-semantic-release@v9.20.0
688
732
  with:
689
733
  github_token: ${{ secrets.GITHUB_TOKEN }}
690
734
  git_committer_name: "github-actions"
@@ -695,7 +739,7 @@ to the GitHub Release Assets as well.
695
739
  if: steps.release.outputs.released == 'true'
696
740
 
697
741
  - name: Publish | Upload to GitHub Release Assets
698
- uses: python-semantic-release/publish-action@v9.19.0
742
+ uses: python-semantic-release/publish-action@v9.20.0
699
743
  if: steps.release.outputs.released == 'true'
700
744
  with:
701
745
  github_token: ${{ secrets.GITHUB_TOKEN }}
@@ -706,6 +750,11 @@ to the GitHub Release Assets as well.
706
750
  one release job in the case if there are multiple pushes to ``main`` in a short period
707
751
  of time.
708
752
 
753
+ Secondly the *Evaluate | Verify upstream has NOT changed* step is used to ensure that the
754
+ upstream branch has not changed while the workflow was running. This is important because
755
+ we are committing a version change (``commit: true``) and there might be a push collision
756
+ that would cause undesired behavior. Review Issue `#1201`_ for more detailed information.
757
+
709
758
  .. warning::
710
759
  You must set ``fetch-depth`` to 0 when using ``actions/checkout@v4``, since
711
760
  Python Semantic Release needs access to the full history to build a changelog
@@ -721,6 +770,7 @@ to the GitHub Release Assets as well.
721
770
  case, you will also need to pass the new token to ``actions/checkout`` (as
722
771
  the ``token`` input) in order to gain push access.
723
772
 
773
+ .. _#1201: https://github.com/python-semantic-release/python-semantic-release/issues/1201
724
774
  .. _concurrency: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idconcurrency
725
775
 
726
776
  Version Overrides Example
@@ -744,7 +794,7 @@ The equivalent GitHub Action configuration would be:
744
794
 
745
795
  - name: Action | Semantic Version Release
746
796
  # Adjust tag with desired version if applicable.
747
- uses: python-semantic-release/python-semantic-release@v9.19.0
797
+ uses: python-semantic-release/python-semantic-release@v9.20.0
748
798
  with:
749
799
  github_token: ${{ secrets.GITHUB_TOKEN }}
750
800
  force: patch
@@ -772,13 +822,13 @@ Publish Action.
772
822
  .. code:: yaml
773
823
 
774
824
  - name: Release Project 1
775
- uses: python-semantic-release/python-semantic-release@v9.19.0
825
+ uses: python-semantic-release/python-semantic-release@v9.20.0
776
826
  with:
777
827
  directory: ./project1
778
828
  github_token: ${{ secrets.GITHUB_TOKEN }}
779
829
 
780
830
  - name: Release Project 2
781
- uses: python-semantic-release/python-semantic-release@v9.19.0
831
+ uses: python-semantic-release/python-semantic-release@v9.20.0
782
832
  with:
783
833
  directory: ./project2
784
834
  github_token: ${{ secrets.GITHUB_TOKEN }}
@@ -1201,17 +1201,61 @@ Tags which do not match this format will not be considered as versions of your p
1201
1201
 
1202
1202
  **Type:** ``list[str]``
1203
1203
 
1204
- Similar to :ref:`config-version_variables`, but allows the version number to be
1205
- identified safely in a toml file like ``pyproject.toml``, with each entry using
1206
- dotted notation to indicate the key for which the value represents the version:
1204
+ This configuration option is similar to :ref:`config-version_variables`, but it uses
1205
+ a TOML parser to interpret the data structure before, inserting the version. This
1206
+ allows users to use dot-notation to specify the version via the logical structure
1207
+ within the TOML file, which is more accurate than a pattern replace.
1208
+
1209
+ The ``version_toml`` option is commonly used to update the version number in the project
1210
+ definition file: ``pyproject.toml`` as seen in the example below.
1211
+
1212
+ As of v9.20.0, the ``version_toml`` option accepts a colon-separated definition
1213
+ with either 2 or 3 parts. The 2-part definition includes the file path and the version
1214
+ parameter (in dot-notation). Newly with v9.20.0, it also accepts an optional
1215
+ 3rd part to allow configuration of the format type.
1216
+
1217
+ **Available Format Types**
1218
+
1219
+ - ``nf``: Number format (ex. ``1.2.3``)
1220
+ - ``tf``: :ref:`Tag Format <config-tag_format>` (ex. ``v1.2.3``)
1221
+
1222
+ If the format type is not specified, it will default to the number format.
1223
+
1224
+ **Example**
1207
1225
 
1208
1226
  .. code-block:: toml
1209
1227
 
1210
1228
  [semantic_release]
1211
1229
  version_toml = [
1212
- "pyproject.toml:tool.poetry.version",
1230
+ # "file:variable:[format_type]"
1231
+ "pyproject.toml:tool.poetry.version", # Implied Default: Number format
1232
+ "definition.toml:project.version:nf", # Number format
1233
+ "definition.toml:project.release:tf", # Tag format
1213
1234
  ]
1214
1235
 
1236
+ This configuration will result in the following changes:
1237
+
1238
+ .. code-block:: diff
1239
+
1240
+ diff a/pyproject.toml b/pyproject.toml
1241
+
1242
+ [tool.poetry]
1243
+ - version = "0.1.0"
1244
+ + version = "0.2.0"
1245
+
1246
+ .. code-block:: diff
1247
+
1248
+ diff a/definition.toml b/definition.toml
1249
+
1250
+ [project]
1251
+ name = "example"
1252
+
1253
+ - version = "0.1.0"
1254
+ + version = "0.1.0"
1255
+
1256
+ - release = "v0.1.0"
1257
+ + release = "v0.2.0"
1258
+
1215
1259
  **Default:** ``[]``
1216
1260
 
1217
1261
  ----
@@ -1223,44 +1267,153 @@ dotted notation to indicate the key for which the value represents the version:
1223
1267
 
1224
1268
  **Type:** ``list[str]``
1225
1269
 
1226
- Each entry represents a location where the version is stored in the source code,
1227
- specified in ``file:variable`` format. For example:
1270
+ The ``version_variables`` configuration option is a list of string definitions
1271
+ that defines where the version number should be updated in the repository, when
1272
+ a new version is released.
1273
+
1274
+ As of v9.20.0, the ``version_variables`` option accepts a
1275
+ colon-separated definition with either 2 or 3 parts. The 2-part definition includes
1276
+ the file path and the variable name. Newly with v9.20.0, it also accepts
1277
+ an optional 3rd part to allow configuration of the format type.
1278
+
1279
+ **Available Format Types**
1280
+
1281
+ - ``nf``: Number format (ex. ``1.2.3``)
1282
+ - ``tf``: :ref:`Tag Format <config-tag_format>` (ex. ``v1.2.3``)
1283
+
1284
+ If the format type is not specified, it will default to the number format.
1285
+
1286
+ Prior to v9.20.0, PSR only supports entries with the first 2-parts
1287
+ as the tag format type was not available and would only replace numeric
1288
+ version numbers.
1289
+
1290
+ **Example**
1228
1291
 
1229
1292
  .. code-block:: toml
1230
1293
 
1231
1294
  [semantic_release]
1295
+ tag_format = "v{version}"
1232
1296
  version_variables = [
1233
- "src/semantic_release/__init__.py:__version__",
1234
- "docs/conf.py:version",
1297
+ # "file:variable:format_type"
1298
+ "src/semantic_release/__init__.py:__version__", # Implied Default: Number format
1299
+ "docs/conf.py:version:nf", # Number format for sphinx docs
1300
+ "kustomization.yml:newTag:tf", # Tag format
1235
1301
  ]
1236
1302
 
1303
+ First, the ``__version__`` variable in ``src/semantic_release/__init__.py`` will be updated
1304
+ with the next version using the `SemVer`_ number format.
1305
+
1306
+ .. code-block:: diff
1307
+
1308
+ diff a/src/semantic_release/__init__.py b/src/semantic_release/__init__.py
1309
+
1310
+ - __version__ = "0.1.0"
1311
+ + __version__ = "0.2.0"
1312
+
1313
+ Then, the ``version`` variable in ``docs/conf.py`` will be updated with the next version
1314
+ with the next version using the `SemVer`_ number format because of the explicit ``nf``.
1315
+
1316
+ .. code-block:: diff
1317
+
1318
+ diff a/docs/conf.py b/docs/conf.py
1319
+
1320
+ - version = "0.1.0"
1321
+ + version = "0.2.0"
1322
+
1323
+ Lastly, the ``newTag`` variable in ``kustomization.yml`` will be updated with the next version
1324
+ with the next version using the configured :ref:`config-tag_format` because the definition
1325
+ included ``tf``.
1326
+
1327
+ .. code-block:: diff
1328
+
1329
+ diff a/kustomization.yml b/kustomization.yml
1330
+
1331
+ images:
1332
+ - name: repo/image
1333
+ - newTag: v0.1.0
1334
+ + newTag: v0.2.0
1335
+
1336
+ **How It works**
1337
+
1237
1338
  Each version variable will be transformed into a Regular Expression that will be used
1238
1339
  to substitute the version number in the file. The replacement algorithm is **ONLY** a
1239
1340
  pattern match and replace. It will **NOT** evaluate the code nor will PSR understand
1240
1341
  any internal object structures (ie. ``file:object.version`` will not work).
1241
1342
 
1242
- .. important::
1243
- The Regular Expression expects a version value to exist in the file to be replaced.
1244
- It cannot be an empty string or a non-semver compliant string. If this is the very
1245
- first time you are using PSR, we recommend you set the version to ``0.0.0``. This
1246
- may become more flexible in the future with resolution of issue `#941`_.
1343
+ The regular expression generated from the ``version_variables`` definition will:
1247
1344
 
1248
- .. _#941: https://github.com/python-semantic-release/python-semantic-release/issues/941
1345
+ 1. Look for the specified ``variable`` name in the ``file``. The variable name can be
1346
+ enclosed by single (``'``) or double (``"``) quotation marks but they must match.
1347
+
1348
+ 2. The variable name defined by ``variable`` and the version must be separated by
1349
+ an operand symbol (``=``, ``:``, ``:=``, or ``@``). Whitespace is optional around
1350
+ the symbol.
1351
+
1352
+ 3. The value of the variable must match a `SemVer`_ regular expression and can be
1353
+ enclosed by single (``'``) or double (``"``) quotation marks but they must match. However,
1354
+ the enclosing quotes of the value do not have to match the quotes surrounding the variable
1355
+ name.
1356
+
1357
+ 4. If the format type is set to ``tf`` then the variable value must have the matching prefix
1358
+ and suffix of the :ref:`config-tag_format` setting around the `SemVer`_ version number.
1249
1359
 
1250
1360
  Given the pattern matching nature of this feature, the Regular Expression is able to
1251
- support most file formats as a variable declaration in most languages is very similar.
1252
- We specifically support Python, YAML, and JSON as these have been the most common
1253
- requests. This configuration option will also work regardless of file extension
1254
- because its only a pattern match.
1361
+ support most file formats because of the similarity of variable declaration across
1362
+ programming languages. PSR specifically supports Python, YAML, and JSON as these have
1363
+ been the most commonly requested formats. This configuration option will also work
1364
+ regardless of file extension because it looks for a matching pattern string.
1255
1365
 
1256
1366
  .. note::
1257
1367
  This will also work for TOML but we recommend using :ref:`config-version_toml` for
1258
1368
  TOML files as it actually will interpret the TOML file and replace the version
1259
1369
  number before writing the file back to disk.
1260
1370
 
1371
+ This is a comprehensive list (but not all variations) of examples where the following versions
1372
+ will be matched and replaced by the new version:
1373
+
1374
+ .. code-block::
1375
+
1376
+ # Common variable declaration formats
1377
+ version='1.2.3'
1378
+ version = "1.2.3"
1379
+ release = "v1.2.3" # if tag_format is set
1380
+
1381
+ # YAML
1382
+ version: 1.2.3
1383
+
1384
+ # JSON
1385
+ "version": "1.2.3"
1386
+
1387
+ # NPM & GitHub Actions YAML
1388
+ version@1.2.3
1389
+ version@v1.2.3 # if tag_format is set
1390
+
1391
+ # Walrus Operator
1392
+ version := "1.2.3"
1393
+
1394
+ # Excessive whitespace
1395
+ version = '1.2.3'
1396
+
1397
+ # Mixed Quotes
1398
+ "version" = '1.2.3'
1399
+
1400
+ # Custom Tag Format with tag_format set (monorepos)
1401
+ __release__ = "module-v1.2.3"
1402
+
1403
+ .. important::
1404
+ The Regular Expression expects a version value to exist in the file to be replaced.
1405
+ It cannot be an empty string or a non-semver compliant string. If this is the very
1406
+ first time you are using PSR, we recommend you set the version to ``0.0.0``.
1407
+
1408
+ This may become more flexible in the future with resolution of issue `#941`_.
1409
+
1410
+ .. _#941: https://github.com/python-semantic-release/python-semantic-release/issues/941
1411
+
1261
1412
  .. warning::
1262
1413
  If the file (ex. JSON) you are replacing has two of the same variable name in it,
1263
1414
  this pattern match will not be able to differentiate between the two and will replace
1264
1415
  both. This is a limitation of the pattern matching and not a bug.
1265
1416
 
1266
1417
  **Default:** ``[]``
1418
+
1419
+ .. _SemVer: https://semver.org/
@@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta"
6
6
 
7
7
  [project]
8
8
  name = "python-semantic-release"
9
- version = "9.19.1"
9
+ version = "9.21.0"
10
10
  description = "Automatic Semantic Versioning for Python projects"
11
11
  requires-python = ">=3.8"
12
12
  license = { text = "MIT" }
@@ -35,9 +35,11 @@ dependencies = [
35
35
  "pydantic ~= 2.0",
36
36
  "rich ~= 13.0",
37
37
  "shellingham ~= 1.5",
38
+ "Deprecated ~= 1.2", # Backport of deprecated decorator for python 3.8
38
39
  ]
39
40
 
40
41
  [project.scripts]
42
+ python-semantic-release = "semantic_release.__main__:main"
41
43
  semantic-release = "semantic_release.__main__:main"
42
44
  psr = "semantic_release.__main__:main"
43
45
 
@@ -83,6 +85,7 @@ dev = [
83
85
  ]
84
86
  mypy = [
85
87
  "mypy == 1.15.0",
88
+ "types-Deprecated ~= 1.2",
86
89
  "types-requests ~= 2.32.0",
87
90
  "types-pyyaml ~= 6.0",
88
91
  ]
@@ -201,6 +204,10 @@ ignore_missing_imports = true
201
204
  module = "shellingham"
202
205
  ignore_missing_imports = true
203
206
 
207
+ [[tool.mypy.overrides]]
208
+ module = "dotty_dict"
209
+ ignore_missing_imports = true
210
+
204
211
  [tool.ruff]
205
212
  line-length = 88
206
213
  target-version = "py38"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python-semantic-release
3
- Version: 9.19.1
3
+ Version: 9.21.0
4
4
  Summary: Automatic Semantic Versioning for Python projects
5
5
  Author-email: Rolf Erik Lekang <me@rolflekang.com>
6
6
  License: MIT
@@ -33,6 +33,7 @@ Requires-Dist: importlib-resources~=6.0
33
33
  Requires-Dist: pydantic~=2.0
34
34
  Requires-Dist: rich~=13.0
35
35
  Requires-Dist: shellingham~=1.5
36
+ Requires-Dist: Deprecated~=1.2
36
37
  Provides-Extra: build
37
38
  Requires-Dist: build~=1.2; extra == "build"
38
39
  Provides-Extra: docs
@@ -63,6 +64,7 @@ Requires-Dist: tox~=4.11; extra == "dev"
63
64
  Requires-Dist: ruff==0.6.1; extra == "dev"
64
65
  Provides-Extra: mypy
65
66
  Requires-Dist: mypy==1.15.0; extra == "mypy"
67
+ Requires-Dist: types-Deprecated~=1.2; extra == "mypy"
66
68
  Requires-Dist: types-requests~=2.32.0; extra == "mypy"
67
69
  Requires-Dist: types-pyyaml~=6.0; extra == "mypy"
68
70
 
@@ -98,6 +98,11 @@ src/semantic_release/version/algorithm.py
98
98
  src/semantic_release/version/declaration.py
99
99
  src/semantic_release/version/translator.py
100
100
  src/semantic_release/version/version.py
101
+ src/semantic_release/version/declarations/__init__.py
102
+ src/semantic_release/version/declarations/enum.py
103
+ src/semantic_release/version/declarations/i_version_replacer.py
104
+ src/semantic_release/version/declarations/pattern.py
105
+ src/semantic_release/version/declarations/toml.py
101
106
  tests/__init__.py
102
107
  tests/conftest.py
103
108
  tests/const.py
@@ -196,6 +201,8 @@ tests/unit/semantic_release/hvcs/test_token_auth.py
196
201
  tests/unit/semantic_release/hvcs/test_util.py
197
202
  tests/unit/semantic_release/version/__init__.py
198
203
  tests/unit/semantic_release/version/test_algorithm.py
199
- tests/unit/semantic_release/version/test_declaration.py
200
204
  tests/unit/semantic_release/version/test_translator.py
201
- tests/unit/semantic_release/version/test_version.py
205
+ tests/unit/semantic_release/version/test_version.py
206
+ tests/unit/semantic_release/version/declarations/__init__.py
207
+ tests/unit/semantic_release/version/declarations/test_pattern_declaration.py
208
+ tests/unit/semantic_release/version/declarations/test_toml_declaration.py
@@ -1,3 +1,4 @@
1
1
  [console_scripts]
2
2
  psr = semantic_release.__main__:main
3
+ python-semantic-release = semantic_release.__main__:main
3
4
  semantic-release = semantic_release.__main__:main
@@ -10,6 +10,7 @@ importlib-resources~=6.0
10
10
  pydantic~=2.0
11
11
  rich~=13.0
12
12
  shellingham~=1.5
13
+ Deprecated~=1.2
13
14
 
14
15
  [build]
15
16
  build~=1.2
@@ -27,6 +28,7 @@ furo~=2024.1
27
28
 
28
29
  [mypy]
29
30
  mypy==1.15.0
31
+ types-Deprecated~=1.2
30
32
  types-requests~=2.32.0
31
33
  types-pyyaml~=6.0
32
34
 
@@ -24,7 +24,7 @@ from semantic_release.version import (
24
24
  tags_and_versions,
25
25
  )
26
26
 
27
- __version__ = "9.19.1"
27
+ __version__ = "9.21.0"
28
28
 
29
29
  __all__ = [
30
30
  "CommitParser",
@@ -39,12 +39,12 @@ from semantic_release.version.translator import VersionTranslator
39
39
 
40
40
  if TYPE_CHECKING: # pragma: no cover
41
41
  from pathlib import Path
42
- from typing import Iterable, Mapping
42
+ from typing import Mapping, Sequence
43
43
 
44
44
  from git.refs.tag import Tag
45
45
 
46
46
  from semantic_release.cli.cli_context import CliContextObj
47
- from semantic_release.version.declaration import VersionDeclarationABC
47
+ from semantic_release.version.declaration import IVersionReplacer
48
48
  from semantic_release.version.version import Version
49
49
 
50
50
 
@@ -135,28 +135,43 @@ def version_from_forced_level(
135
135
 
136
136
  def apply_version_to_source_files(
137
137
  repo_dir: Path,
138
- version_declarations: Iterable[VersionDeclarationABC],
138
+ version_declarations: Sequence[IVersionReplacer],
139
139
  version: Version,
140
140
  noop: bool = False,
141
141
  ) -> list[str]:
142
- paths = [
143
- str(declaration.path.resolve().relative_to(repo_dir))
144
- for declaration in version_declarations
142
+ if len(version_declarations) < 1:
143
+ return []
144
+
145
+ if not noop:
146
+ log.debug("Updating version %s in repository files...", version)
147
+
148
+ paths = list(
149
+ map(
150
+ lambda decl, new_version=version, noop=noop: ( # type: ignore[misc]
151
+ decl.update_file_w_version(new_version=new_version, noop=noop)
152
+ ),
153
+ version_declarations,
154
+ )
155
+ )
156
+
157
+ repo_filepaths = [
158
+ str(updated_file.relative_to(repo_dir))
159
+ for updated_file in paths
160
+ if updated_file is not None
145
161
  ]
146
162
 
147
163
  if noop:
148
164
  noop_report(
149
- "would have updated versions in the following paths:"
150
- + "".join(f"\n {path}" for path in paths)
165
+ str.join(
166
+ "",
167
+ [
168
+ "would have updated versions in the following paths:",
169
+ *[f"\n {filepath}" for filepath in repo_filepaths],
170
+ ],
171
+ )
151
172
  )
152
- return paths
153
-
154
- log.debug("writing version %s to source paths %s", version, paths)
155
- for declaration in version_declarations:
156
- new_content = declaration.replace(new_version=version)
157
- declaration.path.write_text(new_content)
158
173
 
159
- return paths
174
+ return repo_filepaths
160
175
 
161
176
 
162
177
  def shell(