Python Setup Tools : Adding Non-Code Files

Took from

Often packages will need to depend on files which are not .py files: e.g. images, data tables, documentation, etc. Those files need special treatment in order for setuptools to handle them correctly.

The mechanism that provides this is the file. This is relatively quite simple: is really just a list of relative file paths specifying files or globs to include.:

include README.rst  
include docs/*.txt  
include funniest/data.json  

In order for these files to be copied at install time to the package’s folder inside site-packages, you’ll need to supply include_package_data=True to the setup() function.

Konpat Preechakul

Read more posts by this author.