fix(setup.py): exclude top-level test/ from find_packages#4361
fix(setup.py): exclude top-level test/ from find_packages#4361Anai-Guo wants to merge 1 commit intopytorch:mainfrom
Conversation
The top-level test/ directory contains an __init__.py and is currently shipped under site-packages/test/, polluting the import namespace and conflicting with any other package or local module named 'test'. Add 'test' and 'test.*' to the existing find_packages exclude list so that test code stays in the source tree but is not installed. Fixes pytorch#4360
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/ao/4361
Note: Links to docs will display an error until the docs builds have been completed. ❌ 2 New FailuresAs of commit eb96764 with merge base 28e6aca ( NEW FAILURES - The following jobs have failed:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
@claude can you review this PR, and also debug why did |
PR Review and Root Cause Investigation
Review of PR #4361The change is correct and well-scoped. The one-line diff at # Before
packages=find_packages(exclude=["benchmarks", "benchmarks.*"]),
# After
packages=find_packages(exclude=["benchmarks", "benchmarks.*", "test", "test.*"]),This correctly excludes the top-level No issues found. The change is minimal, safe, and addresses a real packaging bug (namespace pollution with a common name like Root Cause InvestigationWhy Why # test/prototype/pat/test_pat_proxmap.py
from test.prototype.pat.test_common import DistributedTestMixin, make_prox_kwargs
# test/prototype/moe_training/ep/test_compile.py
from test.prototype.moe_training.testing_utils import generate_split_sizesThere are 7 Which PR introduced it: Unfortunately, this CI environment uses a shallow git clone (only 2 commits available), so I cannot definitively trace back through the full history to identify the exact PR that first added To find the exact PR, you can run locally with full history: git log --diff-filter=A --format="%H %s" -- test/__init__.pyRecommendation: This PR is good to merge as-is. As a follow-up, the team might consider converting those CI FailuresThe two CI failures appear unrelated to this change:
|
Summary
Adds
"test"and"test.*"to thefind_packages(exclude=...)list insetup.py.Why
The top-level
test/directory contains an__init__.py, sofind_packagespicks it up andpip install torchaoships atestpackage undersite-packages/test/.... That:testtestpackage (or with the user's owntestmodule)Repro (per #4360)
After this fix the
testpackage is no longer installed; the test code stays in the source tree where it belongs.Scope
One-line change to
setup.py. No runtime behavior change. No effect ontorchaopackage contents.Fixes #4360.
🤖 Generated with Claude Code