Check MANIFEST.in in a Python source package for completeness
Are you a Python developer? Have you uploaded packages to the Python Package Index? Have you accidentally uploaded broken packages with some files missing? If so, check-manifest is for you.
$ pip install check-manifest $ cd ~/src/mygreatpackage $ check-manifest
You can ask the script to help you update your MANIFEST.in:
$ check-manifest -u -v listing source files under version control: 6 files and directories building an sdist: check-manifest-0.7.tar.gz: 4 files and directories lists of files in version control and sdist do not match! missing from sdist: tests.py tox.ini suggested MANIFEST.in rules: include *.py include tox.ini updating MANIFEST.in $ cat MANIFEST.in include *.rst # added by check_manifest.py include *.py include tox.ini
$ check-manifest --help usage: check-manifest [-h] [--version] [-v] [-c] [-u] [-p PYTHON] [--ignore patterns] [source_tree] Check a Python MANIFEST.in file for completeness positional arguments: source_tree location for the source tree (default: .) optional arguments: -h, --help show this help message and exit --version show program's version number and exit -v, --verbose more verbose output (default: False) -c, --create create a MANIFEST.in if missing (default: False) -u, --update append suggestions to MANIFEST.in (implies --create) (default: False) -p PYTHON, --python PYTHON use this Python interpreter for running setup.py sdist (default: /home/mg/.venv/bin/python) --ignore patterns ignore files/directories matching these comma- separated patterns (default: None)
You can tell check-manifest to ignore certain file patterns by adding a check-manifest section to your package’s setup.cfg. Example:
[check-manifest] ignore = .travis.yml
The following options are recognized:
A list of newline separated filename patterns that will be ignored by check-manifest. Use this if you want to keep files in your version control system that shouldn’t be included in your source distributions. The default ignore list is
PKG-INFO *.egg-info *.egg-info/* setup.cfg .hgtags .hgignore .gitignore .bzrignore *.mo
- If set to true, your ignore patterns will replace the default ignore list instead of adding to it.
- More terse output by default; use the new -v (--verbose) flag to see all the details.
- Warn the user if MANIFEST.in is missing (issue #31).
- Fix IOError when files listed under version control are missing (issue #32).
- Improved wording of the match/do not match messages (issue #34).
- Handle a relative –python path (issue #36).
- Warn about leading and trailing slashes in MANIFEST.in (issue #37).
- Ignore .travis.yml by default (issue #39).
- Suggest a rule for Makefile found deeper in the source tree.
- Don’t drop setup.cfg when copying version-controlled files into a clean temporary directory (issue #29).
- Read the existing MANIFEST.in file for files to ignore (issue #19).
- Fix Subversion status parsing in the presence of svn usernames longer than 12 characters (issue #18).
- Normalize the paths of all files, avoiding some duplicate misses of directories. (issue #16). [maurits]
- Make sure MANIFEST.in is not ignored even if it hasn’t been added to the VCS yet (issue #7).
- check-manifest --version now prints the version number.
- Don’t apologize for not adding rules for directories (especially after adding rules that include files inside that directory).
- Python 3 support contributed by Steven Myint.
- Default ignore patterns can be configured in setup.cfg (issue #3).
- Add suggestion pattern for .travis.yml.
- When check-manifest -u (or -c) doesn’t know how to write a rule matching a particular file, it now apologizes explicitly.
- Copy the source tree to a temporary directory before running python setup.py sdist to avoid side effects from setuptools plugins or stale *.egg-info/SOURCES.txt files (issue #1).
- Warn if *.egg-info or *.mo is actually checked into the VCS.
- Don’t complain if *.mo files are present in the sdist but not in the VCS (issue #2).
- Entry point for zest.releaser. If you install both zest.releaser and check-manifest, you will be asked if you want to check your manifest during fullrelease.
- First release available from the Python Package Index.
- Moved from https://gist.github.com/4277075 to https://github.com/mgedmin/check-manifest
- Added README.rst, CHANGES.rst, setup.py, tox.ini (but no real tests yet), MANIFEST.in, and a Makefile.
- Fixed a bug in error reporting (when setup.py failed, the user would get TypeError: descriptor ‘__init__’ requires a ‘exceptions.Exception’ object but received a ‘str’).