[Distutils] Role of distutils.cfg

Christoph Groth christoph at grothesque.org
Thu Nov 10 06:27:07 EST 2016


I have a question on how to best handle parameters to the 
distribution given that they can be shadowed by the global 
configuration file, distutils.cfg.

Our project [1] contains C-extensions that include NumPy’s 
headers.  To this end, our setup.py [2] sets the include_dirs 
parameter of setup() to NumPy’s include path.  We have chosen this 
way, since it allows to add a common include path to all the 
extensions in one go.  One advantage of this approach is that when 
the include_dirs parameters of the individual extensions are 
reconfigured (for example with a build configuration file), this 
does not interfere with the numpy include path.

This has been working well for most of other users, but recently 
we got a bug report by someone for whom it doesn’t.  It turns out 
that his system has a distutils.cfg that precedes over the 
include_dirs parameter to setup() [3].

My question is now: is there a policy on the correct use of 
distutils.cfg?  After all, it can override any parameter to any 
distutils command.  As such, is passing options like include_dirs 
to setup() a bad idea in the first place, or should rather the use 
of distutils.cfg be reserved to cases like choosing an alternative 

Thanks for any clarification,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/distutils-sig/attachments/20161110/dbcca227/attachment.sig>

More information about the Distutils-SIG mailing list