[Distutils] uses for setup.cfg and extracting data from it

Ben Finney ben+python at benfinney.id.au
Wed Sep 9 15:25:46 CEST 2009


Chris Withers <chris at simplistix.co.uk> writes:

> Do people generally source control their package's setup.cfg?

Yes. I prefer the distribution metadata to be declarative, for the
reasons you touch on later in your message. So where it makes sense I
store it in ‘setup.cfg’ or some other declarative file, and put it under
VCS like any other file needed for generating the distribution.

> http://docs.python.org/distutils/configfile.html sort of implies it
> should be editable by the person installing the package

Yes, that's part of its purpose: to allow customisation of the various
actions of distutils.

> but I've never personally used a package where that's the case...

I don't understand. When you, as the person installing the distribution,
get the sdist for that distribution, you can edit (or create, if it
didn't exist) the ‘setup.cfg’. What's stopping you from doing so?

> Assuming the distutils docs are out of date and this file is really
> "owned" by the package maintainer

If the distribution maintainer generates and distributes sdist files,
then they can “own” the ‘setup.cfg’ file without hindering the
recipient's customisation of the same file at installation time.

> how do I extract information from it in setup.py (and elsewhere for
> that matter!)

That's one of the pain points of the current distutils capability:
there's no standard-library way to extract that information. Various
efforts are under way to try to change that, but the legacy of existing
distributions is heavy and long.

You'll probably be interested in the discussions currently ongoing in
the Distutils SIG, regarding how to get the distribution metadata so
it's stored declaratively to make it easier to extract.

-- 
 \         “I have yet to see any problem, however complicated, which, |
  `\      when you looked at it in the right way, did not become still |
_o__)                                more complicated.” —Paul Anderson |
Ben Finney



More information about the Distutils-SIG mailing list