Location of data files

Matthias-Christian Ott ott at mirix.org
Fri Apr 1 22:47:45 CEST 2011


On Fri, Apr 01, 2011 at 08:37:35PM +0200, Matthias-Christian Ott wrote:
> I want to include data files with a python package. With distutils it
> seems common to specifiy these files in the data_files argument with a
> non-portable location (e.g. data_files=[('share/example', 'icon.png')]).
> Another approach is to include the file in the Python module of the
> package (e.g. example/data) and specify the submodule in package_data
> argument and load them via pkgutil or pkg_ressources. This method seems
> portable, but doesn't allow customisation and doesn't conform to the
> FHS.
> 
> What is the recommended way to allow easy platform-specific packaging
> (e.g. data files are installed to /usr/share when requested), portability and
> customisation (i.e. data files can be replaced by the user or
> alternative locations can be specified)?

It seems distutils2 will support this:

  http://distutils2.notmyidea.org/setupcfg.html#resources

Regards,
Matthias-Christian



More information about the Python-list mailing list