Reputation: 1307
I know roughly similar questions have already been asked, but I can't seem to find the solution to my particular problem (or my error!).
I am building a small Python package for myself, so I can use several functions without caring about folders and paths. For some of these functions (e.g., for interpolation), I need additional files which should also be copied when installing the package. I can't get this to work no matter what I try. I am also puzzled about how to add these files without explicitly specifying their paths once installed.
Here is the structure of my package
my_package
├── setup.py
├── README.rst
├── MANIFEST.in
├── my_package
│ ├── __init__.py
│ └── some_stuff.py
├── tables
│ ├── my_table.txt
my_Table.txt
is the additional file that I need to install, so I have set my MANIFEST.in to
include README.rst
recursive-include tables *
And my setup.py
looks like this (including the include_package_data=True
statement)
from setuptools import setup
setup(name='my_package',
version='0.1',
description='Something',
url='http://something.com',
author='me',
author_email='an_email',
license='MIT',
packages=['my_package'],
include_package_data=True,
zip_safe=False)
However, after running python setup.py install
, I can't find my_table.txt
anywhere. What am I doing wrong? Where/how are these files copied? And after installing the package, how would you get the path of my_table.txt
without explicitly writing it?
Thanks a lot!
Upvotes: 0
Views: 373
Reputation: 63
I took the time to try your code/structure.
As it is, with packages=['my_package'],
it only install the content of "my_package" (the subfolder).
You could use "find_packages" in your setup.py, I made it works with your structure.
from setuptools import setup, find_packages
setup(name='my_package',
version='0.1',
description='Something',
url='http://something.com',
author='me',
author_email='an_email',
license='MIT',
packages=find_packages(),
include_package_data=True,
zip_safe=False)
You can read more on "find_packages" here: https://pythonhosted.org/setuptools/setuptools.html#using-find-packages
Hope this help.
Upvotes: 1