-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Python 3 support #1580
Comments
I noticed that many wrapper scripts in Bazel are python 2 only. Would be useful if I can bundle a minimal python implementation so that our Bazel repository will work on various distributions. |
As an example, |
Is bazel capable of using a python interpreter that comes from a label yet? That was the main blocker the last time I looked into doing something similar, iirc. |
@benley A possible workaround: use a If that works you can do make it into a general function or rule so you can reuse the code and keep things organized until the devs add the proper supports. |
Integrated info of #2352 |
Nope, still not working. Integrating info of #2244 |
Integrated info of #2497 |
Integrated info of #2509 |
It looks like I have encountered the same problem as described in #2352, which had been merged into this ticket. But I think this ticket is sightly misleading. I am not interested into supporting Python 3 (which might be a long term goal), I am interested in getting bazel to run right now using Python 2. Editing the $PATH so that "python" also points to py2 doesn't work either. Any suggestions?
|
@tux21b I would then perhaps create a new Issue since this here is really intended for Python3 specifically. |
Is there any word yet on plans for this? This is breaking parts of Tensorflow, which explicitly supports Py3. In some cases, simply switching to using |
bazel-0.5.0-rc2 still has this behavior. |
It might be enough in the bazel/tools/build_defs/pkg/archive.py case to simply import io.StringIO (which exists on Python2 as well and is not used much in the rules) or to also catch "ModuleNotFoundError"s for Python3. |
I've made some changes so that everything in bazel/tools/build_defs/pkg/archive.py passes tests in python 2.7 and 3, here treuherz/bazel@d6d0889. Since this is pretty small should I go ahead and open a PR or should I run it by the mailing list first? |
Yeah, the need for that occurred to me as I was doing it. Don't know enough about how google manages testing behind the scenes, and also don't know the rest of Bazel's codebase well enough to know how much work it would take to get it to pass if the test suite was run against both interpreters, tox-style. I'll submit the PR with that caveat so it's at least ready. |
See 8b5bf1f for some relevant steps forward (particularly proper honoring of default_python_version). |
I've created a list of PY2/3 issues that I'm prioritizing in #6444, some of which are mentioned here. I'll keep this thread open as a useful index of issues but mark it P3. |
Friendly ping: I think this is effectively a dup of #6444. We should close this and leave that. |
Sure, we can ref this from #6444. |
I would like for this issue to collect all issues concerning Python 3.
As far as I know there are multiple problems:
srcs_version
arePY2, PY3, PY2AND3, PY2ONLY, PY3ONLY
.PY3
is documented wrong. It actually handles similar toPY2
, which is fine.PY3ONLY
is not even documented, although it mostly is what a lot of Python 3 users want.PY2
,PY3
,PY2AND3
andPY2ONLY
. It is however totally wrong forPY3ONLY
. (Python 3 support? #1406)It seems like
checkSourceIsCompatible
is used instead of a hypotheticalselectPythonVersionForSource
.--force_python
and--host_force_python
are given to users, yet they are not documented.py_binary
wrapper uses Python 2 although it may not even be present (python stub_template.txt shouldn't assume /usr/bin/python always exists #544)py_binary
wrapper spawns a new process for executing python scripts. I do know that we are not talking about great performance with Python but that seems a bit excessive.pkg_tar
seems to internally use Python2 only. Does not work with 3.The text was updated successfully, but these errors were encountered: