[FR] Warn about top-level "tests" package in find_packages() by default
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2.9k
- Forks
- 1.4k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 1
Description
What's the problem this feature will solve?
I often end up reporting bugs about packages using find_packages() without appropriate exclusion lists, that end up installing top-level test or tests directories. These directories are especially problematic since they're bound to cause file collisions between packages, and given their special use I don't think any specific package should be allowed to "own" them.
Describe the solution you'd like
I think it would be best if setuptools could at least warn if find_packages() ends up including test or tests directories, and suggest the package maintainers to exclude them. Perhaps they could also be skipped by default in some future version.
Alternative Solutions
It could be possible to implicitly skip them immediately. While I honestly don't think it would realistically break anything, I'm not sure if someone isn't actually having some workflow relying on this.
Additional context
No response
Code of Conduct
- I agree to follow the PSF Code of Conduct
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the find_packages() entry point and how it handles package discovery and exclusions. Review the issue's two proposed behaviors—warning about top-level test or tests packages versus skipping them—and identify the existing tests around that behavior. Done means the chosen behavior is implemented and covered without unexpectedly breaking current package-discovery workflows.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- build-system
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100