2

I have a python package structured as below:

mypackage
├───build
├───dist
├───mypackage-------> file1.py, file2.py
│   └───templates-->temp.html
└───test
└───MANIFEST.in
└───setup.py

what I'm trying to do is to include the templates folder. Here is the relevant part of my setup.py

setup(
    packages=find_packages(),
    include_package_data=True,
    package_data = {'mypackages': ['templates/*.html']},

and here is my MANIFEST.in

include mypackage/templates
recursive-include mypackage/ *.html

To produce the zip file, I use this command:

python setup.py sdist

Any ideas why the templates folder does not get included?

max
  • 9,708
  • 15
  • 89
  • 144
  • 1
    Are you missing an `__init__.py` in the templates folder? And this: http://www.scotttorborg.com/python-packaging/non-code-files.html – Gullydwarf Nov 14 '14 at 09:08
  • I do not have `__init__.py` in the template folder. I had tried putting it there but that only causes the folder to be included without the temp.html inside that folder. As for the manifest, I updated my post. It already includes mypackage/templates – max Nov 14 '14 at 17:10

1 Answers1

1

You have to use MANIFEST.in to specify file to be included.

Duplicate: How to include package data with setuptools/distribute?

2 techniques for including files in a Python distribution: which is better?

Community
  • 1
  • 1
kwarunek
  • 12,141
  • 4
  • 43
  • 48