Closed
Description
🚀 The feature, motivation and pitch
Blocking #2871
Context:
The current pattern of setup.py in ExecuTorch:
- Build extensions in
CustomBuild
class (extendingbuild
). Run CMake build commands to build pybind extensions. Triggered fromcmdclass["build"]
- After extensions are built, run
InstallerBuildExt
class to install the extension artifacts (.so etc). The class takes a list ofext_modules
to learn what is the source path (normally .so files in cmake-out/) and what is the destination path in the package.ext_modules
list is also controlled by the same CMake flags for custom build. This step is triggered fromcmdclass["build_ext"]
- Lastly,
setup.p
ybuild_py
to copy python files to package directories. This step is triggered fromcmdclass["build_py"]
.
This pattern is different from the common pattern, but it works without issue.
Assumption:
We want to support editable mode (pip install -e .
). In editable installation we should perform the exact same installation steps as normal mode, respecting the same options as normal mode.
For example, the plain command
pip install -e .
Should install portable_lib extension because by default EXECUTORCH_BUILD_PYBIND=ON
Problem:
The current pattern doesn’t work for editable mode. Here are the reasons:
- The
build
step doesn’t even run when editable mode is on. This is causingbuild_ext
to error out because it’s expecting the .so files to be present in the build directory but they are missing.
- We don’t want to diverge the installation behavior between editable mode on and off as much as possible. This means we don’t want to do if editable mode on do A otherwise do B.
Proposal:
Move the python extension installation step (CMake commands) into one of ext_modules
.
Alternatives
No response
Additional context
No response
RFC (Optional)
No response
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Done
Status
Done