Sourabh Sourabh - 1 year ago 86
Python Question, package_data, and data_files clarification?

I am trying to create a python package, and I have a directory structure like this.


Then I added all the files in and when I check the created archive, it had all the files.

The when I do python
install, in the
. I see only the python files and not the z.txt.

I have the
in manifest and the
as well

setup (
packages = ['mypkg','mypkg.module1','mypkg.module2'],
package_data = {'mypkg':['module1/z.txt']},
include_package_data = True,

I tried adding the file as data_files as well but that created a directory in
. I want to keep it inside the source code directory as the code uses that data.

I have read these posts but I keep getting confused about what is the right way to keep
in the right location after the

Posts: ignored on "python install" - no data files installed?

Installing data files into site-packages with,-more-lies-and-python-packaging-documentation-on--package_data-/

Please help me resolve this issue. I'm still a beginner and this is my first time trying to create something like this.

Answer Source

Update: It got fixed when I started using setuptools instead of distutils.core. I think it was some problem with distutils not agreeing with manifest while setuptools worked without any changes in the code. I recommend using setuptools in the future. Using the link here : setup tools- developers guide

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download