Skip to content

Commit 0008c52

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 b4d72f1 commit 0008c52

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
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: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -387,9 +387,9 @@ def __init__(
387387
modpath: The dotted path of the python module that maps to the
388388
extension.
389389
"""
390-
assert (
391-
"/" not in modpath
392-
), f"modpath must be a dotted python module path: saw '{modpath}'"
390+
assert "/" not in modpath, (
391+
f"modpath must be a dotted python module path: saw '{modpath}'"
392+
)
393393
full_src = src
394394
if src_dir is None and _is_windows():
395395
src_dir = "%BUILD_TYPE%/"
@@ -552,7 +552,7 @@ def run(self):
552552
# package subdirectory.
553553
if self.editable_mode:
554554
# In editable mode, the package directory is the original source directory
555-
dst_root = self.get_package_dir(".")
555+
dst_root = self.get_package_dir("executorch")
556556
else:
557557
dst_root = os.path.join(self.build_lib, "executorch")
558558
# Create the version file.

0 commit comments

Comments
 (0)