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
Bumping alphanumeric identifiers #369
Comments
@Nagidal Thank you for your report, much appreciated. 👍 I've read the original semver specification, but I haven't found a specific answer to our case. The closest is the example from item 11, subitem 4. However, it deals with comparison, not with bumping a pre-release. Nevertheless, your concern seems to be valid. However, I'm not sure about your expectation. You wrote that you've expected To get some inspiration, I've looked into npm's semver, especially > const semver = require('semver');
> v = semver.parse("1.0.0-rc");
> semver.inc(v, "prerelease");
'1.0.0-rc.0' In their case having just a >>> v = Version.parse("1.0.0-rc")
>>> v.bump_prerelease()
Version(major=1, minor=0, patch=0, prerelease='rc.0', build=None) What do you think? |
I remember now that @vincent-herlemont opened in #344 a very similar issue (see also PR #365) |
Hello Tom, thanks for the comparison with npm semver. I wasn't aware of their strategy. My reason for picking the Intuitively, I thought that I would rank But now, having read the specification, appending |
As for using VersionInfo instead of Version: the 3.0.0-dev.3 is a pre-release and as such not fit for use in production yet. What you get when you |
Yes, that's true. It was just meant as a friendly reminder for the upcoming release. 🙂 |
Hi @Nagidal, as I already wrote, your issue is related to #344. I gave both some thought and it raises some questions to me. I would like to hear your opinion (and maybe @vincent-herlemont too?):
What do you think? |
I think in these cases we could take advantage of Python's
I now prefer not to follow the npm semver behavior of bumping alphanumeric identifiers. It is very different from python-semver 2.x. I like the default numeric identifiers starting at
Either way, we will need to specify a new default token value. It can't be I also think that the keyword argument |
method name
etc. |
We should also think about the variable type of the keyword change_prerelease(identifiers=("alpha", 1))
next_version(part="prerelease", identifiers=("alpha", 1)) the new default value would then be the tuple For single identifiers we would have to use a one-tuple There still can be an additional method to parse a string of concatenated identifiers into an identifier iterable, but the underlying API should not be passed the identifier separator, ever .e.g: v = Version.parse("1.0.0")
v.change_prerelease(identifiers=Version.parse_identifiers("alpha.1")) If, hypothetically, Semver 3.0.0 would decide that the new separator is |
Thanks for the overview. This is really helpful. 👍 I need to digest it a bit longer and will respond later. Many thanks. |
@Nagidal Just for your information: I've merged PR #365 which fixes the Regarding the misnomer of Thanks for all your ideas! |
@tomschr Thanks for the update. |
Situation
When running some tests for my semver plugin for hatch, I was surprised that if prerelease's or build's last identifier is alphanumeric, bumping does nothing.
To Reproduce
Expected Behavior
Numeric identifier
2
gets appended, in my expectation.Environment
The text was updated successfully, but these errors were encountered: