[Distutils] distribute 0.6.10 and convert_2to3_doctests

Tarek Ziadé ziade.tarek at gmail.com
Fri Jan 29 22:54:44 CET 2010

On Fri, Jan 29, 2010 at 10:29 PM, Lennart Regebro <regebro at gmail.com> wrote:
> On Fri, Jan 29, 2010 at 22:27, Tarek Ziadé <ziade.tarek at gmail.com> wrote:
>> On Fri, Jan 29, 2010 at 10:05 PM, Barry Warsaw <barry at python.org> wrote:
>> [..]
>>> However, it would be nice if setuptools/distribute supported something like
>>> this out of the box.  The important thing is to have exactly one place to set
>>> the package's version number.
>> For metadata fields like "version", one option I am working on in
>> Distutils itself is to have a complementary section in the static
>> setup.cfg file, where you can set some fields:
>>  [setup]
>>  name=foo
>>  version=1.9.8
>> Once setup() is run, the Distribution class will look at this file, to
>> complete the options provided by code;
>> Of course this supposes that the version is not calculated by some
>> code (like in your solution). But I think a plain, non-development
>> version, can be static.
> What you want is then a simple way of getting this version number into
> the python code. Any recommendations for that?

It depends on what code. Let's say that we want to have one and only
one place for the
"version" value.

There are two type of code in a Distutils-based project. The one that
is used in setup.py to create distribution, compile extensions (I'll
call it the "build code"), and the one that is installed on the target

For the build code, if Distutils has the capability to get metadata
from setup.cfg, then it would be just a matter of publishing an API
for getting it as well in there.

Now, if the project is installed, setup.[py/cfg] are gone, and the
only place where the version is located is the PKG-INFO file.
Distribute/Setuptools provides and APIs to read this PKG-INFO file and
get it already. IOW, in the packages and modules of the project, this
API can be used.

The only concern I have is that the development mode (e.g. getting the
version in the packages and modules of the project when it's not
installed) supposes that the "develop" command was called (so that the
PKG-INFO file is locally available).

But I would definitely completely isolate setup.py code from the
project' packages/modules to avoid problems.


More information about the Distutils-SIG mailing list