From 9ca7fe2cf5b72151c7e36433bb7949a947e323ce Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 9 Feb 2025 22:26:38 -0700 Subject: [PATCH 1/8] ci(deps): bump `python-semantic-release/publish-action@v9.18.1` to 9.19.0 (#1178) --- .github/workflows/cicd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml index 8ad586c6a..016c553a4 100644 --- a/.github/workflows/cicd.yml +++ b/.github/workflows/cicd.yml @@ -138,7 +138,7 @@ jobs: build: false - name: Release | Add distribution artifacts to GitHub Release Assets - uses: python-semantic-release/publish-action@v9.18.1 + uses: python-semantic-release/publish-action@v9.19.0 with: github_token: ${{ secrets.GITHUB_TOKEN }} tag: ${{ steps.release.outputs.tag }} From 249f37acc20a7334ff7a216b92b3970deabbae7a Mon Sep 17 00:00:00 2001 From: codejedi365 Date: Sun, 9 Feb 2025 23:55:24 -0700 Subject: [PATCH 2/8] chore(config): change psr parser over to conventional-commits (#1179) --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index ee97f49ea..31eef872b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -398,7 +398,7 @@ ignore_names = ["change_to_ex_proj_dir", "init_example_project"] [tool.semantic_release] logging_use_named_masks = true -commit_parser = "angular" +commit_parser = "conventional" commit_parser_options = { parse_squash_commits = true, ignore_merge_commits = true } build_command = """ python -m pip install -e .[build] From ca42dbfffe54c2f2b96dae595012259a92893f38 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 10 Feb 2025 23:57:06 -0700 Subject: [PATCH 3/8] build(deps-dev): bump `mypy` from 1.14.1 to 1.15.0 (#1181) * chore(pre-commit): bump `mypy-plugin` from 1.14.0 to 1.15.0 --- .pre-commit-config.yaml | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 70e871f44..f80f12a05 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -50,7 +50,7 @@ repos: name: ruff (format) - repo: https://github.com/pre-commit/mirrors-mypy - rev: "v1.14.0" + rev: "v1.15.0" hooks: - id: mypy additional_dependencies: diff --git a/pyproject.toml b/pyproject.toml index 31eef872b..c6e99d898 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -82,7 +82,7 @@ dev = [ "ruff == 0.6.1" ] mypy = [ - "mypy == 1.14.1", + "mypy == 1.15.0", "types-requests ~= 2.32.0", "types-pyyaml ~= 6.0", ] From e8343eeb38d3b4e18953ac0f97538df396d22b76 Mon Sep 17 00:00:00 2001 From: codejedi365 Date: Sun, 6 Oct 2024 23:00:38 -0600 Subject: [PATCH 4/8] docs(automatic-releases): declutter the table of contents for automatic release guides --- docs/automatic-releases/index.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/automatic-releases/index.rst b/docs/automatic-releases/index.rst index 8fd44b1bf..c5e6d3453 100644 --- a/docs/automatic-releases/index.rst +++ b/docs/automatic-releases/index.rst @@ -13,6 +13,8 @@ Guides ^^^^^^ .. toctree:: + :maxdepth: 2 + travis github-actions cronjobs From 55d4a05ff56321cf9874f8f302fbe7e5163ad4f7 Mon Sep 17 00:00:00 2001 From: codejedi365 Date: Sun, 9 Feb 2025 20:48:33 -0700 Subject: [PATCH 5/8] docs: fix spelling errors & inaccurate descriptions --- CHANGELOG.rst | 34 +++++++++++++++++----------------- docs/algorithm.rst | 2 +- docs/changelog_templates.rst | 6 +++--- docs/commands.rst | 9 +++++---- docs/configuration.rst | 15 +++++++-------- docs/index.rst | 2 +- docs/multibranch_releases.rst | 6 +++--- docs/strict_mode.rst | 2 +- docs/troubleshooting.rst | 5 ++--- 9 files changed, 40 insertions(+), 41 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 303e0d149..f2bc511ae 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -99,7 +99,7 @@ v9.18.0 (2025-02-06) * **vcs-github**: Add ``create_release_url`` & ``format_w_official_vcs_name`` filter functions (`PR#1161`_, `f853cf0`_) -* **vcs-gitlab**: Add ``create_release_url`` & ``format_w_official_vcs_name`` filter functiions +* **vcs-gitlab**: Add ``create_release_url`` & ``format_w_official_vcs_name`` filter functions (`PR#1161`_, `f853cf0`_) 🪲 Bug Fixes @@ -491,7 +491,7 @@ v9.14.0 (2024-11-11) 🪲 Bug Fixes ------------ -* **release-notes**: Override default wordwrap to non-wrap for in default template (`99ab99b`_) +* **release-notes**: Override default word-wrap to non-wrap for in default template (`99ab99b`_) 📖 Documentation ---------------- @@ -548,7 +548,7 @@ v9.13.0 (2024-11-10) * **parser-angular**: Drop the ``breaking`` category but still maintain a major level bump (`f1ffa54`_) -* **parsers**: Improve reliability of text unwordwrap of descriptions (`436374b`_) +* **parsers**: Improve reliability of descriptions after reverse word-wrap (`436374b`_) ⚡ Performance Improvements --------------------------- @@ -871,7 +871,7 @@ v9.9.0 (2024-09-28) 📖 Documentation ---------------- -* **automatic-releases**: Drop extrenous github push configuration (`PR#1011`_, `2135c68`_) +* **automatic-releases**: Drop extraneous github push configuration (`PR#1011`_, `2135c68`_) * **github-actions**: Add configuration & description of publish action (`PR#1011`_, `2135c68`_) @@ -1066,7 +1066,7 @@ v9.8.4 (2024-07-04) 🪲 Bug Fixes ------------ -* **changelog-cmd**: Remove usage strings when error occured, closes `#810`_ (`348a51d`_) +* **changelog-cmd**: Remove usage strings when error occurred, closes `#810`_ (`348a51d`_) * **changelog-cmd**: Render default changelog when user template directory exist but is empty (`bded8de`_) @@ -1077,7 +1077,7 @@ v9.8.4 (2024-07-04) * **publish-cmd**: Prevent error when provided tag does not exist locally (`16afbbb`_) -* **publish-cmd**: Remove usage strings when error occured, closes `#810`_ (`afbb187`_) +* **publish-cmd**: Remove usage strings when error occurred, closes `#810`_ (`afbb187`_) * **version-cmd**: Remove usage strings when error occurred, closes `#810`_ (`a7c17c7`_) @@ -1192,7 +1192,7 @@ v9.7.3 (2024-05-15) 🪲 Bug Fixes ------------ -* Enabled ``prelease-token`` parameter in github action (`PR#929`_, `1bb26b0`_) +* Enabled ``prerelease-token`` parameter in github action (`PR#929`_, `1bb26b0`_) .. _1bb26b0: https://github.com/python-semantic-release/python-semantic-release/commit/1bb26b0762d94efd97c06a3f1b6b10fb76901f6d .. _PR#929: https://github.com/python-semantic-release/python-semantic-release/pull/929 @@ -1705,7 +1705,7 @@ v8.7.1 (2024-01-03) 📖 Documentation ---------------- -* Add note on default envvar behaviour (`PR#780`_, `0b07cae`_) +* Add note on default envvar behavior (`PR#780`_, `0b07cae`_) * **configuration**: Change defaults definition of token default to table (`PR#786`_, `df1df0d`_) @@ -2034,7 +2034,7 @@ v8.0.3 (2023-07-21) 🪲 Bug Fixes ------------ -* Skip unparseable versions when calculating next version (`PR#649`_, `88f25ea`_) +* Skip non-parsable versions when calculating next version (`PR#649`_, `88f25ea`_) .. _88f25ea: https://github.com/python-semantic-release/python-semantic-release/commit/88f25eae62589cdf53dbc3dfcb167a3ae6cba2d3 .. _PR#649: https://github.com/python-semantic-release/python-semantic-release/pull/649 @@ -2105,7 +2105,7 @@ v8.0.0 (2023-07-16) * Make it easier to access commit messages in ParsedCommits (`PR#619`_, `ec30564`_) -* Remove publication of dists to artifact repository (`PR#619`_, `ec30564`_) +* Remove publication of ``dists/`` to artifact repository (`PR#619`_, `ec30564`_) * Rename 'upload' configuration section to 'publish' (`PR#619`_, `ec30564`_) @@ -2138,7 +2138,7 @@ v8.0.0 (2023-07-16) * Only call Github Action output callback once defaults are set (`PR#619`_, `ec30564`_) -* Remove commit amending behaviour (`PR#619`_, `ec30564`_) +* Remove commit amending behavior (`PR#619`_, `ec30564`_) * Resolve branch checkout logic in GHA (`PR#619`_, `ec30564`_) @@ -2405,7 +2405,7 @@ v7.33.0 (2023-01-15) 📖 Documentation ---------------- -* Update documentaton (`5cbdad2`_) +* Update documentation (`5cbdad2`_) .. _#521: https://github.com/python-semantic-release/python-semantic-release/issues/521 .. _#533: https://github.com/python-semantic-release/python-semantic-release/issues/533 @@ -2478,7 +2478,7 @@ v7.32.0 (2022-09-25) 📖 Documentation ---------------- -* Correct documented default behaviour for ``commit_version_number`` (`PR#497`_, `ffae2dc`_) +* Correct documented default behavior for ``commit_version_number`` (`PR#497`_, `ffae2dc`_) .. _#498: https://github.com/python-semantic-release/python-semantic-release/issues/498 .. _988437d: https://github.com/python-semantic-release/python-semantic-release/commit/988437d21e40d3e3b1c95ed66b535bdd523210de @@ -2796,7 +2796,7 @@ v7.27.1 (2022-04-03) 🪲 Bug Fixes ------------ -* **prerelase**: Pass prerelease option to get_current_version (`PR#432`_, `aabab0b`_) +* **prerelease**: Pass prerelease option to get_current_version (`PR#432`_, `aabab0b`_) .. _aabab0b: https://github.com/python-semantic-release/python-semantic-release/commit/aabab0b7ce647d25e0c78ae6566f1132ece9fcb9 .. _PR#432: https://github.com/python-semantic-release/python-semantic-release/pull/432 @@ -4079,7 +4079,7 @@ v5.0.0 (2020-03-22) 📖 Documentation ---------------- -* **pypi**: Update docstings in pypi.py (`6502d44`_) +* **pypi**: Update docstrings in pypi.py (`6502d44`_) 💥 BREAKING CHANGES ------------------- @@ -5237,7 +5237,7 @@ v2.1.0 (2015-08-20) ✨ Features ----------- -* **cli**: Add the possibility to repost the changelog (`4d028e2`_) +* **cli**: Add the possibility to re-post the changelog (`4d028e2`_) 🪲 Bug Fixes ------------ @@ -5292,7 +5292,7 @@ v2.0.0 (2015-08-19) 💥 BREAKING CHANGES ------------------- -* **history**: The default parser is now angular. Thus, the default behaviour of the commit log +* **history**: The default parser is now angular. Thus, the default behavior of the commit log evaluator will change. From now on it will use the angular commit message spec to determine the new version. diff --git a/docs/algorithm.rst b/docs/algorithm.rst index b6797bb4f..4ea9fa6dd 100644 --- a/docs/algorithm.rst +++ b/docs/algorithm.rst @@ -35,7 +35,7 @@ Implementation 1. Parse all the Git tags of the repository into semantic versions, and **sort** in descending (most recent first) order according to `semver precedence`_. - Ignore any tags which do not correspond to valid semantic vesrions according + Ignore any tags which do not correspond to valid semantic versions according to ``tag_format``. diff --git a/docs/changelog_templates.rst b/docs/changelog_templates.rst index 08f5eec78..1b6e5fc7d 100644 --- a/docs/changelog_templates.rst +++ b/docs/changelog_templates.rst @@ -49,7 +49,7 @@ PSR provides two default changelog output formats: Both formats are kept in sync with one another to display the equivalent information in the respective format. The default changelog template is located in the ``data/templates/`` directory within the PSR package. The templates are written in -modular style (ie. multiple files) and during the render proccess are ultimately +modular style (ie. multiple files) and during the render process are ultimately combined together to render the final changelog output. The rendering start point is the ``CHANGELOG.{FORMAT_EXT}.j2`` underneath the respective format directory. @@ -144,7 +144,7 @@ newly created changelog file. .. tip:: We have accomplished changelog updating through the use of the `Jinja`_ templating - and addtional context filters and context variables. This is notable because + and additional context filters and context variables. This is notable because in the case that you want to customize your changelog template, you now can use the same logic to enable changelog updates of your custom template! @@ -1220,7 +1220,7 @@ __ https://github.com/python-semantic-release/python-semantic-release/tree/maste maintain any content that should be included before the new release information. See ``data/templates/*/md/.components/changelog_update.md.j2`` for reference. -5. **Print your insertion flag.** This is impartive to ensure that the resulting +5. **Print your insertion flag.** This is imperative to ensure that the resulting changelog can be updated in the future. See ``data/templates/*/md/.components/changelog_update.md.j2`` for reference. diff --git a/docs/commands.rst b/docs/commands.rst index 66c01eff2..e7e8e5f21 100644 --- a/docs/commands.rst +++ b/docs/commands.rst @@ -272,8 +272,8 @@ the flag. This can be useful when making a single prerelease on a branch that would typically release normal versions. -If not specified in :ref:`cmd-version-option-prerelease-token`, the prerelease token is idenitified using the -:ref:`Multibranch Release Configuration ` +If not specified in :ref:`cmd-version-option-prerelease-token`, the prerelease token is identified +using the :ref:`Multibranch Release Configuration ` See the examples alongside :ref:`cmd-version-option-force-level` for how to use this flag. @@ -282,8 +282,9 @@ See the examples alongside :ref:`cmd-version-option-force-level` for how to use ``--prerelease-token [VALUE]`` ****************************** -Force the next version to use the value as the prerelease token. This overrides the configured value if one is -present. If not used during a release producing a prerelease version, this option has no effect. +Force the next version to use the value as the prerelease token. This overrides the configured +value if one is present. If not used during a release producing a prerelease version, this +option has no effect. .. _cmd-version-option-build-metadata: diff --git a/docs/configuration.rst b/docs/configuration.rst index 9163f11d8..a777c8f21 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -88,9 +88,12 @@ environment variable is: default = "default value" In this structure: + * ``env`` represents the environment variable that Python Semantic Release will search for + * ``default_env`` is a fallback environment variable to read in case the variable specified by ``env`` is not set. This is optional - if not specified then no fallback will be used. + * ``default`` is a default value to use in case the environment variable specified by ``env`` is not set. This is optional - if ``default`` is not specified then the environment variable specified by ``env`` is considered required. @@ -105,7 +108,7 @@ configuration setting. If there are type mis-matches, PSR will throw validation If a setting is not provided, than PSR will fill in the value with the default value. Python Semantic Release expects a root level key to start the configuration definition. Make -sure to use the correct root key dependending on the configuration format you are using. +sure to use the correct root key depending on the configuration format you are using. .. note:: If you are using ``pyproject.toml``, this heading should include the ``tool`` prefix as specified within PEP 517, resulting in ``[tool.semantic_release]``. @@ -405,7 +408,7 @@ This setting is used to specify the output format the default changelog template will use when rendering the changelog. PSR supports both Markdown (``md``) and reStructuredText (``rst``) formats. -This setting will take presendence over the file extension of the +This setting will take precedence over the file extension of the :ref:`config-changelog-default_templates-changelog_file` setting. If this setting is omitted, the file extension of the :ref:`config-changelog-default_templates-changelog_file` setting will be used to determine the output format. If the file extension is not recognized, @@ -695,10 +698,6 @@ A string that will be used to identify where the new version should be inserted changelog file (as defined by :ref:`config-changelog-changelog_file`) when the changelog mode is set to ``update``. -When the changelog mode is set to ``init``, this string will be included as part of the -header of the changelog file to initialize the changelog with a format that will be condusive -for future version insertions. - If you modify this value in your config, you will need to manually update any saved changelog file to match the new insertion flag if you use the ``update`` mode. In ``init`` mode, the changelog file will be overwritten as normal. @@ -965,7 +964,7 @@ calls rather than the primary domain (ex. ``api.github.com``). **Most on-premise HVCS installations will NOT use this setting!** Whether or not this value is used depends on the HVCS configured (and your server administration) -in the :ref:`remote.type ` setting and used in tadem with the +in the :ref:`remote.type ` setting and used in tandem with the :ref:`remote.domain ` setting. When using a custom :ref:`remote.domain ` and a HVCS @@ -1058,7 +1057,7 @@ used for the connection. If the protocol scheme is provided in the field value, match this setting or it will throw an error. The purpose of this flag is to prevent any typos in provided ``domain`` and ``api_domain`` -values that accidently specify an insecure connection but allow users to toggle the protection +values that accidentally specify an insecure connection but allow users to toggle the protection scheme off when desired. **Default:** ``false`` diff --git a/docs/index.rst b/docs/index.rst index 16eaabec0..f8273c5b7 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -219,7 +219,7 @@ and changelogs. The user has three options to push changes to the repository: - :ref:`Changelog ` - customize your project's changelog. - :ref:`changelog-templates-custom_release_notes` - customize the published release notes - :ref:`upload_to_vcs_release ` - - enable/disable uploading artefacts to VCS releases + enable/disable uploading artifacts to VCS releases - :ref:`version --vcs-release/--no-vcs-release ` - enable/disable VCS release creation. - `upload-to-gh-release`_, a GitHub Action for running ``semantic-release publish`` diff --git a/docs/multibranch_releases.rst b/docs/multibranch_releases.rst index 97574be6d..276561a35 100644 --- a/docs/multibranch_releases.rst +++ b/docs/multibranch_releases.rst @@ -45,12 +45,12 @@ a situation may occur in the following scenario: Suppose that Python Semantic Release has been configured to use the same prerelease token ``"alpha"`` for all ``feature-*`` branches, and the default tag format ``"v{version}"``. In this case, running a pre-release from branch ``feature-1`` -will recognise that since the last release, ``1.1.0``, a **feature** has been +will recognize that since the last release, ``1.1.0``, a **feature** has been introduced and therefore the next tag to be applied to ``feature-1`` will be ``v1.2.0-alpha.1``. However, suppose we then try to run a release against ``feature-2``. This will also -recognise that a **feature** has been introduced against the last released version of +recognize that a **feature** has been introduced against the last released version of ``v1.1.0`` and therefore will try to create the tag ``v1.2.0-alpha.1``, leading to an error as this tag was already created against ``feature-1``. @@ -91,7 +91,7 @@ Each release group is configured as a nested mapping under the ``tool.semantic_release.branches`` key in ``pyproject.toml``, or the equivalent structure in other formats. the mapping requires a single key that is used as a name for the release group, which can help to identify it in log messages but has -no effect on the behaviour of the release. For example, Python Semantic Release has +no effect on the behavior of the release. For example, Python Semantic Release has only one release group by default with the name ``main``. Inside each release group, the following key-value pairs can be set: diff --git a/docs/strict_mode.rst b/docs/strict_mode.rst index 4172855b6..475398244 100644 --- a/docs/strict_mode.rst +++ b/docs/strict_mode.rst @@ -4,7 +4,7 @@ Strict Mode =========== Strict Mode is enabled by use of the :ref:`strict ` parameter -to the main command for Python Semantic Release. Strict Mode alters the behaviour of +to the main command for Python Semantic Release. Strict Mode alters the behavior of Python Semantic Release when certain conditions are encountered that prevent Python Semantic Release from performing an action. Typically, this will result in a warning becoming an error, or a different exit code (0 vs non-zero) being produced when Python diff --git a/docs/troubleshooting.rst b/docs/troubleshooting.rst index 04e9c6331..d001104d4 100644 --- a/docs/troubleshooting.rst +++ b/docs/troubleshooting.rst @@ -10,7 +10,8 @@ Troubleshooting .. _troubleshooting-verbosity: Increasing Verbosity -==================== +-------------------- + If you are having trouble with Python Semantic Release or would like to see additional information about the actions that it is taking, you can use the top-level :ref:`cmd-main-option-verbosity` option. This can be supplied multiple times to increase @@ -24,12 +25,10 @@ For example:: semantic-release -vv version --print - .. note:: The :ref:`cmd-main-option-verbosity` option must be supplied to the top-level ``semantic-release`` command, before the name of any sub-command. - .. warning:: The volume of logs when using ``DEBUG`` verbosity may be significantly increased, compared to ``INFO`` or the default ``WARNING``, and as a result executing commands From 903c8ba68d797f7cd9e5025c9a3a3ad471c805ae Mon Sep 17 00:00:00 2001 From: codejedi365 Date: Tue, 11 Feb 2025 00:03:33 -0700 Subject: [PATCH 6/8] fix(config): handle invalid `commit_parser` type gracefully (#1180) * refactor(cli): improve global error logging --- src/semantic_release/__main__.py | 10 +++++++--- src/semantic_release/cli/commands/main.py | 9 +++------ src/semantic_release/cli/config.py | 11 +++++++++++ src/semantic_release/globals.py | 6 ++++-- src/semantic_release/helpers.py | 6 ++++++ 5 files changed, 31 insertions(+), 11 deletions(-) diff --git a/src/semantic_release/__main__.py b/src/semantic_release/__main__.py index 7ec9adac7..5743bcace 100644 --- a/src/semantic_release/__main__.py +++ b/src/semantic_release/__main__.py @@ -8,6 +8,7 @@ from semantic_release import globals from semantic_release.cli.commands.main import main as cli_main +from semantic_release.enums import SemanticReleaseLogLevels def main() -> None: @@ -18,7 +19,7 @@ def main() -> None: print("\n-- User Abort! --", file=sys.stderr) sys.exit(127) except Exception as err: # noqa: BLE001, graceful error handling across application - if globals.debug: + if globals.log_level <= SemanticReleaseLogLevels.DEBUG: print(f"{err.__class__.__name__}: {err}\n", file=sys.stderr) etype, value, traceback = sys.exc_info() print( @@ -35,9 +36,12 @@ def main() -> None: file=sys.stderr, ) - print(f"::ERROR:: {err}", file=sys.stderr) + print( + str.join("\n", [f"::ERROR:: {line}" for line in str(err).splitlines()]), + file=sys.stderr, + ) - if not globals.debug: + if globals.log_level > SemanticReleaseLogLevels.DEBUG: print( "Run semantic-release in very verbose mode (-vv) to see the full traceback.", file=sys.stderr, diff --git a/src/semantic_release/cli/commands/main.py b/src/semantic_release/cli/commands/main.py index 885898dfb..7f0d170e2 100644 --- a/src/semantic_release/cli/commands/main.py +++ b/src/semantic_release/cli/commands/main.py @@ -116,10 +116,10 @@ def main( SemanticReleaseLogLevels.SILLY, ] - log_level = log_levels[verbosity] + globals.log_level = log_levels[verbosity] logging.basicConfig( - level=log_level, + level=globals.log_level, format=FORMAT, datefmt="[%X]", handlers=[ @@ -130,10 +130,7 @@ def main( ) logger = logging.getLogger(__name__) - logger.debug("logging level set to: %s", logging.getLevelName(log_level)) - - if log_level <= logging.DEBUG: - globals.debug = True + logger.debug("logging level set to: %s", logging.getLevelName(globals.log_level)) if noop: rprint( diff --git a/src/semantic_release/cli/config.py b/src/semantic_release/cli/config.py index 496e97428..721028281 100644 --- a/src/semantic_release/cli/config.py +++ b/src/semantic_release/cli/config.py @@ -665,6 +665,17 @@ def from_raw_config( # noqa: C901 if raw.commit_parser in _known_commit_parsers else dynamic_import(raw.commit_parser) ) + except ValueError as err: + raise ParserLoadError( + str.join( + "\n", + [ + f"Unrecognized commit parser value: {raw.commit_parser!r}.", + str(err), + "Unable to load the given parser! Check your configuration!", + ], + ) + ) from err except ModuleNotFoundError as err: raise ParserLoadError( str.join( diff --git a/src/semantic_release/globals.py b/src/semantic_release/globals.py index 3780b84bb..a0ac61ddb 100644 --- a/src/semantic_release/globals.py +++ b/src/semantic_release/globals.py @@ -2,5 +2,7 @@ from __future__ import annotations -debug: bool = False -"""bool: Enable debug level logging and runtime actions.""" +from semantic_release.enums import SemanticReleaseLogLevels + +log_level: SemanticReleaseLogLevels = SemanticReleaseLogLevels.WARNING +"""int: Logging level for semantic-release""" diff --git a/src/semantic_release/helpers.py b/src/semantic_release/helpers.py index 46358b8d0..5f6723ec4 100644 --- a/src/semantic_release/helpers.py +++ b/src/semantic_release/helpers.py @@ -157,6 +157,12 @@ def dynamic_import(import_path: str) -> Any: Dynamically import an object from a conventionally formatted "module:attribute" string """ + if ":" not in import_path: + raise ValueError( + f"Invalid import path {import_path!r}, must use 'module:Class' format" + ) + + # Split the import path into module and attribute module_name, attr = import_path.split(":", maxsplit=1) # Check if the module is a file path, if it can be resolved and exists on disk then import as a file From 81f9e80c3df185ef5e553e024b903ce153e14304 Mon Sep 17 00:00:00 2001 From: codejedi365 Date: Tue, 11 Feb 2025 00:15:26 -0700 Subject: [PATCH 7/8] fix(changelog): standardize heading format for across all version sections (#1182) * test(fixtures): update changelog generator to match adjusted default template * test(release-notes): update test cases to match adjusted default template * test(changelog): update test cases to match adjusted default template * fix(changelog-rst): standardize heading format for extra release information * fix(changelog-md): standardize heading format for extra release information * fix(release-notes): standardize heading format for extra release information * docs(commit-parsing): update reference to section name of additional release info * chore(psr-changelog-tpls): standardize all headings & resolve additnl release info usage --- config/release-templates/.components/changes.md.j2 | 10 +++++----- config/release-templates/.components/changes.rst.j2 | 8 ++++---- config/release-templates/.release_notes.md.j2 | 4 ++-- docs/commit_parsing.rst | 2 +- .../templates/angular/md/.components/changes.md.j2 | 8 ++++---- .../data/templates/angular/md/.release_notes.md.j2 | 4 ++-- .../templates/angular/rst/.components/changes.rst.j2 | 8 ++++---- tests/fixtures/git_repo.py | 6 +++--- .../changelog/test_default_changelog.py | 12 ++++++------ .../semantic_release/changelog/test_release_notes.py | 12 ++++++------ 10 files changed, 37 insertions(+), 37 deletions(-) diff --git a/config/release-templates/.components/changes.md.j2 b/config/release-templates/.components/changes.md.j2 index 87d600924..d2a062d9a 100644 --- a/config/release-templates/.components/changes.md.j2 +++ b/config/release-templates/.components/changes.md.j2 @@ -19,7 +19,7 @@ EXAMPLE: - Fix bug ([#11](https://domain.com/namespace/repo/pull/11), [`abcdef1`](https://domain.com/namespace/repo/commit/HASH)) -### 💥 BREAKING CHANGES +### 💥 Breaking Changes - With the change _____, the change causes ___ effect. Ultimately, this section it is a more detailed description of the breaking change. With an optional @@ -28,7 +28,7 @@ EXAMPLE: - **scope**: this breaking change has a scope to identify the part of the code that this breaking change applies to for better context. -### 💡 ADDITIONAL RELEASE INFORMATION +### 💡 Additional Release Information - This is a release note that provides additional information about the release that is not a breaking change or a feature/bug fix. @@ -65,7 +65,7 @@ EXAMPLE: #}{% set breaking_commits = [] %}{% set notice_commits = [] %}{% for commits in commit_objects.values() -%}{% set valid_commits = commits | rejectattr("error", "defined") +%}{% set valid_commits = commits | rejectattr("error", "defined") | list %}{# # Filter out breaking change commits that have no breaking descriptions #}{% set _ = breaking_commits.extend( valid_commits | selectattr("breaking_descriptions.0") @@ -94,7 +94,7 @@ EXAMPLE: %}{# # # PRINT BREAKING CHANGE DESCRIPTIONS (header & descriptions) #}{{ "\n" -}}{{ "### %s BREAKING CHANGES\n" | format(emoji_map["breaking"]) +}}{{ "### %s Breaking Changes\n" | format(emoji_map["breaking"]) }}{{ "\n%s\n" | format(brking_descriptions | unique | join("\n\n")) }}{# @@ -118,7 +118,7 @@ EXAMPLE: %}{# # # PRINT RELEASE NOTICE INFORMATION (header & descriptions) #}{{ "\n" -}}{{ "### %s ADDITIONAL RELEASE INFORMATION\n" | format(emoji_map["release_note"]) +}}{{ "### %s Additional Release Information\n" | format(emoji_map["release_note"]) }}{{ "\n%s\n" | format(release_notices | unique | join("\n\n")) }}{# diff --git a/config/release-templates/.components/changes.rst.j2 b/config/release-templates/.components/changes.rst.j2 index ba9180e87..90434bfdb 100644 --- a/config/release-templates/.components/changes.rst.j2 +++ b/config/release-templates/.components/changes.rst.j2 @@ -20,7 +20,7 @@ * Fix bug (`#11`_, `8a7b8ec`_) -💥 BREAKING CHANGES +💥 Breaking Changes ------------------- * With the change _____, the change causes ___ effect. Ultimately, this section @@ -30,7 +30,7 @@ * **scope**: this breaking change has a scope to identify the part of the code that this breaking change applies to for better context. -💡 ADDITIONAL RELEASE INFORMATION +💡 Additional Release Information --------------------------------- * This is a release note that provides additional information about the release @@ -132,7 +132,7 @@ %}{# # # PRINT BREAKING CHANGE DESCRIPTIONS (header & descriptions) #}{{ "\n" -}}{{ "%s BREAKING CHANGES\n" | format(emoji_map["breaking"]) +}}{{ "%s Breaking Changes\n" | format(emoji_map["breaking"]) }}{{ '-------------------\n' }}{{ "\n%s\n" | format(brking_descriptions | unique | join("\n\n")) @@ -157,7 +157,7 @@ %}{# # # PRINT RELEASE NOTICE INFORMATION (header & descriptions) #}{{ "\n" -}}{{ "%s ADDITIONAL RELEASE INFORMATION\n" | format(emoji_map["release_note"]) +}}{{ "%s Additional Release Information\n" | format(emoji_map["release_note"]) }}{{ "---------------------------------\n" }}{{ "\n%s\n" | format(release_notices | unique | join("\n\n")) diff --git a/config/release-templates/.release_notes.md.j2 b/config/release-templates/.release_notes.md.j2 index 584269ead..ee9fde4c4 100644 --- a/config/release-templates/.release_notes.md.j2 +++ b/config/release-templates/.release_notes.md.j2 @@ -15,13 +15,13 @@ _This release is published under the MIT License._ - Fix bug ([PR#11](https://domain.com/namespace/repo/pull/11), [`abcdef1`](https://domain.com/namespace/repo/commit/HASH)) -### 💥 BREAKING CHANGES +### 💥 Breaking Changes - With the change _____, the change causes ___ effect. Ultimately, this section it is a more detailed description of the breaking change. With an optional scope prefix like the commit messages above. - **scope**: this breaking change has a scope to identify the part of the code that this breaking change applies to for better context. -### 💡 ADDITIONAL RELEASE INFORMATION +### 💡 Additional Release Information - This is a release note that provides additional information about the release that is not a breaking change or a feature/bug fix. diff --git a/docs/commit_parsing.rst b/docs/commit_parsing.rst index 25e70eb45..65e523d98 100644 --- a/docs/commit_parsing.rst +++ b/docs/commit_parsing.rst @@ -423,7 +423,7 @@ a ``release_notices`` attribute that is a tuple of string paragraphs to identify release notice. In the default changelog and release notes template, these release notices will be -formatted into their own section called **ADDITIONAL RELEASE INFORMATION**. Each will +formatted into their own section called **Additional Release Information**. Each will include any commit scope defined and each release notice in alphabetical order. ---- diff --git a/src/semantic_release/data/templates/angular/md/.components/changes.md.j2 b/src/semantic_release/data/templates/angular/md/.components/changes.md.j2 index bf4cd98b5..b2b89ff12 100644 --- a/src/semantic_release/data/templates/angular/md/.components/changes.md.j2 +++ b/src/semantic_release/data/templates/angular/md/.components/changes.md.j2 @@ -18,7 +18,7 @@ EXAMPLE: - Fix bug ([#11](https://domain.com/namespace/repo/pull/11), [`abcdef1`](https://domain.com/namespace/repo/commit/HASH)) -### BREAKING CHANGES +### Breaking Changes - With the change _____, the change causes ___ effect. Ultimately, this section it is a more detailed description of the breaking change. With an optional @@ -27,7 +27,7 @@ EXAMPLE: - **scope**: this breaking change has a scope to identify the part of the code that this breaking change applies to for better context. -### ADDITIONAL RELEASE INFORMATION +### Additional Release Information - This is a release note that provides additional information about the release that is not a breaking change or a feature/bug fix. @@ -96,7 +96,7 @@ EXAMPLE: %}{# # # PRINT BREAKING CHANGE DESCRIPTIONS (header & descriptions) #}{{ "\n" -}}{{ "### BREAKING CHANGES\n" +}}{{ "### Breaking Changes\n" }}{{ "\n%s\n" | format(brking_descriptions | unique | join("\n\n")) }}{# @@ -129,7 +129,7 @@ EXAMPLE: %}{# # # PRINT RELEASE NOTICE INFORMATION (header & descriptions) #}{{ "\n" -}}{{ "### ADDITIONAL RELEASE INFORMATION\n" +}}{{ "### Additional Release Information\n" }}{{ "\n%s\n" | format(release_notices | unique | join("\n\n")) }}{# diff --git a/src/semantic_release/data/templates/angular/md/.release_notes.md.j2 b/src/semantic_release/data/templates/angular/md/.release_notes.md.j2 index 8bfd679cc..7fe7d9228 100644 --- a/src/semantic_release/data/templates/angular/md/.release_notes.md.j2 +++ b/src/semantic_release/data/templates/angular/md/.release_notes.md.j2 @@ -14,13 +14,13 @@ _This release is published under the MIT License._ - Fix bug (#11, [`abcdef1`](https://domain.com/namespace/repo/commit/HASH)) -### BREAKING CHANGES +### Breaking Changes - With the change _____, the change causes ___ effect. Ultimately, this section it is a more detailed description of the breaking change. With an optional scope prefix like the commit messages above. - **scope**: this breaking change has a scope to identify the part of the code that this breaking change applies to for better context. -### ADDITIONAL RELEASE INFORMATION +### Additional Release Information - This is a release note that provides additional information about the release that is not a breaking change or a feature/bug fix. diff --git a/src/semantic_release/data/templates/angular/rst/.components/changes.rst.j2 b/src/semantic_release/data/templates/angular/rst/.components/changes.rst.j2 index 2ff88c892..c6ef1cced 100644 --- a/src/semantic_release/data/templates/angular/rst/.components/changes.rst.j2 +++ b/src/semantic_release/data/templates/angular/rst/.components/changes.rst.j2 @@ -18,7 +18,7 @@ Bug Fixes * Fix bug (`#11`_, `8a7b8ec`_) -BREAKING CHANGES +Breaking Changes ---------------- * With the change _____, the change causes ___ effect. Ultimately, this section @@ -28,7 +28,7 @@ BREAKING CHANGES * **scope**: this breaking change has a scope to identify the part of the code that this breaking change applies to for better context. -ADDITIONAL RELEASE INFORMATION +Additional Release Information ------------------------------ * This is a release note that provides additional information about the release @@ -124,7 +124,7 @@ ADDITIONAL RELEASE INFORMATION %}{# # # PRINT BREAKING CHANGE DESCRIPTIONS (header & descriptions) #}{{ "\n" -}}{{ "BREAKING CHANGES\n" +}}{{ "Breaking Changes\n" }}{{ '----------------\n' }}{{ "\n%s\n" | format(brking_descriptions | unique | join("\n\n")) @@ -158,7 +158,7 @@ ADDITIONAL RELEASE INFORMATION %}{# # # PRINT RELEASE NOTICE INFORMATION (header & descriptions) #}{{ "\n" -}}{{ "ADDITIONAL RELEASE INFORMATION\n" +}}{{ "Additional Release Information\n" }}{{ "------------------------------\n" }}{{ "\n%s\n" | format(release_notices | unique | join("\n\n")) diff --git a/tests/fixtures/git_repo.py b/tests/fixtures/git_repo.py index 0c8faeeb5..048f77b3a 100644 --- a/tests/fixtures/git_repo.py +++ b/tests/fixtures/git_repo.py @@ -1689,7 +1689,7 @@ def build_version_entry_markdown( # Add breaking changes to the end of the version entry if brking_descriptions: - version_entry.append("### BREAKING CHANGES\n") + version_entry.append("### Breaking Changes\n") version_entry.extend([*sorted(brking_descriptions), ""]) return str.join("\n", version_entry) @@ -1822,7 +1822,7 @@ def build_version_entry_restructured_text( # Add breaking changes to the end of the version entry if brking_descriptions: - version_entry.append("BREAKING CHANGES") + version_entry.append("Breaking Changes") version_entry.append("-" * len(version_entry[-1]) + "\n") version_entry.extend([*sorted(brking_descriptions), ""]) @@ -2067,7 +2067,7 @@ def build_version_entry_markdown( # Add breaking changes to the end of the version entry if brking_descriptions: - version_entry.append("### BREAKING CHANGES\n") + version_entry.append("### Breaking Changes\n") version_entry.extend([*sorted(brking_descriptions), ""]) return str.join("\n", version_entry) diff --git a/tests/unit/semantic_release/changelog/test_default_changelog.py b/tests/unit/semantic_release/changelog/test_default_changelog.py index e3c01b7d7..adbbdc241 100644 --- a/tests/unit/semantic_release/changelog/test_default_changelog.py +++ b/tests/unit/semantic_release/changelog/test_default_changelog.py @@ -180,7 +180,7 @@ def test_default_changelog_template_w_a_brk_change( f"- **{brk_fix_commit_obj.scope}**: {brk_fix_description.capitalize()}", f" ([`{brk_fix_commit_obj.commit.hexsha[:7]}`]({brk_fix_commit_url}))", "", - "### BREAKING CHANGES", + "### Breaking Changes", "", # Currently does not consider the 100 character limit because the current # descriptions are short enough to fit in one line @@ -317,7 +317,7 @@ def test_default_changelog_template_w_multiple_brk_changes( f"- {brk_feat_description.capitalize()}", f" ([`{brk_feat_commit_obj.commit.hexsha[:7]}`]({brk_feat_commit_url}))", "", - "### BREAKING CHANGES", + "### Breaking Changes", "", # Currently does not consider the 100 character limit because the current # descriptions are short enough to fit in one line @@ -638,7 +638,7 @@ def test_default_changelog_template_w_a_notice( f"- **{notice_commit_obj.scope}**: {notice_commit_description.capitalize().rstrip()}", f" ([`{notice_commit_obj.commit.hexsha[:7]}`]({notice_commit_url}))", "", - "### ADDITIONAL RELEASE INFORMATION", + "### Additional Release Information", "", "- {commit_scope}{change_desc}".format( commit_scope=( @@ -787,7 +787,7 @@ def test_default_changelog_template_w_a_notice_n_brk_change( ), f" ([`{notice_commit_obj.commit.hexsha[:7]}`]({notice_commit_url}))", "", - "### BREAKING CHANGES", + "### Breaking Changes", "", "- {commit_scope}{change_desc}".format( commit_scope=( @@ -798,7 +798,7 @@ def test_default_changelog_template_w_a_notice_n_brk_change( change_desc=brk_fix_brking_description.capitalize().rstrip(), ), "", - "### ADDITIONAL RELEASE INFORMATION", + "### Additional Release Information", "", "- {commit_scope}{change_desc}".format( commit_scope=( @@ -947,7 +947,7 @@ def test_default_changelog_template_w_multiple_notices( ), f" ([`{refactor_notice_commit_obj.commit.hexsha[:7]}`]({refactor_commit_url}))", "", - "### ADDITIONAL RELEASE INFORMATION", + "### Additional Release Information", "", "- {commit_scope}{change_desc}".format( commit_scope=( diff --git a/tests/unit/semantic_release/changelog/test_release_notes.py b/tests/unit/semantic_release/changelog/test_release_notes.py index f0c959c27..2b95ec827 100644 --- a/tests/unit/semantic_release/changelog/test_release_notes.py +++ b/tests/unit/semantic_release/changelog/test_release_notes.py @@ -211,7 +211,7 @@ def test_default_release_notes_template_w_a_brk_description( url=brk_fix_commit_url, ), "", - "### BREAKING CHANGES", + "### Breaking Changes", "", "- {commit_scope}{change_desc}".format( commit_scope=( @@ -323,7 +323,7 @@ def test_default_release_notes_template_w_multiple_brk_changes( url=brk_feat_commit_url, ), "", - "### BREAKING CHANGES", + "### Breaking Changes", "", "- {commit_scope}{change_desc}".format( commit_scope=( @@ -770,7 +770,7 @@ def test_default_release_notes_template_w_a_notice( url=notice_commit_url, ), "", - "### ADDITIONAL RELEASE INFORMATION", + "### Additional Release Information", "", "- {commit_scope}{change_desc}".format( commit_scope=( @@ -880,7 +880,7 @@ def test_default_release_notes_template_w_a_notice_n_brk_change( url=notice_commit_url, ), "", - "### BREAKING CHANGES", + "### Breaking Changes", "", "- {commit_scope}{change_desc}".format( commit_scope=( @@ -891,7 +891,7 @@ def test_default_release_notes_template_w_a_notice_n_brk_change( change_desc=brk_fix_brking_description.capitalize().rstrip(), ), "", - "### ADDITIONAL RELEASE INFORMATION", + "### Additional Release Information", "", "- {commit_scope}{change_desc}".format( commit_scope=( @@ -997,7 +997,7 @@ def test_default_release_notes_template_w_multiple_notices( url=refactor_commit_url, ), "", - "### ADDITIONAL RELEASE INFORMATION", + "### Additional Release Information", "", "- {commit_scope}{change_desc}".format( commit_scope=( From 0a6013c422396066ede0383ca2c443859397252d Mon Sep 17 00:00:00 2001 From: semantic-release Date: Tue, 11 Feb 2025 07:27:52 +0000 Subject: [PATCH 8/8] 9.19.1 Automatically generated by python-semantic-release --- CHANGELOG.rst | 39 ++++++++++++++++++++++ docs/automatic-releases/github-actions.rst | 14 ++++---- pyproject.toml | 2 +- src/semantic_release/__init__.py | 2 +- 4 files changed, 48 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index f2bc511ae..db8c86e47 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -4,6 +4,45 @@ CHANGELOG ========= +.. _changelog-v9.19.1: + +v9.19.1 (2025-02-11) +==================== + +🪲 Bug Fixes +------------ + +* **changelog**: Standardize heading format for across all version sections (`PR#1182`_, `81f9e80`_) + +* **changelog-md**: Standardize heading format for extra release information (`PR#1182`_, + `81f9e80`_) + +* **changelog-rst**: Standardize heading format for extra release information (`PR#1182`_, + `81f9e80`_) + +* **config**: Handle invalid ``commit_parser`` type gracefully (`PR#1180`_, `903c8ba`_) + +* **release-notes**: Standardize heading format for extra release information (`PR#1182`_, + `81f9e80`_) + +📖 Documentation +---------------- + +* Fix spelling errors & inaccurate descriptions (`55d4a05`_) + +* **automatic-releases**: Declutter the table of contents for automatic release guides (`e8343ee`_) + +* **commit-parsing**: Update reference to section name of additional release info (`PR#1182`_, + `81f9e80`_) + +.. _55d4a05: https://github.com/python-semantic-release/python-semantic-release/commit/55d4a05ff56321cf9874f8f302fbe7e5163ad4f7 +.. _81f9e80: https://github.com/python-semantic-release/python-semantic-release/commit/81f9e80c3df185ef5e553e024b903ce153e14304 +.. _903c8ba: https://github.com/python-semantic-release/python-semantic-release/commit/903c8ba68d797f7cd9e5025c9a3a3ad471c805ae +.. _e8343ee: https://github.com/python-semantic-release/python-semantic-release/commit/e8343eeb38d3b4e18953ac0f97538df396d22b76 +.. _PR#1180: https://github.com/python-semantic-release/python-semantic-release/pull/1180 +.. _PR#1182: https://github.com/python-semantic-release/python-semantic-release/pull/1182 + + .. _changelog-v9.19.0: v9.19.0 (2025-02-10) diff --git a/docs/automatic-releases/github-actions.rst b/docs/automatic-releases/github-actions.rst index 2ea4ba2ff..b192eb6f9 100644 --- a/docs/automatic-releases/github-actions.rst +++ b/docs/automatic-releases/github-actions.rst @@ -337,7 +337,7 @@ before the :ref:`version ` subcommand. .. code:: yaml - - uses: python-semantic-release/python-semantic-release@v9.19.0 + - uses: python-semantic-release/python-semantic-release@v9.19.1 with: root_options: "-vv --noop" @@ -576,7 +576,7 @@ before the :ref:`publish ` subcommand. .. code:: yaml - - uses: python-semantic-release/publish-action@v9.19.0 + - uses: python-semantic-release/publish-action@v9.19.1 with: root_options: "-vv --noop" @@ -684,7 +684,7 @@ to the GitHub Release Assets as well. - name: Action | Semantic Version Release id: release # Adjust tag with desired version if applicable. - uses: python-semantic-release/python-semantic-release@v9.19.0 + uses: python-semantic-release/python-semantic-release@v9.19.1 with: github_token: ${{ secrets.GITHUB_TOKEN }} git_committer_name: "github-actions" @@ -695,7 +695,7 @@ to the GitHub Release Assets as well. if: steps.release.outputs.released == 'true' - name: Publish | Upload to GitHub Release Assets - uses: python-semantic-release/publish-action@v9.19.0 + uses: python-semantic-release/publish-action@v9.19.1 if: steps.release.outputs.released == 'true' with: github_token: ${{ secrets.GITHUB_TOKEN }} @@ -744,7 +744,7 @@ The equivalent GitHub Action configuration would be: - name: Action | Semantic Version Release # Adjust tag with desired version if applicable. - uses: python-semantic-release/python-semantic-release@v9.19.0 + uses: python-semantic-release/python-semantic-release@v9.19.1 with: github_token: ${{ secrets.GITHUB_TOKEN }} force: patch @@ -772,13 +772,13 @@ Publish Action. .. code:: yaml - name: Release Project 1 - uses: python-semantic-release/python-semantic-release@v9.19.0 + uses: python-semantic-release/python-semantic-release@v9.19.1 with: directory: ./project1 github_token: ${{ secrets.GITHUB_TOKEN }} - name: Release Project 2 - uses: python-semantic-release/python-semantic-release@v9.19.0 + uses: python-semantic-release/python-semantic-release@v9.19.1 with: directory: ./project2 github_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/pyproject.toml b/pyproject.toml index c6e99d898..f0d1eb911 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta" [project] name = "python-semantic-release" -version = "9.19.0" +version = "9.19.1" description = "Automatic Semantic Versioning for Python projects" requires-python = ">=3.8" license = { text = "MIT" } diff --git a/src/semantic_release/__init__.py b/src/semantic_release/__init__.py index 790c3034f..cad1767ec 100644 --- a/src/semantic_release/__init__.py +++ b/src/semantic_release/__init__.py @@ -24,7 +24,7 @@ tags_and_versions, ) -__version__ = "9.19.0" +__version__ = "9.19.1" __all__ = [ "CommitParser",