Skip to content

Only check excludes against file sources #2867

@e-nomem

Description

@e-nomem

This mostly came from realizing that the exclude configuration can be used to skip files generated by maturin itself. E.g. exclude = ["PKG-INFO"] will cause invalid sdists to be generated since the mandatory PKG-INFO file will be skipped. I can't think of a case where the user should exclude a file that maturin itself generated.

It seems the easiest way to address this is by only checking exclude on sources, but this does change the behavior in one specific case. If the user configured python-source or is using 'src' layout and specified an exclude using the target path. E.g. the file is physically at <project_root>/python/my_library/some_file.py and configured exclude = ["my_library/some_file.py"], the file would no longer be properly excluded. I can see this potentially happening if the project mixes source and test files but wants to exclude the tests from the wheel.

Would it make sense to deprecate the target exclusion behavior? A warning could be emitted if a target exclusion matches any file for a few versions before removing it as a breaking change.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions