Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.dougwise.org!gegeweb.org!aioe.org!feeder.news-service.com!news2.euro.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.028 X-Spam-Evidence: '*H*': 0.94; '*S*': 0.00; 'python': 0.07; 'subject:files': 0.09; 'package.': 0.12; 'distutils': 0.16; 'argument': 0.16; '(i.e.': 0.18; 'packaging': 0.19; 'seems': 0.21; 'specify': 0.25; '(e.g.': 0.26; 'subject:data': 0.26; "doesn't": 0.28; 'load': 0.28; 'installed': 0.29; 'hi,': 0.29; "skip:' 10": 0.32; 'to:addr:python-list': 0.32; 'another': 0.32; 'module': 0.33; 'file': 0.35; 'header:User-Agent:1': 0.35; 'allow': 0.36; 'charset:us-ascii': 0.36; 'data': 0.37; 'user': 0.38; 'but': 0.38; 'files': 0.38; 'received:org': 0.38; 'common': 0.39; 'to:addr:python.org': 0.39; 'recommended': 0.40; 'include': 0.40; 'alternative': 0.69 Date: Fri, 1 Apr 2011 20:37:35 +0200 From: Matthias-Christian Ott To: python-list@python.org Subject: Location of data files MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 18 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1301684005 news.xs4all.nl 81482 [::ffff:82.94.164.166]:34338 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:2380 Hi, 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)? Regards, Matthias-Christian