Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to include docs directory in python distribution

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?

like image 422
Abhi Avatar asked Oct 27 '11 23:10

Abhi


People also ask

How do I include a file in a Python package?

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 .

What is dist folder in python?

The most important folder is the dist folder because it contains the distribution files which will be uploaded to PyPI. Its content are presented in figure 12. It contains the . whl file which is the build distribution and also the source distribution .

What is manifest in file python?

A MANIFEST.in file consists of commands, one per line, instructing setuptools to add or remove some set of files from the sdist.


1 Answers

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 * 
like image 169
Adam Wagner Avatar answered Sep 28 '22 06:09

Adam Wagner