Why is version number 0.10.0 considered as older than 0.9.0 in setuptools_scm?

116 Views Asked by At

I have a Python package that is going through frequent changes and it brought us to version 0.9.3 currently. My team is not confident to bump it to 1.0.0 yet.

The team agreed to version number 0.10.0 but why setuptools_scm seems to consider 0.10.0 to be earlier than 0.9.3?

I tried tagging with git tag and check the list:

$ git tag 0.10.0

$ git tag --list
0.10.0
0.2.0
0.2.1
0.2.2
0.3.0
0.5.0
0.7.0
0.7.1
0.8.0
0.8.1
0.9.0
0.9.1
0.9.2
0.9.3

Was expecting 0.10.0 to be listed after 0.9.3.

2

There are 2 best solutions below

0
yuenherny On BEST ANSWER

Disclaimer: This is an answer from @Guildenstern. I post it as the answer now because the original author did not do so. All credit goes to @Guildenstern.

For ascending order:

git tag --sort=version:refname
0
Moshe Eichler On

Probably because sorting a list of strings like this:

print(sorted(['0.9.0', '0.10.0']))

will return this:

['0.10.0', '0.9.0']

since 1<9 (its not 10 as a number)