fix: next_version should bump version for build-only versions - #469
Merged
Conversation
Member
|
Thank you @gaoflow for your contribution! 🎉 Could you rebase your branch to the latest master branch? I've fixed the CI problem and raised semver to version 3.1.0. Thank you! |
next_version('patch') on a version with build metadata but no prerelease
(e.g. 1.2.3+build.5) would strip the build and return the same version
(1.2.3) instead of bumping the patch (1.2.4).
The condition in next_version was (version.prerelease or version.build),
which caused build-only versions to enter the 'finalization' path meant
for prereleases. Build metadata does not affect version precedence, so
its presence should not trigger version finalization.
Change the condition to only check version.prerelease.
gaoflow
force-pushed
the
fix-next-version-build
branch
from
June 29, 2026 16:06
a3cd2f7 to
6cb1cae
Compare
Contributor
Author
|
Done — rebased onto the latest |
Member
|
@gaoflow Thank you for your help! 👍 The CI reports one failed doctest in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes a bug where
next_versionon versions with build metadata but no prerelease would strip the build without bumping the version.Bug
Version.parse('1.2.3+build.5').next_version('patch')returns1.2.3instead of1.2.4.The condition in
next_versionwas(version.prerelease or version.build), which caused build-only versions to enter the finalization path meant for prereleases. Build metadata does not affect semver precedence, so its presence should not trigger version finalization -- the version should be bumped.Same issue affects
next_version('minor')on X.Y.0+build andnext_version('major')on X.0.0+build.Fix
Change the condition from
version.prerelease or version.buildtoversion.prerelease. Prerelease+build versions still correctly finalize (stripping both prerelease and build).Checklist
version.py