Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

SemVer and SemVer2 version parsing#1384

tvannahl started this conversation inGeneral
Discussion options

Moin,

Within the last month there has been a change on how previous commits are being handled, due to which an old tag in one of my projects1.1.0-add-semver.11.shae030cfc does causecz bump to fail:

Traceback (most recent call last):  File "/app_venv/bin/cz", line 8, in <module>    sys.exit(main())             ^^^^^^  File "/app_venv/lib/python3.12/site-packages/commitizen/cli.py", line 656, in main    args.func(conf, arguments)()  File "/app_venv/lib/python3.12/site-packages/commitizen/commands/bump.py", line 147, in __call__    current_version = self.scheme(provider.get_version())                                  ^^^^^^^^^^^^^^^^^^^^^^  File "/app_venv/lib/python3.12/site-packages/commitizen/providers/scm_provider.py", line 21, in get_version    versions = sorted(rules.extract_version(t) for t in version_tags)               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  File "/app_venv/lib/python3.12/site-packages/commitizen/providers/scm_provider.py", line 21, in <genexpr>    versions = sorted(rules.extract_version(t) for t in version_tags)                      ^^^^^^^^^^^^^^^^^^^^^^^^  File "/app_venv/lib/python3.12/site-packages/commitizen/tags.py", line 151, in extract_version    return self.scheme(m.group("version"))           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  File "/app_venv/lib/python3.12/site-packages/packaging/version.py", line 202, in __init__    raise InvalidVersion(f"Invalid version: {version!r}")packaging.version.InvalidVersion: Invalid version: '1.1.0-add-semver.11.shae030cfc'

After some investigation I've learned that this is due tocz is usingpackaging.version.Version to parse PEP440, SemVer1 and SemVer2 with the same code although my.cz.toml is configured tosemver2.

This does mean that cz is really only able to parse PEP440 compatible versions, rather than SemVer.

Does there happen to be a ticket with plans of implementing SemVer and SemVer2 parsers?

You must be logged in to vote

Replies: 0 comments

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Category
General
Labels
None yet
1 participant
@tvannahl

[8]ページ先頭

©2009-2025 Movatter.jp