Skip to content
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

Q: pex support? #2038

Closed
trivigy opened this issue Nov 3, 2016 · 8 comments
Closed

Q: pex support? #2038

trivigy opened this issue Nov 3, 2016 · 8 comments
Assignees
Labels
P3 We're not considering working on this, but happy to review a PR. (No assignee) type: feature request

Comments

@trivigy
Copy link

trivigy commented Nov 3, 2016

Not sure if this has been asked in the past but will bazel ever consider implementing pex file support build for python? I was able to find only two references to those and have been struggling getting them to work with the current version of bazel.

https://github.com/saileshmittal/bazel/tree/pex
https://github.com/benley/bazel_rules_pex

@laszlocsomor laszlocsomor added type: feature request P3 We're not considering working on this, but happy to review a PR. (No assignee) labels Nov 4, 2016
@pcj
Copy link
Member

pcj commented Nov 4, 2016

@trivigy You can also try https://github.com/google/subpar.

@meteorcloudy
Copy link
Member

Just use --build_python_zip when you build a python binary, then you'll get an executable python zip file.
Please see the design doc: http://www.bazel.io/designs/2016/09/05/build-python-on-windows.html

@pcj
Copy link
Member

pcj commented Nov 4, 2016

@meteorcloudy Good to know!

@trivigy
Copy link
Author

trivigy commented Nov 5, 2016

@pcj Thanks for the recommendation. Loved learning about a new cool think I didn't see online. Unfortunately this is quite similar to --build_python_zip which is simply a zipped executable python module. @meteorcloudy I definitely know about that one but unfortunately that feature is simply not enough for what I am looking. I want the ability to embed a venv inside the python executable archive. I have been messing around with creating my own rule for the past entire week and, now that I actually understand how the whole thing works, almost finished making my own pex rule.

The idea behind this is a two fold. Foremost, python programs have dependencies on other python modules. By using pex that dependency is resolved and makes it significantly easier to actually distribute python applications. On the other hand, python applications also have system dependencies and for that I think bazel is pretty well equipped. Hopefully I'll be able to wrap the python executable into a *.deb package that will contain all of the system dependencies. This way when the application is installed, all of the dependencies get resolved with it.

When I get it running I'll be happy to share the rule. And would love some advise if you think there are things I should be considering as I am building this.

@trivigy
Copy link
Author

trivigy commented Nov 5, 2016

@meteorcloudy Maybe you could help. Is there a way to produce the zipped executable (--build_python_zip) using the python rule directly? Then I could potentially build another rule around it to wrap that zip with an venv and work similar to pex but not exactly.

@trivigy
Copy link
Author

trivigy commented Nov 5, 2016

Okay never mind. I figured it out. 💡

@ulfjack
Copy link
Contributor

ulfjack commented Dec 1, 2016

Is there anything left here for us to do? Can we close this?

@trivigy
Copy link
Author

trivigy commented Dec 1, 2016

I ended up writing a full rule for pex. You can find it here: #699. It would still be really nice if this rule was part of the bazel master and came in with the official distribution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P3 We're not considering working on this, but happy to review a PR. (No assignee) type: feature request
Projects
None yet
Development

No branches or pull requests

5 participants