[Distutils] Specifying version information once

Zooko Wilcox-O'Hearn zooko at zooko.com
Tue May 19 21:12:52 CEST 2009


On May 19, 2009, at 12:21 PM, Jean-Paul Calderone wrote:

> What is the recommendation for specifying version information in a  
> way which is compatible with all these new tools?

My personal recommendation is to put the version information in a  
flat text file and have your setup.py read that flat text file  
instead of importing a Python package, e.g.:

http://allmydata.org/trac/zfec/browser/zfec/setup.py?rev=285#L88
http://allmydata.org/trac/pyutil/browser/pyutil/setup.py?rev=141#L44

Another approach is to have the revision control be the single store  
of versioning information, and read it out of revision control  
whenever your setup.py runs.  I believe I've already submitted one  
patch for each of these techniques for Nevow:

http://divmod.org/trac/ticket/2699

A third approach is require setuptools and rely on setuptools's  
implementation of the second approach -- reading versioning  
information from your revision control tool.  That one has obvious  
disadvantages (e.g. The Big Two: http://bugs.python.org/setuptools/ 
issue54 (be more like distutils with regard to --prefix=) and http:// 
bugs.python.org/setuptools/issue53 (respect the PYTHONPATH)), but it  
has the advantage that the implementation of this feature is not in  
your setup.py but is in setuptools or in a setuptools plugin such as  
setuptools_hg or setuptools_bzr.

:-)

Regards,

Zooko


More information about the Distutils-SIG mailing list