docs: add common MANIFEST.in pitfalls section (recursive-include patterns, anchored vs global excludes) - #5313
Open
CAOShurong wants to merge 1 commit into
Open
CAOShurong wants to merge 1 commit into
CAOShurong wants to merge 1 commit into
Conversation
The 'Controlling files in the distribution' guide documents the MANIFEST.in command table but gives no examples for recursive-include, which has repeatedly tripped users up (pypa#4158): a bare 'recursive-include <dir>' without at least one file pattern is a template error, not an 'include everything' shorthand, and anchored exclude patterns are easily mistaken for global-exclude. Add a short 'Common MANIFEST.in pitfalls' section covering: - recursive-include requires >=1 file pattern; use graft for whole trees - include/exclude patterns are root-anchored vs global-* name matching Fixes pypa#4158 Signed-off-by: Shurong Cao <CAOShurong@users.noreply.github.com>
Contributor
|
Tick the box to add this pull request to the merge queue (same as
|
Contributor
|
Existing alternative docs PR: #5261 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #4158
Summary
The "Controlling files in the distribution" guide documents the
MANIFEST.incommand table, but gives no worked example forrecursive-include. That has repeatedly tripped users up (see #4158, migrated from the packaging docs in 2023):recursive-include <dir>with no file pattern does not mean "include everything under this directory" — it is a template error ('recursive-include' expects <dir> <pattern1> <pattern2> ...), and the build fails. The "include everything" tool isgraft.include/excludepatterns are matched against paths relative to the project root (anchored), whileglobal-include/global-excludematch file names anywhere — soexclude *.pycsilently matches nothing when users expect a recursive exclusion.What this PR adds
A short "Common MANIFEST.in pitfalls" section after the existing src-layout example:
plus two bullet points contrasting anchored vs global pattern matching.
Docs-only change to
docs/userguide/miscellaneous.rst; no code touched.Verification
Every claim in the new text was exercised against the current implementation:
recursive-include folder *.html→ includes only.htmlfiles at any depth underfolder/recursive-include folder→ raisesDistutilsTemplateError: 'recursive-include' expects <dir> <pattern1> <pattern2> ...graft folder+global-exclude *.css→.cssremoved from the treegraft folder+exclude *.css→.csskept (anchored exclude matches nothing), confirming the anchored-vs-global distinctionFull Sphinx HTML build of
docs/succeeds and the new section renders correctly.