I have a Python package with a standard setup.py installer but I cannot for the life of me get it to install some pre-defined configuration files into site-packages somewhere... my setup() function is called like this:
setup(
name='Hydrant',
version=version,
description=long_description,
author='Scott Frazer',
author_email='[email protected]',
packages=['hydrant'],
package_data={'hydrant': ['sql/*.sql', 'hydrant.conf', 'hydrant.deploy']},
data_files=[('config', ['hydrant/hydrant.conf'])],
install_requires=[
"xtermcolor>=1.0.3",
"pyyaml",
"pymysql",
"jprops"
],
entry_points={
'console_scripts': [
'hydrant = hydrant.Main:Cli'
]
},
test_suite='hydrant.test',
license = "MIT",
)
I was experimenting around with package_data
and data_files
but they simply don't seem to DO anything. I'm installing into a virtual environment with the command line:
$ python setup.py install
Any insight would be greatly appreciated!
Place the files that you want to include in the package directory (in our case, the data has to reside in the roman/ directory). Add the field include_package_data=True in setup.py. Add the field package_data={'': [... patterns for files you want to include, relative to package dir...]} in setup.py .
Installing Python Packages with Setup.py To install a package that includes a setup.py file, open a command or terminal window and: cd into the root directory where setup.py is located. Enter: python setup.py install.
The setup.py FileYour setup.py file is what describes your package, and tells setuptools how to package, build and install it. It is python code, so you can add anything custom you need to it. But in the simple case, it is essentially declarative. http://docs.python.org/3/distutils/
For non-python files to be included in an installation, they must be within one of the installed package directories. If you specify non-python files outside of your package directories in MANIFEST.in, they will be included in your distribution, but they will not be installed.
Try adding a MANIFEST.in
file to your module. Althought AFAIK it's only used to add data to generated packages (eggs or tar.gz distribution files)
Look at this StackOverflow related question/answer.
Others programmers made it work switching to distutils, but i wouldn't recommend it since it's deprecated by distribute.
Look at this other StackOverflow related question/answer
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