8000 Add py_import rule · Pull Request #174 · bazel-contrib/rules_python · GitHub
[go: up one dir, main page]

Skip to content

Add py_import rule #174

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

Merged
merged 2 commits into from Apr 22, 2021
Merged

Add py_import rule #174

merged 2 commits into from Apr 22, 2021

Conversation

ghost
Copy link
@ghost ghost commented Apr 12, 2019

This change adds adds a py_import rule to import Python eggs like
java_import imports Java jars.

py_import.egg generated using zipper1:

$ third_party/ijar/zipper Cc examples/py_import/py_import.egg examples/py_import/helloworld.py=examples/helloworld/helloworld.py examples/__init__.py= examples/py_import/__init__.py=

Partially addresses bazelbuild/bazel#7312.
Addresses #222 .

Testing Done:

$ bazelisk test --override_repository=rules_python=$PWD/../.. ...
//:py_import_test                                                        PASSED in 0.6s

8000
@ghost
Copy link
Author
ghost commented Apr 16, 2019

How might I attract a reviewer's attention? :) cc @brandjon

@aiuto
Copy link
aiuto commented Oct 3, 2019

Can you sync and merge to bring this up to date. It looks pretty reasonable to me.

@ghost ghost requested review from brandjon and lberki as code owners October 28, 2019 20:39
@ghost
Copy link
Author
ghost commented Oct 28, 2019

Can you sync and merge to bring this up to date. It looks pretty reasonable to me.

Sure. Thanks for looking.

@bshashank bshashank mentioned this pull request Oct 31, 2019
@ghost ghost requested review from andyscott and thundergolfer as code owners September 22, 2020 22:29
@ghost
Copy link
Author
ghost commented Sep 22, 2020

Apologies for all of the push spam. The project had changed a bit since I last amended this PR.

@groodt
Copy link
Collaborator
groodt commented Sep 23, 2020

🚗 🔫

This looks like it could come in handy. Can this be updated at some stage to support unpacking wheels in future as well? It doesn't even need to resolve additional dependencies, that can be left for the developer, only check that appropriately named wheels exist in deps from the wheel METADATA file.

Should this PR at least be verifying that you've got a valid egg? https://setuptools.readthedocs.io/en/latest/formats.html#the-internal-structure-of-python-eggs

There's not much to validate, but at least check the mandatory fields of PKG-INFO?
https://www.python.org/dev/peps/pep-0314/

@github-actions
Copy link

This Pull Request has been automatically marked as stale because it has not had any activity for 180 days. It will be closed if no further activity occurs in 30 days.
Collaborators can add an assignee to keep this open indefinitely. Thanks for your contributions to rules_python!

@github-actions github-actions bot added the Can Close? Will close in 30 days if there is no new activity label Apr 14, 2021
@thundergolfer thundergolfer removed the Can Close? Will close in 30 days if there is no new activity label Apr 19, 2021
@alexeagle alexeagle self-assigned this Apr 21, 2021
This change adds adds a `py_import` rule to import Python eggs like
`java_import` imports Java jars.

py_import.egg generated using `zipper`[1]:

```console
$ third_party/ijar/zipper Cc examples/py_import/py_import.egg examples/py_import/helloworld.py=examples/helloworld/helloworld.py examples/__init__.py= examples/py_import/__init__.py=
```

Partially addresses bazelbuild/bazel#7312.
Addresses #222.

[1]: https://github.com/bazelbuild/bazel/tree/master/third_party/ijar

Testing Done:
```console
$ bazelisk test --override_repository=rules_python=$PWD/../.. ...
//:py_import_test                                                        PASSED in 0.6s
```
Copy link
Contributor
@alexeagle alexeagle left a comment

Choose a reason for hiding this comment

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

Thanks @beasleyr-vmw !!

@alexeagle
Copy link
Contributor

you mention examples/py_import/helloworld.py in the description, but it's not included in the PR, is that intentional?

@ghost
Copy link
Author
ghost commented Apr 21, 2021

you mention examples/py_import/helloworld.py in the description, but it's not included in the PR, is that intentional?

Good q. The .egg's internal examples/py_import/helloworld.py was created from examples/pip_import/helloworld.py using zipper's dst=src syntax. examples/pip_import/helloworld.py now appears to be examples/legacy_pip_import/helloworld/helloworld.py. I'd need to update the description and perhaps regenerate the .egg.

@alexeagle
Copy link
Contributor

I just found that as well, trying to get the new integration test to pass, thanks!

@google-cla
Copy link
google-cla bot commented Apr 21, 2021

All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter.

We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only @googlebot I consent. in this pull request.

Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the cla label to yes (if enabled on your project).

ℹ️ Googlers: Go here for more info.

@google-cla google-cla bot added cla: no and removed cla: yes labels Apr 21, 2021
@alexeagle
Copy link
Contributor

@googlebot I consent.
you silly

@google-cla google-cla bot added cla: yes and removed cla: no labels Apr 22, 2021
@alexeagle alexeagle merged commit 6a9311c into bazel-contrib:master Apr 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants
0