[Distutils] Static metadata using setup.cfg

Tarek Ziadé ziade.tarek at gmail.com
Tue Sep 8 14:20:30 CEST 2009


On Tue, Sep 8, 2009 at 10:29 AM, Chris Withers<chris at simplistix.co.uk> wrote:
> Tarek Ziadé wrote:
>>
>> - an extra function called "long_description", to be able to point a
>> file for the long description field
>
> I can't comment on the others, but this is unnecessary. Why do you need more
> than:
>
> long_decription="some lump of text"
>
> or
>
> long_description_path ="path/relative/to/directory/containing/setup.py"
>
> ...with it being an error for both to be specified?
>
> cheers,
>

The practice in the community is to create the long_description field
using a separate reStructuredText file
and reaching it in setup.py like this for example:

long_description = open('README.txt').read()

Having a callable that provides this feature in the template allows writing:

"""
[setup.cfg]

long_description: {$ long_description('README.txt') $}
"""

Thus avoiding to write anything in setup.py for that particular case.
the callable could be called "read_file()" maybe, so it's clearer.

long_description_path can't be added in the final PKG-INFO because
we want a self-contained metadata static file that doesn't require an
extra resource (like an external file)

Whereas having a file path in setup.cfg.in is acceptable, as long as
the resulting setup.cfg
contains everything needed to get the metadata of the package without
further depenencies.

so if by the time setup.cfg.in is compiled, the path cannot be found,
the field will have its value set to "UNKOWN" in setup.cfg


More information about the Distutils-SIG mailing list