5

My project structure looks like this:

package1/  # a lot of files, submodules here.
package2/  # a lot of files, submodules here.
package3/  # a lot of files, submodules here.
tests/
setup.py

I have a setup.py test similar to:

setup(
    name='MyPackage',
    packages=find_packages(exclude=['tests']),
    package_data={
        'package': ['./path/*.xsd'],
    },
    include_package_data=True,
    py_modules=['package1'],
    version=__version__,
    description='My description',
    classifiers=[
        'Programming Language :: Python :: 2.7',
        'Programming Language :: Python :: 3',
    ],
    zip_safe=False,
    author='Me',
    author_email='example@example.com',
    url='http://www.example.com/',
    keywords=['Keyword1', 'Keyword2'],
    scripts=['./script1.py', './script2.py'],
    install_requires=[
        'isodate',
        'pycurl',

    ],
    extras_require={':python_version < "3.0"': ['enum34', 'future']}
)

I'm using this in the following way:

python setup.py bdist_wheel -d .

After that, I'm installing it via:

pip install MyPackage-1.1.0.whl

It works fine, but...

After this installation into the virtual environment, I've found that one configuration file is missing from the package2. It looks similar to:

package2/
    http/
        api/
            http.py
            api.yaml
            ...

Interesting that http.py and other files from this package exists, but api.yaml disappears from this package somewhere.

So, the question is: how it might be possible and do somebody has any ideas?

UPDATE:

I've found that all non-Python files are missing...

smart
  • 1,975
  • 5
  • 26
  • 46

1 Answers1

6
package_data={
    'package': ['./path/*.xsd'],
},

The key(s) for the dictionary must be your real package name(s). Values must be list of patterns to include. To include package2/http/api/api.yaml:

package_data={
    'package2': ['http/api/*.yaml'],
},

List all your non-python files and patterns.

Another approach would be to create MANIFEST.in (normally used for source distribution) and add

include_package_data=True,

in setup().

phd
  • 82,685
  • 13
  • 120
  • 165