[Distutils] distlib and data files => resources ?
Chris McDonough
chrism at plope.com
Sun Nov 18 23:45:18 CET 2012
On 11/18/2012 05:33 PM, Tarek Ziadé wrote:
> On 11/18/12 11:15 PM, Chris McDonough wrote:
>> On 11/18/2012 05:08 PM, Vinay Sajip wrote:
>>> Tarek Ziadé <tarek <at> ziade.org> writes:
>>>
>>>> Having a indirection like distutils2's resources allows the data files
>>>> to live alongside the code
>>>> in development and to be installed wherever that's desired by the
>>>> distro, without breaking
>>>> the code as long as it uses the indirection function to find back
>>>> the file.
>>>>
>>>> Since the indirection is provided by a file that can be browsed in the
>>>> metadata directory,
>>>> it means anyone can get the file location by using the API we provided.
>>>
>>> Yes, but it seems like you're assuming everything's always installed
>>> in a
>>> conventional way and not, say, deployed in a .zip. I'm not disputing
>>> what you
>>> said - get_file_path and get_resource_path are still there in distlib
>>> - but I'm
>>> not sure that there's *never* a case for data located in packages.
>>
>> Requiring that developers build an
>> alternate-structure-of-files-that-arent-Python-files-just-because-they-aren't-Python-files
>> outside the package structure seems like a terrible idea.
>
> I think you did not get it.
>
> If you look/read carefully, it's not an alternate structure. The files
> are not moved - they are staying at the same place alongside the Python
> files in your source tree.
>
> The difference is only at installation time: they may be installed
> somewhere else. And when you access them - there's an API to read them
> instead of using __file__.
I don't really take exception to having such a feature (although I would
be unlikely to use it), but I do take exception to the first paragraph
of the description you pointed at:
"This section describes the files used by the project which must not be
installed in the same place that python modules or libraries, they are
called resources. They are for example documentation files, script
files, databases, etc..."
That is not the definition of "resource" in setuptools-derived systems.
The definition of resource in setuptools-derived systems is "a
non-Python file that lives in a package", which is exactly the opposite
of the above definition. I'd suggest to avoid confusion we don't call
"files used by the project that must not be installed in the same place
that python modules or libraries", and we call this other class of
things something else.
- C
More information about the Distutils-SIG
mailing list