question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Bumping alphanumeric identifiers

See original GitHub issue

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

# 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:open
  • Created 10 months ago
  • Comments:10 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
Nagidalcommented, Nov 17, 2022

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 between alpha.1 and alpha was fuzzy, you could argue either way. On the other hand, it was immediately obvious to me hat alpha < alpha.2. That’s why I was suggesting 2 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.

0reactions
tomschrcommented, Nov 23, 2022

Thanks for the overview. This is really helpful. 👍

I need to digest it a bit longer and will respond later. Many thanks.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found