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

increasing next_version 'prerelease' with different prerelease_token #339

Open
hokreb opened this issue May 17, 2021 · 3 comments
Open

increasing next_version 'prerelease' with different prerelease_token #339

hokreb opened this issue May 17, 2021 · 3 comments
Labels
Bug Error, flaw or fault to produce incorrect or unexpected results

Comments

@hokreb
Copy link

hokreb commented May 17, 2021

Situation

I am not shure if this should be seen as a bug or an enhancement. I have observed this behaviour in version 2.13 of semver.

If I have a version 1.2.3

ver = semver.VersionInfo.parse('1.2.3')

and would like to get the next dev Version,
I will get the version 1.2.4-dev.1 by calling

ver_dev1 = ver.next_version('prerelease', prerelease_token='dev')

If I would like to get the next release candidate, I would call

ver_rc1 = ver_dev1.next_version('prerelease', prerelease_token='rc')

which should be 1.2.4-rc.1

but the result is 1.2.4-dev.2

To Reproduce

import semver
ver = semver.VersionInfo.parse('1.2.3')
ver_dev1 = ver.next_version('prerelease', prerelease_token='dev')
ver_rc1 = ver_dev1.next_version('prerelease', prerelease_token='rc')
print(ver_rc1)

The result is

1.2.4-dev.2

Expected Behavior

I would assume, that according to semantic versioning the result should be

1.2.4-rc.1

Environment

  • OS: Linux
  • Python version 3.6.13
  • Version of semver library 2.13
@hokreb hokreb added the Bug Error, flaw or fault to produce incorrect or unexpected results label May 17, 2021
@fleetingbytes
Copy link
Contributor

Similar behavior is also observed with build bumps. A custom build string once set, cannot be reset in a subsequent call of the bump_build method.

@tomschr
Copy link
Member

tomschr commented Nov 23, 2022

Yes, this is similar to issue #369.

@tomschr
Copy link
Member

tomschr commented Mar 5, 2023

@hokreb Time flies! Sorry for the delay.

I've tried to confirm it, but if I use the latest version from the master branch, it works:

>>> import semver
>>> ver = semver.VersionInfo.parse('1.2.3')
>>> str(ver.next_version('prerelease', prerelease_token='dev'))
'1.2.4-dev.1'

Can you confirm? If yes, I'd like to close this issue. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Error, flaw or fault to produce incorrect or unexpected results
Projects
None yet
Development

No branches or pull requests

3 participants