python-semanticversion icon indicating copy to clipboard operation
python-semanticversion copied to clipboard

Select version excluding prerelease

Open ant31 opened this issue 9 years ago • 3 comments

I would like to filter and match 'best' stable version.

Current behavior:

versions = [1.0.0, 1.1.0, 1.2.0-pre]
s = Spec(">=1.0.0")
s.select(versions)
Out: Version('1.2.0-pre')

I would expect pre-releases to be exclude unless explicitly ask for.

Expected behavior:

s = Spec(">=1.0.0-")    # with a '-'
s.select(versions)
Out: Version('1.2.0-pre')

s = Spec(">=1.0.0")
Out: Version('1.1.0')

ant31 avatar Apr 16 '16 17:04 ant31

For now, semantic-version only handles what it's given.

What kind of API would you expect here, ideally without breaking the current behavior?

rbarrois avatar Apr 18 '16 21:04 rbarrois

whitout breaking api what about:

s = Spec(">=1.0.0", stableonly=True)  # with stableonly set to False by default

ant31 avatar Apr 18 '16 23:04 ant31

I think this is a bug. Certainly, as a new user of this library, I expected >=0.0.0 to include only stable versions, as that is what most other implementations do in my experience. I expected to have to specify >=0.0.0-0 to get prerelease versions.

mkjpryor avatar Oct 31 '22 10:10 mkjpryor