Fix build_tools missing from sdist causing uv cached installs to fail#2684
Merged
ptrendx merged 1 commit intoNVIDIA:mainfrom Feb 17, 2026
Merged
Conversation
…fail - Include `build_tools/` in the source distribution via `MANIFEST.in` so that cached builds from `uv` (and `pip`) can resolve `setup.py`'s top-level imports `setup.py` imports from `build_tools` at the top level: ```python from build_tools.build_ext import CMakeExtension, get_build_ext from build_tools.te_version import te_version from build_tools.utils import cuda_archs, cuda_version, ... ``` The `__legacy__` build backend in `pyproject.toml` adds the source root to `sys.path`, so these imports work when building directly from the source tree. However, `build_tools/` is not included in the sdist because: 1. `MANIFEST.in` did not list it 2. `build_tools/` is not discovered by `find_packages()` (it's a standalone directory at the repo root, not under `transformer_engine/`) When `uv` caches the sdist and later builds a wheel from it, the sdist is extracted to a temporary directory where `build_tools/` is absent, causing a `ModuleNotFoundError`. Passing `--no-cache` to `uv` works around this by forcing a fresh build from the full source tree. Added `build_tools` to `MANIFEST.in`: ```diff recursive-include transformer_engine/common/include *.* +recursive-include build_tools *.py *.txt ``` - [x] `python setup.py sdist` produces a tarball that contains `build_tools/` ``` $ tar tzf dist/transformer_engine-*.tar.gz | grep build_tools transformer_engine-2.13.0.dev0+82f7ebeb/build_tools/ transformer_engine-2.13.0.dev0+82f7ebeb/build_tools/VERSION.txt transformer_engine-2.13.0.dev0+82f7ebeb/build_tools/__init__.py transformer_engine-2.13.0.dev0+82f7ebeb/build_tools/build_ext.py transformer_engine-2.13.0.dev0+82f7ebeb/build_tools/jax.py transformer_engine-2.13.0.dev0+82f7ebeb/build_tools/pytorch.py transformer_engine-2.13.0.dev0+82f7ebeb/build_tools/te_version.py transformer_engine-2.13.0.dev0+82f7ebeb/build_tools/utils.py ``` Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Hemil Desai <hemild@nvidia.com>
d4c822c to
1f64a2e
Compare
Contributor
Greptile SummaryThis PR fixes a build bug where
Confidence Score: 5/5
Important Files Changed
Flowchartflowchart TD
A["uv/pip install transformer_engine"] --> B["Build sdist from source tree"]
B --> C["Cache sdist tarball"]
C --> D["Extract sdist to temp directory"]
D --> E{"build_tools/ present?"}
E -->|"Before fix: No"| F["ModuleNotFoundError\nsetup.py cannot import build_tools"]
E -->|"After fix: Yes"| G["setup.py imports build_tools successfully"]
G --> H["Build wheel from sdist"]
H --> I["Install wheel"]
Last reviewed commit: 1f64a2e |
ptrendx
approved these changes
Feb 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Change
build_tools/in the source distribution viaMANIFEST.inso that cached builds fromuv(andpip) can resolvesetup.py's top-level importssetup.pyimports frombuild_toolsat the top level:The
__legacy__build backend inpyproject.tomladds the source root tosys.path, so these imports work when building directly from the source tree. However,build_tools/is not included in the sdist because:MANIFEST.indid not list itbuild_tools/is not discovered byfind_packages()(it's a standalone directory at the repo root, not undertransformer_engine/)When
uvcaches the sdist and later builds a wheel from it, the sdist is extracted to a temporary directory wherebuild_tools/is absent, causing aModuleNotFoundError. Passing--no-cachetouvworks around this by forcing a fresh build from the full source tree.Added
build_toolstoMANIFEST.in:recursive-include transformer_engine/common/include *.* +recursive-include build_tools *.py *.txtpython setup.py sdistproduces a tarball that containsbuild_tools/Type of change
Checklist: