Skip to content

Package headers into pip wheel #5734

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed

Package headers into pip wheel #5734

wants to merge 3 commits into from

Conversation

larryliu0820
Copy link
Contributor

@larryliu0820 larryliu0820 commented Sep 27, 2024

Summary: Changes CustomBuildPy to take a list of source directories relative to ExecuTorch root and copies all headers recursively into pip wheel during packaging.

The destination is hardcoded to executorch/include/executorch in the pip wheel.

Test Plan:

python setup.py bdist_wheel

This prints out the following lines:

creating pip-out/bdist.linux-x86_64/wheel/executorch/include/executorch/runtime
creating pip-out/bdist.linux-x86_64/wheel/executorch/include/executorch/runtime/core
copying pip-out/lib.linux-x86_64-cpython-311/executorch/include/executorch/runtime/core/array_ref.h -> pip-out/bdist.linux-x86_64/wheel/executorch/include/executorch/runtime/core
...

Then install the wheel:

pip install dist/executorch-0.5.0a0+52d5218-cp311-cp311-linux_x86_64.whl

And we can find the headers in site-packages

/data/users/larryliu/executorch/pip-out/lib.linux-x86_64-cpython-311/executorch/include/executorch/runtime/core/array_ref.h

Reviewers:

Subscribers:

Tasks:

Tags:

Summary: Add a new BaseExtension - HeaderFile. It takes a source
directory relative to ExecuTorch root and copies all headers recursively
into pip wheel during packaging.

The destination is hardcoded to `executorch/include/executorch` in the
pip wheel.

Test Plan:

```bash
python setup.py bdist_wheel
```

This prints out the following lines:

```
creating pip-out/bdist.linux-x86_64/wheel/executorch/include/executorch/runtime
creating pip-out/bdist.linux-x86_64/wheel/executorch/include/executorch/runtime/core
copying pip-out/lib.linux-x86_64-cpython-311/executorch/include/executorch/runtime/core/array_ref.h -> pip-out/bdist.linux-x86_64/wheel/executorch/include/executorch/runtime/core
...
```
Then install the wheel:

```bash
pip install dist/executorch-0.5.0a0+52d5218-cp311-cp311-linux_x86_64.whl
```

And we can find the headers in site-packages

```
/data/users/larryliu/executorch/pip-out/lib.linux-x86_64-cpython-311/executorch/include/executorch/runtime/core/array_ref.h
```

Reviewers:

Subscribers:

Tasks:

Tags:
@larryliu0820 larryliu0820 requested a review from dbort September 27, 2024 21:19
Copy link

pytorch-bot bot commented Sep 27, 2024

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/5734

Note: Links to docs will display an error until the docs builds have been completed.

✅ No Failures

