Skip to content

Commit 0589cea

Browse files
committed
Add README.md
Summary: Test Plan: Reviewers: Subscribers: Tasks: Tags:
1 parent f167a89 commit 0589cea

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Why We Have a src/executorch/exir File
2+
3+
The `src/executorch/exir` file exists primarily due to the limitations of `pip install` in editable mode. Specifically, `pip install -e .` does not recognize `<executorch root>/exir` (or any root level directory with a `__init__.py`) as a valid package module because of the presence of `<executorch root>/exir/__init__.py`. See the following GitHub issue for details: [Issue #9558](https://github.com/pytorch/executorch/issues/9558).
4+
5+
## The Symlink Solution
6+
7+
To work around this limitation, a symlink is used. With this symlink and this package entry in `pyproject.toml`:
8+
9+
```toml
10+
[tool.setuptools.package-dir]
11+
...
12+
"executorch" = "src/executorch"
13+
```
14+
We are telling `pip install -e .` to treat `src/executorch` as the root of the `executorch` package and hence mapping `executorch.exir` to `src/executorch/exir`.
15+
16+
This allows us to perform `pip install -e .` successfully and enables the execution of the following command:
17+
18+
```bash
19+
python -c "from executorch.exir import CaptureConfig"
20+
```

0 commit comments

Comments
 (0)