Skip to content

New prerelease bump behaviour breaks consistency with old RC numbering #484

Description

@jzaia18

Which version of Python is the problem with?

3.12

What semver version are you using?

3.1.0

What OS are you using? (Add more in the Environment section)

Linux

Situation

#462 introduced a change to how prerelease versions are incremented. However, for existing automations using semver, this change can cause issues by reverting the prerelease version to an earlier number.

As an example adapted from a real situation found in production, we have a version string created from the previous semver release (version 3.0.4) which looks something like "0.1.2-rc3".

>>> import semver
>>> v = semver.Version.parse("0.1.2-rc3")
>>> v.next_version("prerelease")
Version(major=0, minor=1, patch=2, prerelease='rc.1', build=None)

The example above sets the RC version backwards from version 3 to version 1, which can break existing CI automations which expect strictly increasing RC numbers.

How to reproduce

Example snippet:

>>> import semver
>>> v = semver.Version.parse("0.1.2-rc3")
>>> v.next_version("prerelease")
Version(major=0, minor=1, patch=2, prerelease='rc.1', build=None)

Expected behavior

RC numbers created with the default settings should not ever decrease due to an internal API change. The expected output would be either "0.1.2-rc4" or "0.1.2-rc.4".

Environment

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

SIze

None yet

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions