I created and published a Python package, but I just can't get it to include a text file.
Here is the repository: https://github.com/void4/gimpscm
The file I need to include is procdump.txt, located in the gimpscm-directory.
So the layout is like this:
setup.py
setup.cfg
MANIFEST.in
gimpscm/
/__index__.py
/procdump.txt
/(other .py files)
I tried:
The current setup.py includes:
package_data = {"gimpscm": ["gimpscm/procdump.txt"]},
include_package_data=True,
And MANIFEST.in contains:
recursive-include gimpscm *.txt
The txt file is included like the .py files in the gimpscm subdirectory of the zip in the dist directory. But when I pip install gimpscm
, the file simply isn't installed.
I publish the package this way:
python setup.py sdist
twine upload dist/*
On the pypi website, the uploaded package DOES include the txt file, it just isn't included on the pip install
.
This process so far has been extremely frustrating, and Stackoverflow and other sites do not give a clear answer. I've tried both the MANIFEST.in and setup.py directive approaches, in every combination. It still doesn't work. The Python docs are also too convoluted and unclear for me.
The solution is a combination of @m.rp and @vin's answers:
Instead of from distutils.core import setup
use
from setuptools import setup
include the following argument to the setup() call
include_package_data=True,
and ONLY use the MANIFEST.in to include files, where the directory is specified relative from the location where the MANIFEST.in file is.
recursive-include gimpscm *.txt
What a massive PITA this was. Thank you for your answers!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With