Skip to content

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

Open
pytorchbot wants to merge 1 commit into
release/1.6from
cherry-pick-24143-by-pytorch_bot_bot_
Open

pytorchbot wants to merge 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.

### 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)
@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.

❌ 4 New Failures

As of commit f2bf53c with merge base 4db778e (image):

NEW FAILURES - The following jobs have failed:

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

This branch was successfully deployed

1 active deployment
cadence — f2bf53cb Deployed Oct 27, 2026 by pytorchbot via hifi-op-test / hifi4 #34877
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.

2 participants