-
Notifications
You must be signed in to change notification settings - Fork 542
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
Add optional attr python_interpreter to run pip with python 3 #158
Conversation
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here (e.g. What to do if you already signed the CLAIndividual signers
Corporate signers
|
I signed it! |
We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google. |
I signed it! |
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here (e.g. What to do if you already signed the CLAIndividual signers
Corporate signers
|
This commit also added --python_interpreter argument to piptool.py to support this attribute. Example usage: pip_import( name = 'pip_deps', requirements = '//:requirements.txt', python_interpreter = 'python3.7', )
I signed it! |
CLAs look good, thanks! |
Has there been any progress on this? Very excited to see this change, will help our workflow out a lot. |
Can someone please look into this? |
+1 for this! |
+1 |
Good enough for me until a solution is available in the main repo at bazelbuild#158
Should this relate to |
Nevermind, seems like that is on its way out. The python toolchain stuff is very actively changing (see e.g. bazelbuild/bazel#7899), so it might be good to let the dust settle there before we make a move here. |
Bump.
I'm not sure it'll help. The rules here are used at the analysis phase - in the WORKSPACE file, and these rules only have access to the repository_ctx, and this object does not have access to toolchains. So we the workaround of specifying the interpreter in every |
Hi. We also really need this. Any love for this PR? |
I had to create a custom version of this repo just for this capability for work. Would be great to see this pulled officially. |
Thanks for the PR Chen. I've prioritized this feature as #249 and rebased your commit in #252. As @bshashank pointed out, this is pretty independent of Python toolchains because this happens at |
While it's possible to select which interpreter to run python rules with, pip will always be run with python from the system path.
This is an alternative solution to PR #82 and PR #85. it doesn't add pip3_import(). instead it adds python_interpreter attribute to pip_import(). Rationale is that if people want to use python3 for pip without changing the system's default
python
, they are likely also want to usepython3.6
orpython3.7
without changing the system's defaultpython3
(for me it points to python 3.5) Using this approach users can any version of python, including customized built python with the interpreter path specified.