Repository navigation
Stop installing test-only packages with the executorch package - #24143
shoumikhin wants to merge 2 commits into
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/24143
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit c1db4b7 with merge base 4db778e ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
bf070e1 to
5d85ddf
Compare
|
@claude review |
|
Claude finished @shoumikhin's task in 3m 26s —— View job PR Review: #24143I found no blocking issues; the only things to look at are one minor behaviour change in the clean-install probe and a comment wording nit. Detailed reviewSummaryThe PR moves Moving the packages doesn't break any install path that runs tests. Code Quality
RecommendationApprove Neither issue blocks the change. |
5d85ddf to
89d9c5f
Compare
The wheel check in .ci/scripts/wheel/test_clean_install.py hides every package the wheel does not declare, then imports the main modules. It hid them with an import finder that raised an error from find_spec. A missing package does not do that. For a missing package, importlib.util.find_spec returns None, and only an actual import fails. torch._dynamo relies on this: when it loads, it calls find_spec on a list of optional packages, hypothesis among them. So once a package on that list is not declared by the wheel, the check fails even though a real install works. Mark hidden packages with None in sys.modules instead. Python then raises ModuleNotFoundError on import and returns None from find_spec, the same as for a missing package. The error message still says the package is not declared by the wheel.
`pip install executorch` installed four packages that are only there for the test suite: expecttest, hypothesis, kgb and parameterized (plus sortedcontainers, which hypothesis brings). Nothing a user imports needs them. The only shipped modules that need them are used by tests or by the edge dialect YAML generator. Move them from the package's runtime dependencies to requirements-dev.txt. The developer setup (install_requirements.py) and every CI job that runs tests already install that file, so tests still get them.
89d9c5f to
c1db4b7
Compare
|
Thanks for the review.
|
|
@claude review |
|
Claude finished @shoumikhin's task in 3m 49s —— View job PR Review: #24143I found no blocking issues. The dependency move is safe for every install and CI path the reviewers traced, and only two low-severity notes about the clean-install probe remain. Detailed reviewSummaryThe PR moves Code Quality
RecommendationApprove Neither note blocks the change. |
|
Thanks. Both notes are worth knowing, and neither changes a result today.
|
Summary
pip install executorchinstalls four packages that are only there for ExecuTorch's own tests:expecttest,hypothesis,kgbandparameterized.hypothesisalso bringssortedcontainers. So every user installs five packages they never need.This moves the four from the package's runtime dependencies (
_base_dependencies()insetup.py) torequirements-dev.txt. The developer setup and every CI job that runs tests already install that file, so tests still get them.Nothing a user imports needs them. Three shipped files do, but only tests or a code generator use them:
backends/cadence/aot/typing_stubs.py,examples/models/llama/source_transformation/test_attention_sink.py, andexir/dialects/edge/spec/gen.py.Effect, resolving the declared dependencies for Python 3.12 (without
torch): 55 packages before, 50 after on macOS arm64 and Linux x86_64. The same five go away on Linux aarch64 and Windows.Kept on purpose:
coremltoolsandscikit-learn(the Core ML backend needs both), andhydra-core,omegaconf,pandas,tabulateandpytorch-tokenizers, which shipped modules import.The first commit fixes the wheel's clean-install check. It hid undeclared packages so that
importlib.util.find_specraised instead of returningNone.torch._dynamoprobes forhypothesiswithfind_specwhen it loads, so the check failed oncehypothesiswas no longer declared, although a real install works.Test plan
On macOS arm64, in a fresh environment with only the trimmed dependencies,
torch2.14.0 and a nightlyexecutorchinstalled with--no-deps:Tests that use the moved packages pass with
requirements-dev.txtinstalled.