Skip to content

sdist: match dotfiles in file pattern globbing - #828

Open
DYNOSuprovo wants to merge 1 commit into
pypa:mainfrom
DYNOSuprovo:fix/sdist-recursive-glob-dotfiles-746
Open

DYNOSuprovo wants to merge 1 commit into
pypa:mainfrom
DYNOSuprovo:fix/sdist-recursive-glob-dotfiles-746

Conversation

@DYNOSuprovo

Copy link
Copy Markdown

Fixes #746

Problem

When configuring sdist exclude patterns like exclude = ["**/*.swp"], standard glob.glob ignores hidden files (filenames beginning with ., such as .foo.swp created by editors like Vim) by default. As a result, those files remain included in sdist builds or cause untracked file errors during VCS checks.

Solution

  • Switch FilePatterns in flit_core.sdist to expand patterns using pathlib.Path.glob, which matches hidden dotfiles across all supported Python versions.
  • Normalize patterns for pathlib compatibility (e.g. converting **.ext to **/*.ext).
  • Update default exclude in config.py from **.pyc to **/*.pyc.
  • Add unit tests in flit_core/tests_core/test_sdist.py verifying that recursive glob patterns properly match and exclude dotfiles in FilePatterns and SdistBuilder.

Switch FilePatterns globbing in flit_core to use Path.glob so that recursive patterns like **/*.swp correctly match hidden dotfiles. Normalize pattern syntax for pathlib compatibility and update default sdist exclude **.pyc to **/*.pyc.

Signed-off-by: DYNOSuprovo <DYNOSuprovo@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Recursive glob fails to exclude files from sdist

1 participant