pythonvirtualenvpackagingpipdistutils

Where are 'package data' files?


I've created package with distutils including package data. When i look in tar.gz of my package I see expected files, BUT after package installation (by pip or by 'python setup.py install') there is no any package data. Only python scripts included. My setup.py is:

# py3.3
#from packaging.core import setup
# py3.2
from distutils.core import setup

setup(
    name = 'mypkg',
    version = '0.7dev',
    author = 'author',
    author_email = 'email',
    packages = [
        'my_pkg',
        'my_pkg/tests',
        'my_pkg/plugins',
    ],
    #scritps=['bin/setup.sh',],
)

Solution

  • Package data to be installed should be included as a package_data={} dictionary passed to the setup() function. Each dictionary gives the module (package) to be installed and a list of patterns to find data files to be installed from/with it, such as:

    package_data = {
        'exceptional_middleware': [ 'templates/http_responses/*.html' ],
    }
    

    Additionally, you may prefer not to install your tests (just drop pkg/tests from the packages list).