[Distutils] Data files with setuptools
Jannis Leidel
jannis at leidel.info
Tue Jul 28 09:56:47 CEST 2009
Am 27.07.2009 um 20:17 schrieb P.J. Eby:
> At 11:36 AM 7/27/2009 -0500, Robert Kern wrote:
>> On 2009-07-27 11:29, Adeel Ahmad Khan wrote:
>>>> The README is not "package data" because it's not inside a
>>>> package. You
>>>> can't install package data in a project that only includes
>>>> modules. In any
>>>> case, there's no point in shipping documentation inside an egg,
>>>> because only
>>>> your project's *code* will be able to read it, not humans. Human-
>>>> readable
>>>> documentation only belongs in a source distribution.
>>>
>>> I'm writing a command-line program and I was using the README to
>>> print
>>> help. Should I just copy the README into my module then or is
>>> there a
>>> better way?
>>
>> Most likely, the README and the help text should be different.
>> READMEs need information like how to install the program. Help text
>> does not.
>
> However, if you do need some sort of data files included with your
> code, it's simplest to use a package, i.e. a subdirectory with an
> __init__.py. If you use 'include_package_data=True' with setuptools
> (and the data files are under revision control), they will be
> included at install time, and accessible using
> pkg_resources.resource_string() etc.
Note, this only works with Subversion out of the box. But there are
plugins for all major version control systems that enable setuptools
to include package data under version control, e.g. setuptools-git.
Jannis
More information about the Distutils-SIG
mailing list