[Distutils] d2to1 setup.cfg schema

Erik Bray erik.m.bray at gmail.com
Tue Mar 31 01:16:45 CEST 2015


On Mon, Mar 30, 2015 at 7:07 PM, Robert Collins
<robertc at robertcollins.net> wrote:
> On 31 March 2015 at 12:03, Erik Bray <erik.m.bray at gmail.com> wrote:
>
>> I haven't followed this whole discussion (I started to in the
>> beginning, but haven't kept up), but I'm not really sure what's being
>> said here.  d2to1 *does* support declaring setup-requires dependencies
>> in setup.cfg, and those dependencies should be loaded before any hook
>> scripts are used.  Everything in d2to1 is done via various hook
>> points, and the hook functions can be either shipped with the package,
>> or come from external requirements installed via setup-requires.  It
>> works pretty well in most cases.
>
> Oh, it does!? I was looking through the source and couldn't figure it
> out. What key is looked for for setup-requires? Also does it define a
> schema for extra-requires?

Yeah, sorry about that.  That's one of those things that was never
actually supported in distutils2 by the time it went poof, and that I
added later.

You can use:

[metadata]
setup-requires-dist = foo

So say, for example you have some package called "versionutils" that's
used to generate the package's version number (by reading it from
another file, tacking on VCS info, etc.)  You can use:

[metadata]
setup-requires-dist = versionutils

[global]
setup-hooks = versionutils.version_hook

or something to that effect.  It will ensure versionutils is
importable (this uses easy_install just like the normal setup_requires
feature in setuptools; I would like to change this one day to instead
use something like Daniel's setup-requires [1] trick).
It will then, fairly early in the setup process, hand the package
metadata over to versionutils.version_hook, and let it insert a
version string.

Erik

[1] https://bitbucket.org/dholth/setup-requires


More information about the Distutils-SIG mailing list