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) --ignore-bad-ideas patterns ignore bad idea files/directories matching these comma-separated patterns (default: )
You can configure check-manifest to ignore certain file patterns using a [tool.check-manifest] section in your pyproject.toml file or a [check-manifest] section in either setup.cfg or tox.ini. Examples:
# pyproject.toml [tool.check-manifest] ignore = [".travis.yml"] # setup.cfg or tox.ini [check-manifest] ignore = .travis.yml
Note that lists are newline separated in the setup.cfg and tox.ini files.
The following options are recognized:
A list of 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 .hgsigs .hgignore .gitignore .bzrignore .gitattributes .github/* .travis.yml Jenkinsfile *.mo
- If set to true, your ignore patterns will replace the default ignore list instead of adding to it.
- A list of filename patterns that will be ignored by check-manifest’s generated files check. Use this if you want to keep generated files in your version control system, even though it is generally a bad idea.
Version control integration
With pre-commit, check-manifest can be part of your git-workflow. Add the following to your .pre-commit-config.yaml.
repos: - repo: https://github.com/mgedmin/check-manifest rev: "0.47" hooks: - id: check-manifest
If you are running pre-commit without a network, you can utilize args: [--no-build-isolation] to prevent a pip install reaching out to PyPI. If you have additional build-system.requires outside of pip / setuptools / wheel you will want to list those in additional_dependencies.
repos: - repo: https://github.com/mgedmin/check-manifest rev: ... # pick a valid tag / revision hooks: - id: check-manifest args: [--no-build-isolation] additional_dependencies: [setuptools-scm]
- Fix setuptools_scm workaround for packages with dashes in the name (#145).
- The pre-commit hook now always uses Python 3.
- Add Python 3.9 support.
- Drop Python 3.5 support.
- Switch from pep517 to python-build ( #128).
- Add --no-build-isolation option so check-manifest can succeed building pep517-based distributions without an internet connection. With --no-build-isolation, you must preinstall the build-system.requires beforehand. ( #128).
- Try to avoid passing --recurse-submodules to git ls if the project doesn’t use git submodules (i.e. doesn’t have a .gitsubmodules file). This should make check-manifest work again with older git versions, as long as you don’t use submodules (#124).
- Fix collecting files versioned by git when a project has submodules and GIT_INDEX_FILE is set. This bug was triggered when check-manifest was run as part of a git hook ( #122, #123).
Note: check-manifest 0.43 requires git version 2.11 or later.
Added -q/--quiet command line argument. This will reduce the verbosity of informational output, e.g. for use in a CI pipeline.
Rewrote the ignore logic to be more compatible with setuptools. This might have introduced some regressions, so please file bugs! One side effect of this is that --ignore (or the ignore setting in the config file) is now handled the same way as global-exclude in a MANIFEST.in, which means:
- it’s matched anywhere in the file tree
- it’s ignored if it matches a directory
You can ignore directories only by ignoring every file inside it. You can use --ignore=dir/** to do that.
This decision is not cast in stone: I may in the future change the handling of --ignore to match files and directories, because there’s no reason it has to be setuptools-compatible.
Drop Python 2.7 support.
- Ignore subcommand stderr unless the subcommand fails. This avoids treating warning messages as filenames. (#110.)
- Add Python 3.8 support.
- Add Python 3.7 support.
- Drop Python 3.4 support.
- Added GitHub templates to default ignore patterns.
- Added reading check-manifest config out of tox.ini or pyproject.toml.
Drop Python 3.3 support.
Support packages using setuptools_scm (#68).
Note that setuptools_scm usually makes MANIFEST.in files obsolete. Having one is helpful only if you intend to build an sdist and then use that sdist to perform further builds, instead of building from a source checkout.
- Handle empty VCS repositories more gracefully (#84).
- Python 3.6 support.
- Fix WindowsError due to presence of read-only files (#74).
- Fix WindowsError due to git submodules in subdirectories (#73). Contributed by Loren Gordon.
- New config/command line option to ignore bad ideas (ignore-bad-ideas) (issue #67). Contributed by Brecht Machiels.
- Files named .hgsigs are ignored by default. Contributed by Jakub Wilk.
- Drop Python 3.2 support.
- Ignore commented-out lines in MANIFEST.in (issue #66).
- Fix –python with just a command name, to be found in path (issue #57).
- Fix utter breakage on Windows, introduced in 0.26 (issue #52). (The bug – clearing the environment unnecessarily – could probably also cause locale-related problems on other OSes.)
- Do not complain about missing .gitattributes file (PR #50).
- Normalize unicode representation and case of filenames. (issue #47).
- Support installation via zc.buildout better (issue #35).
- Drop Python 2.6 support because one of our test dependencies (mock) dropped it. This also means we no longer use environment markers.
- Stop dynamic computation of install_requires in setup.py: this doesn’t work well in the presence of the pip 7 wheel cache. Use PEP-426 environment markers instead (this means we now require setuptools >= 0.7, and pip >= 6.0, and wheel >= 0.24).
- Make sure setup.py not being added to the VCS doesn’t cause hard-to-understand errors (issue #46).
- 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 an ‘exceptions.Exception’ object but received a ‘str’).
Release history Release notifications | RSS feed
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size check_manifest-0.47-py3-none-any.whl (20.1 kB)||File type Wheel||Python version py3||Upload date||Hashes View|
|Filename, size check-manifest-0.47.tar.gz (42.7 kB)||File type Source||Python version None||Upload date||Hashes View|
Hashes for check_manifest-0.47-py3-none-any.whl