Skip to content

Commit bd35c44

Browse files
committed
Fix build isolation and editable install issues
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.
1 parent 23fc78f commit bd35c44

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="packages@pytorch.org"},
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)