[Python-Dev] PEP 396, Module Version Numbers (original) (raw)

Barry Warsaw barry at python.org
Tue Apr 12 20:40:24 CEST 2011


On Apr 10, 2011, at 08:52 AM, Ben Finney wrote:

Nitpick: Please call these “version strings”. A version string is hardly ever just one number, and not in the general case anyway.

The PEP title does say version numbers (plural), and that seems more general than using 'strings' here.

Emily maintains a package consisting of programs and modules in several languages that inter-operate; several are Python, but some are Unix shell, Perl, and there are some C modules. Emily decides the simplest API for all these modules to get the package version string is a single text file named version at the root of the project tree. All the programs and modules, including the setup.py file, simply read the contents of version to get the version string.

This is an often-overlooked case, I think. The unspoken assumption is often that setup.py is a suitable place for the overall version string, but this is not the case when that string must be read by non-Python programs.

I'm not certain that the additional story informs any recommendations made by the PEP. In the case where the version number is kept in some external file, then you'd likely see something like this in setup.py:

setup(version=open('version.txt').read())

or this in foo/init.py:

version = open('version.txt').read()

The details aren't that important, but the fact that the version is kept in an external file doesn't change any of the recommendations the PEP is already making.

Cheers, -Barry -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: not available URL: <http://mail.python.org/pipermail/python-dev/attachments/20110412/63ca90eb/attachment.pgp>



More information about the Python-Dev mailing list