[Distutils] semver (again)

Daniel Holth dholth at gmail.com
Tue Oct 9 20:24:09 CEST 2012

I like semver. My favorite part is point 12:

Precedence MUST be calculated by separating the version into major,
minor, patch, pre-release, and build identifiers in that order. Major,
minor, and patch versions are always compared numerically. Pre-release
and build version precedence MUST be determined by comparing each dot
separated identifier as follows: identifiers consisting of only digits
are compared numerically and identifiers with letters or dashes are
compared lexically in ASCII sort order. Numeric identifiers always
have lower precedence than non-numeric identifiers. Example:
1.0.0-alpha < 1.0.0-alpha.1 < 1.0.0-beta.2 < 1.0.0-beta.11 <
1.0.0-rc.1 < 1.0.0-rc.1+build.1 < 1.0.0 < 1.0.0+0.3.7 < 1.3.7+build <
1.3.7+build.2.b8f12d7 < 1.3.7+build.11.e0f985a.

(No non-lexicographic comparisons). Unlike PEP-386 it would also allow
DVCS revision ids to be included in the version string.

Taking a look at pypi, ~1k of the latest releases do not parse as
semver (if you extend it by making 1.0 equivalent to 1.0.0, as all
semver versions have at least (major, minor, patch)). This is similar
to the number of latest package versions that don't parse as PEP-386.

I also found this blog post.

How much would it cost to endorse semver?

Daniel H

More information about the Distutils-SIG mailing list