[Distutils] Builders vs Installers

PJ Eby pje at telecommunity.com
Tue Mar 26 21:08:50 CET 2013


On Tue, Mar 26, 2013 at 3:03 PM, Daniel Holth <dholth at gmail.com> wrote:
> I think PKG-INFO is a highly human-editable format.

That doesn't mean you necessarily want to edit it yourself; notably,
there will likely be some redundancy between the description in the
file and other files like the README.

Also, today one of the key use cases people have for custom code in
setup.py is to pull the package version from a __version__ attribute
in a module.  (Which is evil, of course, but people do it anyway.)

But it might be worth adding a setuptools feature to pull metadata
from PKG-INFO (or DIST-INFO) instead of generating a new one, to see
what people think of using PKG-INFO first, other files second.  In
principle, one could reduce a setup.py to just "from setuptools import
setup_distinfo; setup_distinfo()" or some such.

No matter what, though, there's going to be some redundancy with the
rest of the project.  Some people use revision control tags or other
automated tags in their versioning, and it's *precisely* these
projects that most need raw source builds.

Maybe DIST-INFO shouldn't strictly be a PEP 426-conformant file, but
rather, a file that allows some additional metadata to be specified
via hooks.  That way, you could list your version hook, your
readme-generation hook, etc. in it, and then the output gets used to
generate the final PKG-INFO.

So, call it PKG-INFO.in (as Nick said), or BUILD-INFO, or something
like that, add a list of "metadata hooks", and presto: no redundancy
in the file, so people can check it into source control, and minimal
duplication with your build tool.  (Presumably, if you use Bento, your
BUILD-INFO file would just list the Bento hook and nothing else, if
all the other data comes from Bento's .info file.)

Heck, in the minimalist case, you could pretend that a missing
BUILD-INFO was there and contained a hook that runs setup.py to troll
for the metadata, stopping once setup() is called.  ;-)  And now it's
(mostly) backward compatible.


More information about the Distutils-SIG mailing list