{"id":3922,"library":"check-manifest","title":"Check Manifest","description":"check-manifest is a command-line tool designed to verify the completeness of the `MANIFEST.in` file in Python source packages, helping developers avoid accidentally omitting files from source distributions. It does this by comparing files under version control with those included in a generated source distribution. The current version is 0.51, and the project maintains an active release cadence, often aligning updates with new Python version support and essential bug fixes.","status":"active","version":"0.51","language":"en","source_language":"en","source_url":"https://github.com/mgedmin/check-manifest","tags":["packaging","manifest","sdist","development tools","cli","ci/cd"],"install":[{"cmd":"pip install check-manifest","lang":"bash","label":"Install stable version"}],"dependencies":[{"reason":"Required for building source distributions during checks.","package":"build","optional":false},{"reason":"Likely used for testing internal components. Explicitly listed as a runtime dependency.","package":"mock","optional":false},{"reason":"Essential for Python package building and interaction with `setup.py`.","package":"setuptools","optional":false},{"reason":"Used for parsing `pyproject.toml` configuration files, especially for Python versions < 3.11 where `tomllib` is built-in.","package":"tomli","optional":false},{"reason":"Optional dependency, typically for running tests if contributing to the library.","package":"pytest","optional":true},{"reason":"Optional dependency, used for building wheel distributions. May be pulled in by `build`.","package":"wheel","optional":true}],"imports":[],"quickstart":{"code":"import subprocess\nimport os\nimport shutil\n\n# Create a dummy project structure for demonstration\nproject_dir = \"my_package_to_check\"\nos.makedirs(f\"{project_dir}/my_package\", exist_ok=True)\nwith open(f\"{project_dir}/setup.py\", \"w\") as f:\n    f.write(\"from setuptools import setup\\nsetup(name='my_package', version='0.1.0')\\n\")\nwith open(f\"{project_dir}/my_package/__init__.py\", \"w\") as f:\n    f.write(\"import os\\n\n__version__ = '0.1.0'\\n\")\nwith open(f\"{project_dir}/README.md\", \"w\") as f:\n    f.write(\"# My Package\")\n\nprint(f\"Created dummy project in {project_dir}/\")\n\n# Simulate initial git init and add/commit for check-manifest to work\n# check-manifest needs a VCS to compare against.\nsubprocess.run([\"git\", \"init\", \"-b\", \"main\"], cwd=project_dir, capture_output=True, text=True)\nsubprocess.run([\"git\", \"add\", \".\"], cwd=project_dir, capture_output=True, text=True)\nsubprocess.run([\"git\", \"commit\", \"-m\", \"Initial commit\"], cwd=project_dir, capture_output=True, text=True)\n\nprint(\"\\n--- Running check-manifest (expecting no MANIFEST.in, so it will suggest one) ---\")\n# Run check-manifest without updating initially\nresult = subprocess.run(\n    [\"check-manifest\"],\n    cwd=project_dir,\n    capture_output=True,\n    text=True,\n    check=False\n)\nprint(result.stdout)\nprint(result.stderr)\nif result.returncode != 0:\n    print(\"check-manifest detected issues (as expected without MANIFEST.in).\")\n\nprint(\"\\n--- Running check-manifest with -u to update MANIFEST.in ---\")\nresult_update = subprocess.run(\n    [\"check-manifest\", \"-u\"],\n    cwd=project_dir,\n    capture_output=True,\n    text=True,\n    check=False\n)\nprint(result_update.stdout)\nprint(result_update.stderr)\nif result_update.returncode == 0:\n    print(\"check-manifest -u successfully created/updated MANIFEST.in.\")\n    with open(f\"{project_dir}/MANIFEST.in\", \"r\") as f:\n        print(\"\\n--- Generated MANIFEST.in content ---\")\n        print(f.read())\nelse:\n    print(\"check-manifest -u failed.\")\n\n# Cleanup\nshutil.rmtree(project_dir)\nprint(f\"\\nCleaned up dummy project directory: {project_dir}\")","lang":"python","description":"check-manifest is primarily used as a command-line tool. This quickstart demonstrates how to run it within a Python script to verify a project's `MANIFEST.in` (or generate one if missing). It sets up a temporary project with `git` to simulate a real-world scenario, then runs `check-manifest` to identify missing files and subsequently uses the `-u` flag to automatically update the `MANIFEST.in`."},"warnings":[{"fix":"Upgrade your Python interpreter to version 3.8 or higher. If you must use an older Python, pin check-manifest to a compatible version (e.g., `<0.51` for Python 3.7).","message":"check-manifest version 0.51 dropped support for Python 3.7. Earlier versions (e.g., 0.45) also dropped Python 3.5 support. Ensure your development environment uses Python 3.8 or newer for compatibility.","severity":"breaking","affected_versions":">=0.51 (drops Python 3.7), >=0.45 (drops Python 3.5)"},{"fix":"While there's no direct fix within user configuration, be aware of potential performance impacts. Consider running `check-manifest` less frequently or in separate steps if it becomes a bottleneck. Monitor its execution time in your CI/CD.","message":"Users have reported significant performance degradation, particularly starting from version 0.41 and continuing in later releases. This can lead to slower CI/CD pipelines or local checks, especially in larger projects.","severity":"gotcha","affected_versions":">=0.41"},{"fix":"Always ensure your working directory changes are committed (or at least staged) in your VCS before running `check-manifest` to get accurate results. If a file is genuinely meant to be removed, commit its deletion first.","message":"check-manifest relies on the state of your Version Control System (VCS), like Git. Uncommitted changes, particularly deleted files, can cause `check-manifest` to report them as 'missing from sdist' until these changes are committed to your VCS.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}