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?

2
  • 1
    Are you missing an __init__.py in the templates folder? And this: scotttorborg.com/python-packaging/non-code-files.html Commented Nov 14, 2014 at 9: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 Commented Nov 14, 2014 at 17:10

1 Answer 1

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?

Sign up to request clarification or add additional context in comments.

2 Comments

changing MANIFEST.in to this worked: include mypackage/templates/*
So why does this not do the same thing: recursive-include mypackage/ *.html? That was already in his manifest

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.