34

I have a python project with the following structure:

Clustering  (project name)
  clustering  (package)
    clustering.py and other modules
    tests  (sub-package)
      test_clustering.py and other such files
  docs/
  bin/

I would like to include the docs directory in my distribution, but I can not seem to do that. Any pointers about how this can be done would be very helpful.

My current setup.py looks like this:

from distutils.core import setup
setup(name='Clustering',
      version='1.0',
      description='desc',
      author='A',
      author_email='[email protected]',
      packages=['clustering', 'clustering.tests'],
      requires=['numpy', 'scipy'],
      scripts=['bin/predict', 'bin/verify']
     )

I tried using the package_data option but haven't been successful in including the docs directory in the distribution. Is there some other conventional way of including your docs in the distribution?

2
  • See Adding Non-Code Files in the packaging docs. Commented Sep 11, 2018 at 16:29
  • What is the purpose of including the docs in the source distribution? Commented Nov 13, 2018 at 19:10

1 Answer 1

52

You'll need to create a MANIFEST.in file and include some simple instructions on what extra files you want to include (See MANIFEST.in Template)

Example (to include docs dir and all files directly underneath):

include docs/*

or, to include all files in the doc dir (recursively):

recursive-include docs *
Sign up to request clarification or add additional context in comments.

3 Comments

graft docs should work as well as recursive-include docs *, right? Is there a difference?
Need to add include_package_data=True in your setup.py
Would this retain the full subdirectory tree structure of docs/ and also reflect that same structure in the installed package?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.