Skip to content

Stop installing test-only packages with the executorch package - #24206

Merged
JacobSzwejbka merged 1 commit into
release/1.6from
cherry-pick-24143-by-pytorch_bot_bot_
Oct 29, 2026
Merged

JacobSzwejbka merged 1 commit into
release/1.6from
cherry-pick-24143-by-pytorch_bot_bot_

Conversation

@pytorchbot

Copy link
Copy Markdown
Collaborator

Summary

pip install executorch installs four packages that are only there for ExecuTorch's own tests: expecttest, hypothesis, kgb and parameterized. hypothesis also brings sortedcontainers. So every user installs five packages they never need.

This moves the four from the package's runtime dependencies (_base_dependencies() in setup.py) to requirements-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, and exir/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: coremltools and scikit-learn (the Core ML backend needs both), and hydra-core, omegaconf, pandas, tabulate and pytorch-tokenizers, which shipped modules import.

The first commit fixes the wheel's clean-install check. It hid undeclared packages so that importlib.util.find_spec raised instead of returning None. torch._dynamo probes for hypothesis with find_spec when it loads, so the check failed once hypothesis was no longer declared, although a real install works.

Test plan

On macOS arm64, in a fresh environment with only the trimmed dependencies, torch 2.14.0 and a nightly executorch installed with --no-deps:

  • Tried to import all ~3,000 modules in the package. Only the three files above failed for lack of a removed package. The rest imported, or stopped on unrelated optional packages such as vendor SDKs.
  • Exported a small model with XNNPACK and with Core ML, ran both, and matched eager PyTorch.
  • The clean-install check fails before the first commit and passes after it, and still fails when a checked module imports an undeclared package.

Tests that use the moved packages pass with requirements-dev.txt installed.

@pytorch-bot

pytorch-bot Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/24206

Note: Links to docs will display an error until the docs builds have been completed.

⏳ No Failures, 65 Pending

As of commit cdff71c with merge base 4db778e (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Oct 27, 2026
### Summary

`pip install executorch` installs four packages that are only there for
ExecuTorch's own tests: `expecttest`, `hypothesis`, `kgb` and
`parameterized`. `hypothesis` also brings `sortedcontainers`. So every
user installs five packages they never need.

This moves the four from the package's runtime dependencies
(`_base_dependencies()` in `setup.py`) to `requirements-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`,
and `exir/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: `coremltools` and `scikit-learn` (the Core ML backend
needs both), and `hydra-core`, `omegaconf`, `pandas`, `tabulate` and
`pytorch-tokenizers`, which shipped modules import.

The first commit fixes the wheel's clean-install check. It hid
undeclared packages so that `importlib.util.find_spec` raised instead of
returning `None`. `torch._dynamo` probes for `hypothesis` with
`find_spec` when it loads, so the check failed once `hypothesis` was no
longer declared, although a real install works.

### Test plan

On macOS arm64, in a fresh environment with only the trimmed
dependencies, `torch` 2.14.0 and a nightly `executorch` installed with
`--no-deps`:

- Tried to import all ~3,000 modules in the package. Only the three
files above failed for lack of a removed package. The rest imported, or
stopped on unrelated optional packages such as vendor SDKs.
- Exported a small model with XNNPACK and with Core ML, ran both, and
matched eager PyTorch.
- The clean-install check fails before the first commit and passes after
it, and still fails when a checked module imports an undeclared package.

Tests that use the moved packages pass with `requirements-dev.txt`
installed.

(cherry picked from commit ff09af0)
@JacobSzwejbka
JacobSzwejbka merged commit 4fcdbf4 into release/1.6 Oct 29, 2026
396 checks passed
@JacobSzwejbka
JacobSzwejbka deleted the cherry-pick-24143-by-pytorch_bot_bot_ branch October 29, 2026 01:12

This branch was previously deployed

1 inactive deployment
cadence — cdff71c9 Deployed Oct 29, 2026 by JacobSzwejbka via hifi-op-test / hifi4 #35193
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants