Bumping alphanumeric identifiers
See original GitHub issueSituation
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
# semver 2.13.0
>>> from semver import VersionInfo
>>> v = VersionInfo.parse("1.0.0-rc")
>>> v.bump_prerelease()
VersionInfo(major=1, minor=0, patch=0, prerelease='rc', build=None)
>>> b = VersionInfo.parse("1.0.0+build")
>>> b.bump_prerelease()
VersionInfo(major=1, minor=0, patch=0, prerelease=None, build='build')
Expected Behavior
Numeric identifier 2
gets appended, in my expectation.
>>> v = VersionInfo.parse("1.0.0-rc")
>>> v.bump_prerelease()
VersionInfo(major=1, minor=0, patch=0, prerelease='rc.2', build=None)
>>> b = VersionInfo.parse("1.0.0+build")
>>> b.bump_prerelease()
VersionInfo(major=1, minor=0, patch=0, prerelease=None, build='build.2')
Environment
- OS: Windows
- Python version 3.10
- Version of semver library 2.13.0
Issue Analytics
- State:
- Created 10 months ago
- Comments:10 (10 by maintainers)
Top Results From Across the Web
Creating Unique Alphanumeric ID - Alteryx Community
My goal is to assign a unique alphanumeric ID to my person level data. I do not want to use the current Person...
Read more >Text - Alphanumeric Only with QuickTapSurvey - YouTube
Alphanumeric lets the user enter letters and numbers without having to switch the keyboard! ... What is your account id ? Enter serial...
Read more >How many alphanumeric combinations can there be with 36 ...
How many possible combinations is there with a nine character string where each character has to be alphanumeric? By alphanumeric I presume you ......
Read more >How to generate unique six digit alpha-numeric code in Ruby
Bumping the random number from 10000 to 10000000 reduces the collisions to "only" 31,000 out of 1,000,000, but any collisions is still bad....
Read more >Semantic Versioning 2.0.0 | Semantic Versioning
Identifiers MUST comprise only ASCII alphanumerics and hyphens [0-9A-Za-z-]. Identifiers MUST NOT be empty. Numeric identifiers MUST NOT include leading zeroes.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hello Tom,
thanks for the comparison with npm semver. I wasn’t aware of their strategy. My reason for picking the
2
was partly intuition, and partly unfamiliarity with item 11, subitem 4 of the semver spec.Intuitively, I thought that I would rank
alpha.0
<alpha
. And my intuitive ranking betweenalpha.1
andalpha
was fuzzy, you could argue either way. On the other hand, it was immediately obvious to me hatalpha
<alpha.2
. That’s why I was suggesting2
as the added default numeric identifier.But now, having read the specification, appending
0
makes probably the most sense. I also like the Idea that we would follow the npm semver behavior.Thanks for the overview. This is really helpful. 👍
I need to digest it a bit longer and will respond later. Many thanks.