As of commit 32f63ed with merge base 52d5218 (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Sep 27, 2024
@facebook-github-bot
Copy link
Contributor

@larryliu0820 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

Copy link
Contributor

@dbort dbort left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the test plan, please also make sure that you can import and use pybindings, and that flatc is on your path and still works.

Summary:

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:
@facebook-github-bot
Copy link
Contributor

@larryliu0820 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

Copy link
Contributor

@dbort dbort left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I should have picked up on this earlier. Things are awkward because this is breaking a core aspect of the "build extension" concept.

Summary:

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:
@facebook-github-bot
Copy link
Contributor

@larryliu0820 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

Copy link
Contributor

@dbort dbort left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Way simpler, thanks! :D Please update the PR description to describe the final form of the change, but it looks great.

@facebook-github-bot
Copy link
Contributor

@larryliu0820 merged this pull request in d62c7ad.

@larryliu0820
Copy link
Contributor Author

@pytorchbot cherry-pick --onto release/0.4 -c fixnewfeature

pytorchbot pushed a commit that referenced this pull request Oct 10, 2024
Summary:
Changes `CustomBuildPy` to take a list of source directories relative to ExecuTorch root and copies all headers recursively into pip wheel during packaging.

The destination is hardcoded to `executorch/include/executorch` in the pip wheel.

Pull Request resolved: #5734

Test Plan:
```bash
python setup.py bdist_wheel
```

This prints out the following lines:

```
creating pip-out/bdist.linux-x86_64/wheel/executorch/include/executorch/runtime
creating pip-out/bdist.linux-x86_64/wheel/executorch/include/executorch/runtime/core
copying pip-out/lib.linux-x86_64-cpython-311/executorch/include/executorch/runtime/core/array_ref.h -> pip-out/bdist.linux-x86_64/wheel/executorch/include/executorch/runtime/core
...
```
Then install the wheel:

```bash
pip install dist/executorch-0.5.0a0+52d5218-cp311-cp311-linux_x86_64.whl
```

And we can find the headers in site-packages

```
/data/users/larryliu/executorch/pip-out/lib.linux-x86_64-cpython-311/executorch/include/executorch/runtime/core/array_ref.h
```

Reviewed By: dbort

Differential Revision: D63561966

Pulled By: larryliu0820

fbshipit-source-id: 0c7d8983a89d11e62da006d361ca00b4a061d73c
(cherry picked from commit d62c7ad)
@pytorchbot
Copy link
Collaborator

Cherry picking #5734

The cherry pick PR is at #6138 and it is recommended to link a fixnewfeature cherry pick PR with an issue. The following tracker issues are updated:

Details for Dev Infra team Raised by workflow job

larryliu0820 added a commit that referenced this pull request Oct 11, 2024
Summary:
Changes `CustomBuildPy` to take a list of source directories relative to ExecuTorch root and copies all headers recursively into pip wheel during packaging.

The destination is hardcoded to `executorch/include/executorch` in the pip wheel.

Pull Request resolved: #5734

Test Plan:
```bash
python setup.py bdist_wheel
```

This prints out the following lines:

```
creating pip-out/bdist.linux-x86_64/wheel/executorch/include/executorch/runtime
creating pip-out/bdist.linux-x86_64/wheel/executorch/include/executorch/runtime/core
copying pip-out/lib.linux-x86_64-cpython-311/executorch/include/executorch/runtime/core/array_ref.h -> pip-out/bdist.linux-x86_64/wheel/executorch/include/executorch/runtime/core
...
```
Then install the wheel:

```bash
pip install dist/executorch-0.5.0a0+52d5218-cp311-cp311-linux_x86_64.whl
```

And we can find the headers in site-packages

```
/data/users/larryliu/executorch/pip-out/lib.linux-x86_64-cpython-311/executorch/include/executorch/runtime/core/array_ref.h
```

Reviewed By: dbort

Differential Revision: D63561966

Pulled By: larryliu0820

fbshipit-source-id: 0c7d8983a89d11e62da006d361ca00b4a061d73c
(cherry picked from commit d62c7ad)
larryliu0820 added a commit that referenced this pull request Oct 11, 2024
Package headers into pip wheel (#5734)

Summary:
Changes `CustomBuildPy` to take a list of source directories relative to ExecuTorch root and copies all headers recursively into pip wheel during packaging.

The destination is hardcoded to `executorch/include/executorch` in the pip wheel.

Pull Request resolved: #5734

Test Plan:
```bash
python setup.py bdist_wheel
```

This prints out the following lines:

```
creating pip-out/bdist.linux-x86_64/wheel/executorch/include/executorch/runtime
creating pip-out/bdist.linux-x86_64/wheel/executorch/include/executorch/runtime/core
copying pip-out/lib.linux-x86_64-cpython-311/executorch/include/executorch/runtime/core/array_ref.h -> pip-out/bdist.linux-x86_64/wheel/executorch/include/executorch/runtime/core
...
```
Then install the wheel:

```bash
pip install dist/executorch-0.5.0a0+52d5218-cp311-cp311-linux_x86_64.whl
```

And we can find the headers in site-packages

```
/data/users/larryliu/executorch/pip-out/lib.linux-x86_64-cpython-311/executorch/include/executorch/runtime/core/array_ref.h
```

Reviewed By: dbort

Differential Revision: D63561966

Pulled By: larryliu0820

fbshipit-source-id: 0c7d8983a89d11e62da006d361ca00b4a061d73c
(cherry picked from commit d62c7ad)

Co-authored-by: Mengwei Liu <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants