Skip to content

Commit 0c3d779

Browse files
authored
Fix build isolation and editable install issues (#15941)
Summary: This PR fixes two issues affecting the build and installation process: 1. **pyproject.toml configuration**: Fixed invalid `license` and `license-files` fields that were causing build failures with newer versions of `setuptools` and `pip` build isolation. The `license` field now uses the table format `{text = ...}` and `license-files` was moved to `[tool.setuptools]`. 2. **Editable install version.py**: Fixed an issue where `version.py` was being written to the project root instead of the package directory (`src/executorch`) during editable installs. This was causing `ImportError: cannot import name 'version'` when importing `executorch`. Test Plan: - Verified `pip install . --no-build-isolation` works (metadata generation succeeds). - Verified `pip install -e . --no-build-isolation` works and `from executorch import version` succeeds. ### Summary [PLEASE REMOVE] See [CONTRIBUTING.md's Pull Requests](https://github.com/pytorch/executorch/blob/main/CONTRIBUTING.md#pull-requests) for ExecuTorch PR guidelines. [PLEASE REMOVE] If this PR closes an issue, please add a `Fixes #<issue-id>` line. [PLEASE REMOVE] If this PR introduces a fix or feature that should be the upcoming release notes, please add a "Release notes: <area>" label. For a list of available release notes labels, check out [CONTRIBUTING.md's Pull Requests](https://github.com/pytorch/executorch/blob/main/CONTRIBUTING.md#pull-requests). ### Test plan [PLEASE REMOVE] How did you test this PR? Please write down any manual commands you used and note down tests that you have written if applicable. cc @GregoryComer
1 parent 0f3d1b2 commit 0c3d779

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

pyproject.toml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ readme = "README-wheel.md"
2222
authors = [
2323
{name="PyTorch Team", email="[email protected]"},
2424
]
25-
license = "BSD-3-Clause"
26-
license-files = ["LICENSE"]
25+
license = {text = "BSD-3-Clause"}
26+
2727
keywords = ["pytorch", "machine learning"]
2828
# PyPI package information.
2929
classifiers = [
@@ -97,6 +97,9 @@ flatc = "executorch.data.bin:flatc"
9797
# TODO(dbort): Could use py_modules to restrict the set of modules we
9898
# package, and package_data to restrict the set up non-python files we
9999
# include. See also setuptools/discovery.py for custom finders.
100+
[tool.setuptools]
101+
license-files = ["LICENSE"]
102+
100103
[tool.setuptools.package-dir]
101104
# Tell setuptools to follow the symlink: src/executorch/* -> * for all first level
102105
# modules such as src/executorch/exir -> exir. This helps us to semi-compliant with

setup.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@
5757
import site
5858
import subprocess
5959
import sys
60-
6160
from distutils import log # type: ignore[import-not-found]
6261
from distutils.sysconfig import get_python_lib # type: ignore[import-not-found]
6362
from pathlib import Path
@@ -552,7 +551,7 @@ def run(self):
552551
# package subdirectory.
553552
if self.editable_mode:
554553
# In editable mode, the package directory is the original source directory
555-
dst_root = self.get_package_dir(".")
554+
dst_root = self.get_package_dir("executorch")
556555
else:
557556
dst_root = os.path.join(self.build_lib, "executorch")
558557
# Create the version file.

0 commit comments

Comments
 (0)