101010
101010

Reputation: 15746

Including resources in a Python package using setup.py

I'm working on a website project.

When I use setup.py and run setup.py build, the build script excludes all of the resources in my web site (basically all of the non python files). What am I doing wrong?

Upvotes: 3

Views: 6961

Answers (1)

Mark Gemmill
Mark Gemmill

Reputation: 5949

The most reliable way I've found to include extra files in a distribution using distutils is to provide a MANIFEST.in file. Place this file in the same directory as your setup.py and include in it the list of resource files you require. For example, your MANIFEST.in file might like this:

include resources/somefile.txt resources/*.png 
recursive-include resources/static *.png *.jpg *.css *.js

See the distutils documentation for more details.

Though I prefer the MANIFEST.in method, if you are using setuptools or distribute, have a look at this answer for an alternative method of doing the same thing.

Upvotes: 6

Related Questions