How include static files to setuptools - python package
As pointed out in the comments, there are 2 ways to add the static files:
1 - include_package_data=True + MANIFEST.in
A MANIFEST.in
file in the same directory of setup.py
that looks like this:
include src/static/*
include src/Potato/*.txt
With include_package_data = True
in setup.py
.
2 - package_data in setup.py
package_data = {
'static': ['*'],
'Potato': ['*.txt']
}
Specify the files inside the setup.py
.
Do not use both include_package_data
and package_data
in setup.py
.
include_package_data
will nullify the package_data
information.
Official docs:
https://setuptools.readthedocs.io/en/latest/userguide/datafiles.html
Include all files recursively:
recursive-include project_name/templates *
recursive-include project_name/static *
where project_name
is a folder in the same line where you have setup.py
file.
Use following
packages = ['.','templates','static','docs'],
package_data={'templates':['*'],'static':['*'],'docs':['*'],},