Adding & removing files to & from the source distribution is done by writing a MANIFEST.in file at the project root.
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 .
A manifest file in computing is a file containing metadata for a group of accompanying files that are part of a set or coherent unit. For example, the files of a computer program may have a manifest describing the name, version number, license and the constituent files of the program.
No, you do not have to use MANIFEST.in
. Both, distutils
and setuptools
are including in source
distribution package all the files mentioned in setup.py
- modules, package python files,
README.txt
and test/test*.py
. If this is all you want to have in distribution package, you do
not have to use MANIFEST.in
.
If you want to manipulate (add or remove) default files to include, you have to use MANIFEST.in
.
The procedure is simple:
Make sure, in your setup.py
you include (by means of setup
arguments) all the files you feel important for the program to run (modules, packages, scripts ...)
Clarify, if there are some files to add or some files to exclude. If neither is needed, then there is no need for using MANIFEST.in
.
If MANIFEST.in
is needed, create it. Usually, you add there tests*/*.py
files, README.rst
if you do not use README.txt
, docs
files and possibly some data files for test suite, if necessary.
For example:
include README.rst
include COPYING.txt
To test it, run python setup.py sdist
, and examine the tarball created under dist/
.
Comparing the situation today and 2 years ago - the situation is much much better - setuptools
is the way to go. You can ignore the fact, distutils
is a bit broken and is low level base for setuptools
as setuptools
shall take care of hiding these things from you.
EDIT: Last few projects I use pbr
for building distribution packages with three line setup.py
and rest being in setup.cfg
and requirements.txt
. No need to care about MANIFEST.in
and other strange stuff. Even though the package would deserve a bit more documentation. See http://docs.openstack.org/developer/pbr/
Old question, new answer:
No, you don't need MANIFEST.in
. However, to get setuptools
to do what you (usually) mean, you do need to use the setuptools_scm
, which takes the role of MANIFEST.in
in 2 key places:
sdist
command (where all relevant files is defined as "all files under source control")include_package_data
to include package data as part of the build
or bdist_wheel
. (again: files under source control)The historical understanding of MANIFEST.in
is: when you don't have a source control system, you need some other mechanism to distinguish between "source files" and "files that happen to be in your working directory". However, your project is under source control (right??) so there's no need for MANIFEST.in
. More info in this article.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With