Add `rc` to distutils.version.StrictVersion
StrictVersion from distutils accepts version tags like 1.14.0 1.14.0a1 1.14.0b2 but not 1.14.0rc1 (nor 1.14.0c1). My suggestion: Add `rc` in the regexp and make it a `prerelease` (the latter comes for free by the current implementation). Most package maintainers have adopted the `rc` abbreviation for release candidate versioning, e.g. - numpy 1.14.0rc1 - scipy 1.1.0rc1 - plotly 3.0.0rc1 - pandas 0.23.0rc1 - matplotlib 2.2.0rc1 - dask 0.13.0rc1 - django 1.9rc1. All of these are available on PyPI. A natural way of sorting version numbers from pip is by simply using sorted(versions, key=distutils.version.StrictVersion), however, due to StrictVersion only accepting `a` and `b` as abbreviations, this does not work for the aforemention packages. The very obvious cons are: - touching 20 years old code [1] - StrictVersion is preserved "for anal retentives and software idealists", and I don't know if they agree. There might be more cons I fail to think of at this moment. [1] https://github.com/python/cpython/blob/master/Lib/distutils/version.py#L130 Pål Grønås Drange
You should https://packaging.pypa.io/en/latest/version/ <https://packaging.pypa.io/en/latest/version/> instead of anything in distutils for handling version numbers.
On Jul 5, 2018, at 2:11 PM, Pål Grønås Drange <paal.drange@gmail.com> wrote:
StrictVersion from distutils accepts version tags like 1.14.0 1.14.0a1 1.14.0b2
but not 1.14.0rc1 (nor 1.14.0c1).
My suggestion: Add `rc` in the regexp and make it a `prerelease` (the latter comes for free by the current implementation).
Most package maintainers have adopted the `rc` abbreviation for release candidate versioning, e.g. - numpy 1.14.0rc1 - scipy 1.1.0rc1 - plotly 3.0.0rc1 - pandas 0.23.0rc1 - matplotlib 2.2.0rc1 - dask 0.13.0rc1 - django 1.9rc1. All of these are available on PyPI.
A natural way of sorting version numbers from pip is by simply using sorted(versions, key=distutils.version.StrictVersion), however, due to StrictVersion only accepting `a` and `b` as abbreviations, this does not work for the aforemention packages.
The very obvious cons are: - touching 20 years old code [1] - StrictVersion is preserved "for anal retentives and software idealists", and I don't know if they agree.
There might be more cons I fail to think of at this moment.
[1] https://github.com/python/cpython/blob/master/Lib/distutils/version.py#L130 <https://github.com/python/cpython/blob/master/Lib/distutils/version.py#L130>
Pål Grønås Drange
_______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/
participants (2)
-
Donald Stufft
-
Pål Grønås Drange