Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generated pre-release part of SemVer differs from SemVer spec #1025

Closed
Xiangze-Li opened this issue Mar 14, 2024 · 11 comments · Fixed by #1072
Closed

Generated pre-release part of SemVer differs from SemVer spec #1025

Xiangze-Li opened this issue Mar 14, 2024 · 11 comments · Fixed by #1072
Assignees
Labels
issue-status: wait-for-implementation maintainers agree on the bug / feature type: feature A new enhacement proposal

Comments

@Xiangze-Li
Copy link

Description

When using SemVer schema and bumping to pre-release version, the version generated is like 1.0.0-a0.

This differs from examples from SemVer spec 9, which is 1.0.0-alpha.0, using "alpha" instead of "a", and having a dot between "a" and the sequential number.

Current behavior may break the version comparison when the number has more than 1 digits.
For example, 1.0.0-a10 is less than 1.0.0-a2 according to spec 11, because a10 is less than a2 lexically.

Steps to reproduce

  1. Setup commitizen using SemVer schema
  2. Run cz bump --pr alpha

Current behavior

Bumped into x.y.z-a0

Desired behavior

Bumped into x.y.z-a.0 or x.y.z-alpha.0

Screenshots

No response

Environment

Commitizen Version: 3.18.3
Python Version: 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0]
Operating System: Linux

@woile
Copy link
Member

woile commented Mar 14, 2024

Did you configure the version scheme?
https://commitizen-tools.github.io/commitizen/bump/#version_scheme

@Xiangze-Li
Copy link
Author

Did you configure the version scheme? https://commitizen-tools.github.io/commitizen/bump/#version_scheme

I set this field (when initializing) in .cz.toml as version_scheme = "semver".

Actual behavior is exactly same with what stated in the linked manual, which disagrees with SemVer spec.

@Xiangze-Li
Copy link
Author

I just realized this behavior is OK under SemVer 1.0.0.

Maybe it's nice to seperate the two SemVer more clearly?

@woile
Copy link
Member

woile commented Mar 14, 2024

What do you mean by "the two semver"?

@Xiangze-Li
Copy link
Author

What do you mean the two semver?

SemVer has two major versions now. Version 2 has changed the spec of the pre-release part.

@woile
Copy link
Member

woile commented Mar 14, 2024

mm we may need a new version scheme: semver_v2
Thoughts on this @Lee-W @noirbizarre ?

@woile woile added type: feature A new enhacement proposal issue-status: wait-for-implementation maintainers agree on the bug / feature and removed issue-status: needs-triage labels Mar 14, 2024
@krumlo
Copy link

krumlo commented Apr 17, 2024

Second this, I'd really enjoy semver 2.0 support!

@noirbizarre
Copy link
Member

Hum, makes sense.
I need to review quickly differences with v1, but it should be easy with the versioon providers

@noirbizarre
Copy link
Member

There it is, implemented in #1072.

Note that SemVer2 is underspecified on the prerelease part (I include development releases as the concept does not exist in SemVer2) and some choices has been made, staying close to the examples (only example are using alpha, beta), the specification itself is just about the format and the precedence rules, it does not specify the standard parts (alpha, beta, dev... which might also be a, benddev`).

(This point is one of the reason than Python community dropped SemVer for PEP440)

@Xiangze-Li
Copy link
Author

Many thanks!

@krumlo
Copy link

krumlo commented Apr 18, 2024

@noirbizarre very quick feedback, thanks a bunch!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue-status: wait-for-implementation maintainers agree on the bug / feature type: feature A new enhacement proposal
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants