[Python-ideas] Add support for version objects
Oleg Broytman
phd at phdru.name
Fri May 27 15:30:41 EDT 2016
On Fri, May 27, 2016 at 10:04:34PM +0300, Serhiy Storchaka <storchaka at gmail.com> wrote:
> I propose to add support for version objects in the stdlib. Version object
> is a namedtuple-like object with special attrbutes major, minor, etc for
> representing semantic version in the form used by most open source (and not
> only) software. The sys module already contains two version objects:
> sys.version_info and the result of sys.getwindowsversion().
>
> There is a support of version objects in Perl [1] and .NET [2]. There are
> third-party Python implementations ([3], [4], [5]).
>
> Version objects can be used for representing:
>
> 1. Version of Python itself (sys.version_info).
> 2. Version of OS and system libraries.
> 3. Static and runtime versions of wrapped libraries (zlib, expat, sqlite,
> curses, Tcl/Tk, libffi, libmpdec).
> 4. Versions of third-party modules.
>
> The benefit of version objects against plain strings is that version objects
> are comparable with expected rules (1.2.3 < 1.10.1).
>
> The benefit of version objects against tuples is human readable string
> representation and named attributes for components.
>
> [1] http://search.cpan.org/perldoc?version
> [2]
> https://msdn.microsoft.com/en-us/library/system.version%28v=vs.110%29.aspx
> [3] https://pypi.python.org/pypi/semantic_version
> [4] https://pypi.python.org/pypi/versions
> [3] https://pypi.python.org/pypi/version
> https://pypi.python.org/pypi/SemVerPy
Something like
https://hg.python.org/cpython/file/tip/Lib/distutils/version.py
https://hg.python.org/cpython/file/tip/Lib/distutils/versionpredicate.py
???
Oleg.
--
Oleg Broytman http://phdru.name/ phd at phdru.name
Programmers don't die, they just GOSUB without RETURN.
More information about the Python-ideas
mailing list