Skip to content

Recursive glob fails to exclude files from sdist #746

Description

@zahlman

The documentation claims:

Changed in version 3.8: Include and exclude patterns can now use recursive glob patterns (**).

However, using flit-core 3.12, I try using this clause in pyproject.toml:

[tool.flit.sdist]
exclude = ["**/*.swp"]

and use build programmatically to invoke flit-core (via a wrapper script):

def build_from_sdist(src, dst):
    builder = ProjectBuilder(src)
    # delete = False for debugging
    with TemporaryDirectory(delete=False) as sdist_build_dir:
        print("THE DIRECTORY IS AT:", sdist_build_dir) # for debugging
        ProjectBuilder(src).build('sdist', sdist_build_dir)

and discover that the resulting sdist still contains those .swp files (corresponding to source files I currently have open in Vim; they are named with a leading .). Although notably it does not include e.g. .pyproject.toml.swp.

Specifying an explicit, complete path to one of the "temporary" files (still leaving everything open in Vim while running the build script) does cause that file to be excluded from the sdist.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions