Do python projects need MANIFEST.in, and what should be in it?

The Python Distribution Guide (was on python-distribute.org, but this registration has expired) tells me to include doc/txt files and .py files are excluded in the MANIFEST.in file

the sourcedist documentation tells me that only sdist uses MANIFEST.in and includes only the file you specify and includes .py files. He also tells me to use: python setup.py sdist --manifest-only to generate MANIFEST , but python tells me that this does not exist

I appreciate this from different versions of python, and the distribution system is in but I assume that I use python 3 and setuptools (a new one that includes distribution, but now called setuptools, rather than the old setuptools settings that were deprecated for distributing tools just to be returned to the distribution and distribution, renamed setuptools .....)

and I follow the "standard" folder structure and setup.py file,

  • Do I need MANIFEST.in ?
  • What should be in it?
  • When are all these different systems and methods packaged into one simple process?
+44
python setuptools
Jul 13 '14 at 23:06
source share
1 answer

Re: "Do I need MANIFEST.in?

No, you do not need to use MANIFEST.in . Both distutils and setuptools are included in the distribution source with all the files mentioned in setup.py - modules, python, README.txt and test/test*.py batch files. If this is all you want in the distribution, you do not need to use MANIFEST.in .

If you want to manipulate (add or delete) the default files to include, you must use MANIFEST.in .

Re: What should be in it?

The procedure is simple:

  • Make sure that in setup.py you include (using the setup arguments) all the files that you consider important for running the program (modules, packages, scripts ...)

  • Check if there are some files to add or some files to exclude. If none of them are needed, then there is no need to use MANIFEST.in .

  • If MANIFEST.in is required, create it. You usually add tests*/*.py README.rst files, README.rst if you are not using the README.txt , docs files, and possibly some data files for the test suite, if necessary.

For example:

 include README.rst include COPYING.txt 

To test it, run python setup.py sdist and examine the archive created in dist/ .

When all these different package systems ...

Comparing the situation today and 2 years ago - the situation is much better - setuptools is the way to go. You can ignore the fact that distutils bit broken and is a low level base for setuptools , as setuptools to take care to hide these things from you.

EDIT . The last few projects I use pbr to create distribution packages with three lines of setup.py and the rest are in setup.cfg and requirements.txt . No need to worry about MANIFEST.in and other strange things. Despite the fact that the package deserves more detailed documentation. See http://docs.openstack.org/developer/pbr/

+42
Jul 13 '14 at 23:28
source share



All Articles