fix: exclude setuptools.tests from wheel distribution#5214
fix: exclude setuptools.tests from wheel distribution#5214
Conversation
The exclude patterns '*.tests' and '*.tests.*' match packages named like 'foo.tests' but do not match 'setuptools/tests' because that directory is a subpackage of setuptools, not a top-level package matching the glob. Add explicit 'setuptools.tests' and 'setuptools.tests.*' to the exclude list so test files are not included in the wheel. Fixes pypa#5212 Signed-off-by: bahtya <bahtyar153@qq.com>
|
Hi @Bahtya, thank you very much for the contribution. I believe that this change is not working as expected: the original glob pattern itself should be working fine, but there is a different problem that influences the behaviour (a complicated one, nevertheless, because half of the community wants it to behave in a way while the other half wants it to behave in a different way: #3260, #3340) But, just for the sake of sanity checking, could you please add some tests that assert that the proposed changes work to achieve the expected results? |
|
Thanks for the feedback! I see the linked issues about the glob exclude pattern complexities. Looking at this more carefully: if I'll investigate the actual wheel contents to understand what's happening. Could you point me to where in the build pipeline the exclude patterns are applied? Is the issue perhaps that |
|
Hi @abravalheri, just checking if you had a chance to review my follow-up. I understand the glob exclude pattern concern — happy to adjust the approach if the current one doesn't meet the project's needs. Thanks! |
|
Hi @Bahtya I suggest having a look on the issues I pointed out in my previous comment #5214 (comment). I suggest start by adding the tests to make sure the changes achieve what you want to achieve... Then you can double check if the approach you are suggesting is appropriate or not. |
…work The existing exclude patterns `*.tests` and `*.tests.*` already correctly exclude `setuptools.tests` and its subpackages via fnmatch glob matching. The explicit `setuptools.tests` and `setuptools.tests.*` patterns were redundant. Add TestGlobExcludePatterns to verify the glob exclude patterns work as expected, addressing the maintainer's review feedback. Bahtya Signed-off-by: Bahtya <bahtyar153@qq.com>
Problem
Starting from some release between v69.0.2 and v81.0.0, setuptools includes its own test suite in the wheel distribution. This violates the packaging guide:
Root Cause
The
excludepatterns inpyproject.toml:These glob patterns match packages named like
foo.testsbut do not matchsetuptools/tests/because that is a subpackage ofsetuptools, not a top-level package matching the*.testspattern.Solution
Add explicit entries for the actual test package:
Fixes #5212