python-semantic-release 9.8.2__tar.gz → 9.8.4__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 (155) hide show
  1. {python_semantic_release-9.8.2/python_semantic_release.egg-info → python_semantic_release-9.8.4}/PKG-INFO +4 -4
  2. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/docs/configuration.rst +1 -1
  3. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/pyproject.toml +13 -8
  4. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4/python_semantic_release.egg-info}/PKG-INFO +4 -4
  5. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/python_semantic_release.egg-info/SOURCES.txt +3 -2
  6. python_semantic_release-9.8.4/python_semantic_release.egg-info/entry_points.txt +3 -0
  7. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/python_semantic_release.egg-info/requires.txt +3 -3
  8. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/semantic_release/__init__.py +20 -2
  9. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/semantic_release/__main__.py +1 -1
  10. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/semantic_release/changelog/context.py +25 -1
  11. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/semantic_release/changelog/release_history.py +3 -0
  12. python_semantic_release-9.8.4/semantic_release/cli/changelog_writer.py +169 -0
  13. {python_semantic_release-9.8.2/semantic_release/cli/commands → python_semantic_release-9.8.4/semantic_release/cli}/cli_context.py +7 -3
  14. python_semantic_release-9.8.4/semantic_release/cli/commands/changelog.py +129 -0
  15. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/semantic_release/cli/commands/main.py +32 -2
  16. python_semantic_release-9.8.4/semantic_release/cli/commands/publish.py +101 -0
  17. python_semantic_release-9.8.4/semantic_release/cli/commands/version.py +739 -0
  18. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/semantic_release/cli/config.py +67 -23
  19. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/semantic_release/commit_parser/_base.py +2 -1
  20. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/semantic_release/commit_parser/scipy.py +10 -1
  21. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/semantic_release/commit_parser/token.py +4 -2
  22. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/semantic_release/errors.py +33 -1
  23. python_semantic_release-9.8.4/semantic_release/gitproject.py +254 -0
  24. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/semantic_release/hvcs/bitbucket.py +3 -2
  25. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/semantic_release/hvcs/gitea.py +26 -1
  26. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/semantic_release/hvcs/github.py +26 -1
  27. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/semantic_release/hvcs/gitlab.py +8 -1
  28. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/semantic_release/hvcs/remote_hvcs_base.py +2 -1
  29. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/semantic_release/version/algorithm.py +1 -1
  30. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/tests/command_line/conftest.py +2 -2
  31. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/tests/command_line/test_changelog.py +155 -33
  32. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/tests/command_line/test_generate_config.py +22 -7
  33. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/tests/command_line/test_help.py +21 -15
  34. python_semantic_release-9.8.4/tests/command_line/test_main.py +219 -0
  35. python_semantic_release-9.8.4/tests/command_line/test_publish.py +81 -0
  36. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/tests/command_line/test_version.py +249 -142
  37. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/tests/conftest.py +2 -2
  38. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/tests/const.py +8 -0
  39. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/tests/scenario/test_release_history.py +35 -18
  40. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/tests/scenario/test_template_render.py +1 -1
  41. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/tests/unit/semantic_release/hvcs/test__base.py +5 -4
  42. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/tests/unit/semantic_release/hvcs/test_gitlab.py +1 -1
  43. python_semantic_release-9.8.4/tests/unit/semantic_release/version/__init__.py +0 -0
  44. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/tests/unit/semantic_release/version/test_declaration.py +10 -5
  45. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/tests/util.py +63 -11
  46. python_semantic_release-9.8.2/python_semantic_release.egg-info/entry_points.txt +0 -3
  47. python_semantic_release-9.8.2/semantic_release/cli/__init__.py +0 -10
  48. python_semantic_release-9.8.2/semantic_release/cli/commands/changelog.py +0 -121
  49. python_semantic_release-9.8.2/semantic_release/cli/commands/publish.py +0 -66
  50. python_semantic_release-9.8.2/semantic_release/cli/commands/version.py +0 -782
  51. python_semantic_release-9.8.2/semantic_release/cli/common.py +0 -50
  52. python_semantic_release-9.8.2/tests/command_line/test_main.py +0 -170
  53. python_semantic_release-9.8.2/tests/command_line/test_publish.py +0 -37
  54. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/AUTHORS.rst +0 -0
  55. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/LICENSE +0 -0
  56. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/MANIFEST.in +0 -0
  57. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/README.rst +0 -0
  58. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/docs/Makefile +0 -0
  59. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/docs/algorithm.rst +0 -0
  60. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/docs/automatic-releases/cronjobs.rst +0 -0
  61. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/docs/automatic-releases/github-actions.rst +0 -0
  62. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/docs/automatic-releases/index.rst +0 -0
  63. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/docs/automatic-releases/travis.rst +0 -0
  64. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/docs/changelog_templates.rst +0 -0
  65. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/docs/commands.rst +0 -0
  66. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/docs/commit-parsing.rst +0 -0
  67. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/docs/conf.py +0 -0
  68. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/docs/contributing.rst +0 -0
  69. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/docs/contributors.rst +0 -0
  70. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/docs/github-action.rst +0 -0
  71. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/docs/index.rst +0 -0
  72. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/docs/make.bat +0 -0
  73. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/docs/migrating_from_v7.rst +0 -0
  74. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/docs/multibranch_releases.rst +0 -0
  75. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/docs/strict_mode.rst +0 -0
  76. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/docs/troubleshooting.rst +0 -0
  77. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/python_semantic_release.egg-info/dependency_links.txt +0 -0
  78. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/python_semantic_release.egg-info/top_level.txt +0 -0
  79. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/semantic_release/changelog/__init__.py +0 -0
  80. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/semantic_release/changelog/template.py +0 -0
  81. {python_semantic_release-9.8.2/semantic_release/cli/commands → python_semantic_release-9.8.4/semantic_release/cli}/__init__.py +0 -0
  82. {python_semantic_release-9.8.2/tests → python_semantic_release-9.8.4/semantic_release/cli/commands}/__init__.py +0 -0
  83. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/semantic_release/cli/commands/generate_config.py +0 -0
  84. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/semantic_release/cli/const.py +0 -0
  85. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/semantic_release/cli/github_actions_output.py +0 -0
  86. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/semantic_release/cli/masking_filter.py +0 -0
  87. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/semantic_release/cli/util.py +0 -0
  88. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/semantic_release/commit_parser/__init__.py +0 -0
  89. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/semantic_release/commit_parser/angular.py +0 -0
  90. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/semantic_release/commit_parser/emoji.py +0 -0
  91. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/semantic_release/commit_parser/tag.py +0 -0
  92. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/semantic_release/commit_parser/util.py +0 -0
  93. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/semantic_release/const.py +0 -0
  94. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/semantic_release/data/templates/CHANGELOG.md.j2 +0 -0
  95. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/semantic_release/data/templates/release_notes.md.j2 +0 -0
  96. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/semantic_release/enums.py +0 -0
  97. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/semantic_release/helpers.py +0 -0
  98. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/semantic_release/hvcs/__init__.py +0 -0
  99. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/semantic_release/hvcs/_base.py +0 -0
  100. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/semantic_release/hvcs/token_auth.py +0 -0
  101. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/semantic_release/hvcs/util.py +0 -0
  102. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/semantic_release/version/__init__.py +0 -0
  103. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/semantic_release/version/declaration.py +0 -0
  104. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/semantic_release/version/translator.py +0 -0
  105. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/semantic_release/version/version.py +0 -0
  106. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/setup.cfg +0 -0
  107. {python_semantic_release-9.8.2/tests/command_line → python_semantic_release-9.8.4/tests}/__init__.py +0 -0
  108. {python_semantic_release-9.8.2/tests/scenario → python_semantic_release-9.8.4/tests/command_line}/__init__.py +0 -0
  109. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/tests/fixtures/__init__.py +0 -0
  110. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/tests/fixtures/commit_parsers.py +0 -0
  111. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/tests/fixtures/example_project.py +0 -0
  112. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/tests/fixtures/git_repo.py +0 -0
  113. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/tests/fixtures/repos/__init__.py +0 -0
  114. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/tests/fixtures/repos/git_flow/__init__.py +0 -0
  115. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/tests/fixtures/repos/git_flow/repo_w_2_release_channels.py +0 -0
  116. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/tests/fixtures/repos/git_flow/repo_w_3_release_channels.py +0 -0
  117. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/tests/fixtures/repos/github_flow/__init__.py +0 -0
  118. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/tests/fixtures/repos/github_flow/repo_w_release_channels.py +0 -0
  119. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/tests/fixtures/repos/trunk_based_dev/__init__.py +0 -0
  120. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/tests/fixtures/repos/trunk_based_dev/repo_w_no_tags.py +0 -0
  121. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/tests/fixtures/repos/trunk_based_dev/repo_w_prereleases.py +0 -0
  122. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/tests/fixtures/repos/trunk_based_dev/repo_w_tags.py +0 -0
  123. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/tests/fixtures/scipy.py +0 -0
  124. {python_semantic_release-9.8.2/tests/unit → python_semantic_release-9.8.4/tests/scenario}/__init__.py +0 -0
  125. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/tests/scenario/test_next_version.py +0 -0
  126. {python_semantic_release-9.8.2/tests/unit/semantic_release → python_semantic_release-9.8.4/tests/unit}/__init__.py +0 -0
  127. {python_semantic_release-9.8.2/tests/unit/semantic_release/changelog → python_semantic_release-9.8.4/tests/unit/semantic_release}/__init__.py +0 -0
  128. {python_semantic_release-9.8.2/tests/unit/semantic_release/cli → python_semantic_release-9.8.4/tests/unit/semantic_release/changelog}/__init__.py +0 -0
  129. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/tests/unit/semantic_release/changelog/test_changelog_context.py +0 -0
  130. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/tests/unit/semantic_release/changelog/test_default_changelog.py +0 -0
  131. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/tests/unit/semantic_release/changelog/test_release_notes.py +0 -0
  132. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/tests/unit/semantic_release/changelog/test_template.py +0 -0
  133. {python_semantic_release-9.8.2/tests/unit/semantic_release/commit_parser → python_semantic_release-9.8.4/tests/unit/semantic_release/cli}/__init__.py +0 -0
  134. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/tests/unit/semantic_release/cli/test_config.py +0 -0
  135. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/tests/unit/semantic_release/cli/test_github_actions_output.py +0 -0
  136. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/tests/unit/semantic_release/cli/test_masking_filter.py +0 -0
  137. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/tests/unit/semantic_release/cli/test_util.py +0 -0
  138. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/tests/unit/semantic_release/cli/test_version.py +0 -0
  139. {python_semantic_release-9.8.2/tests/unit/semantic_release/hvcs → python_semantic_release-9.8.4/tests/unit/semantic_release/commit_parser}/__init__.py +0 -0
  140. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/tests/unit/semantic_release/commit_parser/test_angular.py +0 -0
  141. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/tests/unit/semantic_release/commit_parser/test_emoji.py +0 -0
  142. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/tests/unit/semantic_release/commit_parser/test_parsed_commit.py +0 -0
  143. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/tests/unit/semantic_release/commit_parser/test_scipy.py +0 -0
  144. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/tests/unit/semantic_release/commit_parser/test_tag.py +0 -0
  145. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/tests/unit/semantic_release/commit_parser/test_util.py +0 -0
  146. {python_semantic_release-9.8.2/tests/unit/semantic_release/version → python_semantic_release-9.8.4/tests/unit/semantic_release/hvcs}/__init__.py +0 -0
  147. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/tests/unit/semantic_release/hvcs/test_bitbucket.py +0 -0
  148. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/tests/unit/semantic_release/hvcs/test_gitea.py +0 -0
  149. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/tests/unit/semantic_release/hvcs/test_github.py +0 -0
  150. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/tests/unit/semantic_release/hvcs/test_token_auth.py +0 -0
  151. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/tests/unit/semantic_release/hvcs/test_util.py +0 -0
  152. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/tests/unit/semantic_release/test_helpers.py +0 -0
  153. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/tests/unit/semantic_release/version/test_algorithm.py +0 -0
  154. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/tests/unit/semantic_release/version/test_translator.py +0 -0
  155. {python_semantic_release-9.8.2 → python_semantic_release-9.8.4}/tests/unit/semantic_release/version/test_version.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python-semantic-release
3
- Version: 9.8.2
3
+ Version: 9.8.4
4
4
  Summary: Automatic Semantic Versioning for Python projects
5
5
  Author-email: Rolf Erik Lekang <me@rolflekang.com>
6
6
  License: MIT
@@ -55,10 +55,10 @@ Requires-Dist: types-pytest-lazy-fixture~=0.6.3; extra == "test"
55
55
  Provides-Extra: dev
56
56
  Requires-Dist: pre-commit~=3.5; extra == "dev"
57
57
  Requires-Dist: tox~=4.11; extra == "dev"
58
- Requires-Dist: ruff==0.4.4; extra == "dev"
58
+ Requires-Dist: ruff==0.5.0; extra == "dev"
59
59
  Provides-Extra: mypy
60
- Requires-Dist: mypy==1.10.0; extra == "mypy"
61
- Requires-Dist: types-requests~=2.31.0; extra == "mypy"
60
+ Requires-Dist: mypy==1.10.1; extra == "mypy"
61
+ Requires-Dist: types-requests~=2.32.0; extra == "mypy"
62
62
 
63
63
  Python Semantic Release
64
64
  ***********************
@@ -107,7 +107,7 @@ If a setting is not provided, than PSR will fill in the value with the default v
107
107
  Python Semantic Release expects a root level key to start the configuration definition. Make
108
108
  sure to use the correct root key dependending on the configuration format you are using.
109
109
 
110
- .. note:: If you are using ``pyproject.toml``, this heading should include the `tool`` prefix
110
+ .. note:: If you are using ``pyproject.toml``, this heading should include the ``tool`` prefix
111
111
  as specified within PEP 517, resulting in ``[tool.semantic_release]``.
112
112
 
113
113
  .. note:: If you are using a ``releaserc.toml``, use ``[semantic_release]`` as the root key
@@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta"
6
6
 
7
7
  [project]
8
8
  name = "python-semantic-release"
9
- version = "9.8.2"
9
+ version = "9.8.4"
10
10
  description = "Automatic Semantic Versioning for Python projects"
11
11
  requires-python = ">=3.8"
12
12
  license = { text = "MIT" }
@@ -37,8 +37,8 @@ dependencies = [
37
37
  ]
38
38
 
39
39
  [project.scripts]
40
- semantic-release = "semantic_release.cli:main"
41
- psr = "semantic_release.cli:main"
40
+ semantic-release = "semantic_release.cli.commands.main:main"
41
+ psr = "semantic_release.cli.commands.main:main"
42
42
 
43
43
  [project.urls]
44
44
  changelog = "https://github.com/python-semantic-release/python-semantic-release/blob/master/CHANGELOG.md"
@@ -74,11 +74,11 @@ test = [
74
74
  dev = [
75
75
  "pre-commit ~= 3.5",
76
76
  "tox ~= 4.11",
77
- "ruff == 0.4.4"
77
+ "ruff == 0.5.0"
78
78
  ]
79
79
  mypy = [
80
- "mypy == 1.10.0",
81
- "types-requests ~= 2.31.0"
80
+ "mypy == 1.10.1",
81
+ "types-requests ~= 2.32.0",
82
82
  ]
83
83
 
84
84
  [tool.pytest.ini_options]
@@ -156,6 +156,7 @@ show_error_context = true
156
156
  pretty = true
157
157
  error_summary = true
158
158
  follow_imports = "normal"
159
+ enable_error_code = ["ignore-without-code"]
159
160
  ignore_missing_imports = true # gitpython is very dynamic
160
161
  disallow_untyped_calls = true
161
162
  # warn_return_any = true
@@ -222,6 +223,8 @@ ignore = [
222
223
  "DTZ",
223
224
  # flake8-errmsg
224
225
  "EM",
226
+ # Some todos and some examples; leave this disabled for now
227
+ "ERA001",
225
228
  # don't compare types, use isinstance()
226
229
  # sometimes using type(x) == y is deliberately chosen to exclude
227
230
  # subclasses
@@ -234,6 +237,8 @@ ignore = [
234
237
  "INP001",
235
238
  # Errors should end with "Error"
236
239
  "N818",
240
+ # mypy prevents blanket-type-ignore
241
+ "PGH003",
237
242
  # Fixtures that do not return a value need an underscore prefix. The rule
238
243
  # does not handle generators.
239
244
  "PT004",
@@ -282,13 +287,13 @@ ignore = [
282
287
  ]
283
288
 
284
289
  external = ["V"]
285
- ignore-init-module-imports = true
286
290
  task-tags = ["NOTE", "TODO", "FIXME", "XXX"]
287
291
 
288
292
  [tool.ruff.format]
289
- quote-style = "double"
293
+ docstring-code-format = true
290
294
  indent-style = "space"
291
295
  line-ending = "lf"
296
+ quote-style = "double"
292
297
 
293
298
  [tool.ruff.lint.per-file-ignores]
294
299
  # Imported but unused
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python-semantic-release
3
- Version: 9.8.2
3
+ Version: 9.8.4
4
4
  Summary: Automatic Semantic Versioning for Python projects
5
5
  Author-email: Rolf Erik Lekang <me@rolflekang.com>
6
6
  License: MIT
@@ -55,10 +55,10 @@ Requires-Dist: types-pytest-lazy-fixture~=0.6.3; extra == "test"
55
55
  Provides-Extra: dev
56
56
  Requires-Dist: pre-commit~=3.5; extra == "dev"
57
57
  Requires-Dist: tox~=4.11; extra == "dev"
58
- Requires-Dist: ruff==0.4.4; extra == "dev"
58
+ Requires-Dist: ruff==0.5.0; extra == "dev"
59
59
  Provides-Extra: mypy
60
- Requires-Dist: mypy==1.10.0; extra == "mypy"
61
- Requires-Dist: types-requests~=2.31.0; extra == "mypy"
60
+ Requires-Dist: mypy==1.10.1; extra == "mypy"
61
+ Requires-Dist: types-requests~=2.32.0; extra == "mypy"
62
62
 
63
63
  Python Semantic Release
64
64
  ***********************
@@ -36,13 +36,15 @@ semantic_release/__main__.py
36
36
  semantic_release/const.py
37
37
  semantic_release/enums.py
38
38
  semantic_release/errors.py
39
+ semantic_release/gitproject.py
39
40
  semantic_release/helpers.py
40
41
  semantic_release/changelog/__init__.py
41
42
  semantic_release/changelog/context.py
42
43
  semantic_release/changelog/release_history.py
43
44
  semantic_release/changelog/template.py
44
45
  semantic_release/cli/__init__.py
45
- semantic_release/cli/common.py
46
+ semantic_release/cli/changelog_writer.py
47
+ semantic_release/cli/cli_context.py
46
48
  semantic_release/cli/config.py
47
49
  semantic_release/cli/const.py
48
50
  semantic_release/cli/github_actions_output.py
@@ -50,7 +52,6 @@ semantic_release/cli/masking_filter.py
50
52
  semantic_release/cli/util.py
51
53
  semantic_release/cli/commands/__init__.py
52
54
  semantic_release/cli/commands/changelog.py
53
- semantic_release/cli/commands/cli_context.py
54
55
  semantic_release/cli/commands/generate_config.py
55
56
  semantic_release/cli/commands/main.py
56
57
  semantic_release/cli/commands/publish.py
@@ -0,0 +1,3 @@
1
+ [console_scripts]
2
+ psr = semantic_release.cli.commands.main:main
3
+ semantic-release = semantic_release.cli.commands.main:main
@@ -17,7 +17,7 @@ build~=1.2
17
17
  [dev]
18
18
  pre-commit~=3.5
19
19
  tox~=4.11
20
- ruff==0.4.4
20
+ ruff==0.5.0
21
21
 
22
22
  [docs]
23
23
  Sphinx~=6.0
@@ -26,8 +26,8 @@ sphinx-autobuild==2024.2.4
26
26
  furo~=2024.1
27
27
 
28
28
  [mypy]
29
- mypy==1.10.0
30
- types-requests~=2.31.0
29
+ mypy==1.10.1
30
+ types-requests~=2.32.0
31
31
 
32
32
  [test]
33
33
  coverage[toml]~=7.0
@@ -24,7 +24,25 @@ from semantic_release.version import (
24
24
  tags_and_versions,
25
25
  )
26
26
 
27
- __version__ = "9.8.2"
27
+ __version__ = "9.8.4"
28
+
29
+ __all__ = [
30
+ "CommitParser",
31
+ "ParsedCommit",
32
+ "ParseError",
33
+ "ParseResult",
34
+ "ParseResultType",
35
+ "ParserOptions",
36
+ "LevelBump",
37
+ "SemanticReleaseBaseError",
38
+ "CommitParseError",
39
+ "InvalidConfiguration",
40
+ "InvalidVersion",
41
+ "Version",
42
+ "VersionTranslator",
43
+ "next_version",
44
+ "tags_and_versions",
45
+ ]
28
46
 
29
47
 
30
48
  def setup_hook(argv: list[str]) -> None:
@@ -36,6 +54,6 @@ def setup_hook(argv: list[str]) -> None:
36
54
  if len(argv) > 1 and any(
37
55
  cmd in argv for cmd in ["version", "publish", "changelog"]
38
56
  ):
39
- from semantic_release.cli import main
57
+ from semantic_release.cli.commands.main import main
40
58
 
41
59
  main()
@@ -1,6 +1,6 @@
1
1
  import sys
2
2
 
3
- from semantic_release.cli import main
3
+ from semantic_release.cli.commands.main import main
4
4
 
5
5
  if __name__ == "__main__":
6
6
  main(args=sys.argv[1:])
@@ -6,8 +6,32 @@ from typing import TYPE_CHECKING, Any, Callable
6
6
  if TYPE_CHECKING:
7
7
  from jinja2 import Environment
8
8
 
9
- from semantic_release.changelog.release_history import ReleaseHistory
9
+ from semantic_release.changelog.release_history import Release, ReleaseHistory
10
10
  from semantic_release.hvcs._base import HvcsBase
11
+ from semantic_release.version.version import Version
12
+
13
+
14
+ @dataclass
15
+ class ReleaseNotesContext:
16
+ repo_name: str
17
+ repo_owner: str
18
+ hvcs_type: str
19
+ version: Version
20
+ release: Release
21
+ filters: tuple[Callable[..., Any], ...] = ()
22
+
23
+ def bind_to_environment(self, env: Environment) -> Environment:
24
+ env_globals = dict(
25
+ filter(lambda k_v: k_v[0] != "filters", self.__dict__.items())
26
+ )
27
+
28
+ for g, v in env_globals.items():
29
+ env.globals[g] = v
30
+
31
+ for f in self.filters:
32
+ env.filters[f.__name__] = f
33
+
34
+ return env
11
35
 
12
36
 
13
37
  @dataclass
@@ -99,6 +99,7 @@ class ReleaseHistory:
99
99
  committer=committer,
100
100
  tagged_date=tagged_date,
101
101
  elements=defaultdict(list),
102
+ version=the_version,
102
103
  )
103
104
 
104
105
  released.setdefault(the_version, release)
@@ -165,6 +166,7 @@ class ReleaseHistory:
165
166
  "committer": committer,
166
167
  "tagged_date": tagged_date,
167
168
  "elements": self.unreleased,
169
+ "version": version,
168
170
  },
169
171
  **self.released,
170
172
  },
@@ -183,3 +185,4 @@ class Release(TypedDict):
183
185
  committer: Actor
184
186
  tagged_date: datetime
185
187
  elements: dict[str, list[ParseResult]]
188
+ version: Version
@@ -0,0 +1,169 @@
1
+ from __future__ import annotations
2
+
3
+ from logging import getLogger
4
+ from os import listdir
5
+ from pathlib import Path
6
+ from typing import TYPE_CHECKING
7
+
8
+ # NOTE: use backport with newer API than stdlib
9
+ from importlib_resources import files
10
+
11
+ from semantic_release.changelog.context import (
12
+ ReleaseNotesContext,
13
+ make_changelog_context,
14
+ )
15
+ from semantic_release.changelog.template import environment, recursive_render
16
+ from semantic_release.cli.util import noop_report
17
+
18
+ if TYPE_CHECKING:
19
+ from jinja2 import Environment
20
+
21
+ from semantic_release.changelog.release_history import Release, ReleaseHistory
22
+ from semantic_release.cli.config import RuntimeContext
23
+ from semantic_release.hvcs._base import HvcsBase
24
+
25
+
26
+ log = getLogger(__name__)
27
+
28
+
29
+ def get_release_notes_template(template_dir: Path) -> str:
30
+ """Read the project's template for release notes, falling back to the default."""
31
+ fname = template_dir / ".release_notes.md.j2"
32
+ try:
33
+ return fname.read_text(encoding="utf-8")
34
+ except FileNotFoundError:
35
+ return (
36
+ files("semantic_release")
37
+ .joinpath("data/templates/release_notes.md.j2")
38
+ .read_text(encoding="utf-8")
39
+ )
40
+
41
+
42
+ def render_default_changelog_file(template_env: Environment) -> str:
43
+ changelog_text = (
44
+ files("semantic_release")
45
+ .joinpath("data/templates/CHANGELOG.md.j2")
46
+ .read_text(encoding="utf-8")
47
+ )
48
+ template = template_env.from_string(changelog_text)
49
+ return template.render().rstrip()
50
+
51
+
52
+ def render_release_notes(
53
+ release_notes_template: str,
54
+ template_env: Environment,
55
+ ) -> str:
56
+ template = template_env.from_string(release_notes_template)
57
+ return template.render().rstrip()
58
+
59
+
60
+ def apply_user_changelog_template_directory(
61
+ template_dir: Path,
62
+ environment: Environment,
63
+ destination_dir: Path,
64
+ noop: bool = False,
65
+ ) -> list[str]:
66
+ if noop:
67
+ noop_report(
68
+ str.join(
69
+ " ",
70
+ [
71
+ "would have recursively rendered the template directory",
72
+ f"{template_dir!r} relative to {destination_dir!r}.",
73
+ "Paths which would be modified by this operation cannot be",
74
+ "determined in no-op mode.",
75
+ ],
76
+ )
77
+ )
78
+ return []
79
+
80
+ return recursive_render(
81
+ template_dir, environment=environment, _root_dir=destination_dir
82
+ )
83
+
84
+
85
+ def write_default_changelog(
86
+ changelog_file: Path,
87
+ destination_dir: Path,
88
+ environment: Environment,
89
+ noop: bool = False,
90
+ ) -> str:
91
+ if noop:
92
+ noop_report(
93
+ str.join(
94
+ " ",
95
+ [
96
+ "would have written your changelog to",
97
+ str(changelog_file.relative_to(destination_dir)),
98
+ ],
99
+ )
100
+ )
101
+ else:
102
+ changelog_text = render_default_changelog_file(environment)
103
+ changelog_file.write_text(f"{changelog_text}\n", encoding="utf-8")
104
+
105
+ return str(changelog_file)
106
+
107
+
108
+ def write_changelog_files(
109
+ runtime_ctx: RuntimeContext,
110
+ release_history: ReleaseHistory,
111
+ hvcs_client: HvcsBase,
112
+ noop: bool = False,
113
+ ) -> list[str]:
114
+ project_dir = Path(runtime_ctx.repo_dir)
115
+ template_dir = runtime_ctx.template_dir
116
+
117
+ changelog_context = make_changelog_context(
118
+ hvcs_client=hvcs_client,
119
+ release_history=release_history,
120
+ )
121
+
122
+ changelog_context.bind_to_environment(runtime_ctx.template_environment)
123
+
124
+ use_user_template_dir = bool(
125
+ # Directory exists and directory is not empty
126
+ template_dir.exists() and template_dir.is_dir() and listdir(template_dir)
127
+ )
128
+
129
+ if use_user_template_dir:
130
+ return apply_user_changelog_template_directory(
131
+ template_dir=template_dir,
132
+ environment=runtime_ctx.template_environment,
133
+ destination_dir=project_dir,
134
+ noop=noop,
135
+ )
136
+
137
+ log.info("No contents found in %r, using default changelog template", template_dir)
138
+ return [
139
+ write_default_changelog(
140
+ changelog_file=runtime_ctx.changelog_file,
141
+ destination_dir=project_dir,
142
+ environment=runtime_ctx.template_environment,
143
+ noop=noop,
144
+ )
145
+ ]
146
+
147
+
148
+ def generate_release_notes(
149
+ hvcs_client: HvcsBase,
150
+ release: Release,
151
+ template_dir: Path,
152
+ ) -> str:
153
+ release_notes_env = ReleaseNotesContext(
154
+ repo_name=hvcs_client.repo_name,
155
+ repo_owner=hvcs_client.owner,
156
+ hvcs_type=hvcs_client.__class__.__name__.lower(),
157
+ version=release["version"],
158
+ release=release,
159
+ filters=(*hvcs_client.get_changelog_context_filters(),),
160
+ ).bind_to_environment(
161
+ # Use a new, non-configurable environment for release notes -
162
+ # not user-configurable at the moment
163
+ environment(template_dir=template_dir)
164
+ )
165
+
166
+ return render_release_notes(
167
+ release_notes_template=get_release_notes_template(template_dir),
168
+ template_env=release_notes_env,
169
+ )
@@ -14,7 +14,11 @@ from semantic_release.cli.config import (
14
14
  RuntimeContext,
15
15
  )
16
16
  from semantic_release.cli.util import load_raw_config_file, rprint
17
- from semantic_release.errors import InvalidConfiguration, NotAReleaseBranch
17
+ from semantic_release.errors import (
18
+ DetachedHeadGitError,
19
+ InvalidConfiguration,
20
+ NotAReleaseBranch,
21
+ )
18
22
 
19
23
  if TYPE_CHECKING:
20
24
  from semantic_release.cli.config import GlobalCommandLineOptions
@@ -58,7 +62,7 @@ class CliContextObj:
58
62
 
59
63
  try:
60
64
  if was_conf_file_user_provided and not conf_file_exists:
61
- raise FileNotFoundError(
65
+ raise FileNotFoundError( # noqa: TRY301
62
66
  f"File {self.global_opts.config_file} does not exist"
63
67
  )
64
68
 
@@ -75,7 +79,7 @@ class CliContextObj:
75
79
  raw_config,
76
80
  global_cli_options=self.global_opts,
77
81
  )
78
- except NotAReleaseBranch as exc:
82
+ except (DetachedHeadGitError, NotAReleaseBranch) as exc:
79
83
  rprint(f"[bold {'red' if self.global_opts.strict else 'orange1'}]{exc!s}")
80
84
  # If not strict, exit 0 so other processes can continue. For example, in
81
85
  # multibranch CI it might be desirable to run a non-release branch's pipeline
@@ -0,0 +1,129 @@
1
+ from __future__ import annotations
2
+
3
+ import logging
4
+ from typing import TYPE_CHECKING
5
+
6
+ import click
7
+ from git import Repo
8
+
9
+ from semantic_release.changelog import ReleaseHistory
10
+ from semantic_release.cli.changelog_writer import (
11
+ generate_release_notes,
12
+ write_changelog_files,
13
+ )
14
+ from semantic_release.cli.util import noop_report
15
+ from semantic_release.hvcs.remote_hvcs_base import RemoteHvcsBase
16
+
17
+ if TYPE_CHECKING:
18
+ from semantic_release.cli.cli_context import CliContextObj
19
+
20
+
21
+ log = logging.getLogger(__name__)
22
+
23
+
24
+ def post_release_notes(
25
+ release_tag: str,
26
+ release_notes: str,
27
+ prerelease: bool,
28
+ hvcs_client: RemoteHvcsBase,
29
+ noop: bool = False,
30
+ ) -> None:
31
+ if noop:
32
+ noop_report(
33
+ str.join(
34
+ "\n",
35
+ [
36
+ f"would have posted the following release notes for tag {release_tag}:",
37
+ release_notes,
38
+ ],
39
+ )
40
+ )
41
+ return
42
+
43
+ hvcs_client.create_or_update_release(
44
+ release_tag, f"{release_notes}\n", prerelease=prerelease
45
+ )
46
+
47
+
48
+ @click.command(
49
+ short_help="Generate a changelog",
50
+ context_settings={
51
+ "help_option_names": ["-h", "--help"],
52
+ },
53
+ )
54
+ @click.option(
55
+ "--post-to-release-tag",
56
+ "release_tag",
57
+ default=None,
58
+ help="Post the generated release notes to the remote VCS's release for this tag",
59
+ )
60
+ @click.pass_obj
61
+ def changelog(cli_ctx: CliContextObj, release_tag: str | None) -> None:
62
+ """Generate and optionally publish a changelog for your project"""
63
+ ctx = click.get_current_context()
64
+ runtime = cli_ctx.runtime_ctx
65
+ translator = runtime.version_translator
66
+ hvcs_client = runtime.hvcs_client
67
+
68
+ with Repo(str(runtime.repo_dir)) as git_repo:
69
+ release_history = ReleaseHistory.from_git_history(
70
+ repo=git_repo,
71
+ translator=translator,
72
+ commit_parser=runtime.commit_parser,
73
+ exclude_commit_patterns=runtime.changelog_excluded_commit_patterns,
74
+ )
75
+
76
+ write_changelog_files(
77
+ runtime_ctx=runtime,
78
+ release_history=release_history,
79
+ hvcs_client=hvcs_client,
80
+ noop=runtime.global_cli_options.noop,
81
+ )
82
+
83
+ if not release_tag:
84
+ return
85
+
86
+ if not isinstance(hvcs_client, RemoteHvcsBase):
87
+ click.echo(
88
+ "Remote does not support releases. Skipping release notes update...",
89
+ err=True,
90
+ )
91
+ return
92
+
93
+ if not (version := translator.from_tag(release_tag)):
94
+ click.echo(
95
+ str.join(
96
+ " ",
97
+ [
98
+ f"Tag {release_tag!r} does not match the tag format",
99
+ repr(translator.tag_format),
100
+ ],
101
+ ),
102
+ err=True,
103
+ )
104
+ ctx.exit(1)
105
+
106
+ try:
107
+ release = release_history.released[version]
108
+ except KeyError:
109
+ click.echo(f"tag {release_tag} not in release history", err=True)
110
+ ctx.exit(2)
111
+
112
+ release_notes = generate_release_notes(
113
+ hvcs_client,
114
+ release,
115
+ template_dir=runtime.template_dir,
116
+ )
117
+
118
+ try:
119
+ post_release_notes(
120
+ release_tag=release_tag,
121
+ release_notes=release_notes,
122
+ prerelease=version.is_prerelease,
123
+ hvcs_client=hvcs_client,
124
+ noop=runtime.global_cli_options.noop,
125
+ )
126
+ except Exception as e:
127
+ log.exception(e)
128
+ click.echo("Failed to post release notes to remote", err=True)
129
+ ctx.exit(1)
@@ -1,6 +1,8 @@
1
1
  from __future__ import annotations
2
2
 
3
+ import importlib
3
4
  import logging
5
+ from enum import Enum
4
6
 
5
7
  # from typing import TYPE_CHECKING
6
8
  import click
@@ -8,7 +10,7 @@ from rich.console import Console
8
10
  from rich.logging import RichHandler
9
11
 
10
12
  import semantic_release
11
- from semantic_release.cli.commands.cli_context import CliContextObj
13
+ from semantic_release.cli.cli_context import CliContextObj
12
14
  from semantic_release.cli.config import GlobalCommandLineOptions
13
15
  from semantic_release.cli.const import DEFAULT_CONFIG_FILE
14
16
  from semantic_release.cli.util import rprint
@@ -20,7 +22,35 @@ from semantic_release.cli.util import rprint
20
22
  FORMAT = "[%(name)s] %(levelname)s %(module)s.%(funcName)s: %(message)s"
21
23
 
22
24
 
23
- @click.group(
25
+ class Cli(click.MultiCommand):
26
+ """Root MultiCommand for the semantic-release CLI"""
27
+
28
+ class SubCmds(Enum):
29
+ """Subcommand import definitions"""
30
+
31
+ # SUBCMD_FUNCTION_NAME => MODULE_WITH_FUNCTION
32
+ CHANGELOG = f"{__package__}.changelog"
33
+ GENERATE_CONFIG = f"{__package__}.generate_config"
34
+ VERSION = f"{__package__}.version"
35
+ PUBLISH = f"{__package__}.publish"
36
+
37
+ def list_commands(self, _ctx: click.Context) -> list[str]:
38
+ # Used for shell-completion
39
+ return [subcmd.lower().replace("_", "-") for subcmd in Cli.SubCmds.__members__]
40
+
41
+ def get_command(self, _ctx: click.Context, name: str) -> click.Command | None:
42
+ subcmd_name = name.lower().replace("-", "_")
43
+ try:
44
+ subcmd_def: Cli.SubCmds = Cli.SubCmds.__dict__[subcmd_name.upper()]
45
+ module_path = subcmd_def.value
46
+ subcmd_module = importlib.import_module(module_path)
47
+ return getattr(subcmd_module, subcmd_name)
48
+ except (KeyError, ModuleNotFoundError, AttributeError):
49
+ return None
50
+
51
+
52
+ @click.command(
53
+ cls=Cli,
24
54
  context_settings={
25
55
  "help_option_names": ["-h", "--help"],
26
56
  },