-
Notifications
You must be signed in to change notification settings - Fork 690
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
Make rules_docker compatible with Python 3? #842
Comments
I looked around the rules_docker repo and it seems like every |
you probably need to add host_force_python=PY2 as exemplified in the bazelrc file: https://github.com/bazelbuild/rules_docker/blob/master/.bazelrc#L20 |
To be clear, rules_docker works just fine with the following:
But since I need to declare the 2nd flag, I'm thinking rules_docker is incompatible with the new Python toolchains. If rules_docker were compatible, then I wouldn't need (The problem stems from the fact that internally we write Python 3. That flag forces us to declare |
Please read bazelbuild/bazel#7899 in detail for the status of python toolchains (see lots of comments about rules_docker there). So, you should be able to keep the default to PY3 (as long as you are not using PY3 as host tools), but you will need to use the |
closing, please let me know if you'd like me to reopen for some reason |
@fedenusy rules_docker can be patched to work with python3. I've managed it inside our team. Please let me know how much you are still interested in it. |
@qzmfranklin yes I'm interested! How'd you pull it off? |
In my opinion, this issue should not be closed. Currently, rules_docker can only be used by forcing all host tools to run under py2. We have host tools in our build that need to run under py3, so specifying I understand that fixing this is not trivial, but python2 retires in 6 months, so it will need to be dealt with somehow, at some point soon, right? |
@jdelfino Also, yes, we are dealing with it (just in a different way, thus the issue being closed). We are currently working on migrating to use go containerregistry. Please keep track of PRs landing soon if you are interested in this. |
@nlopezgi is this solely because rules_docker depends on python containerregistry which is not actively maintained? When rules_docker will move to go containerregistry will this be resolved as far as rules_docker is concerned? |
Hi @ittaiz, yes this should be resolved once we migrate off python containerregistry |
What about keeping this open to track actually this problem, until the move to go containerregistry is complete? That seems more sensible than closing imho, as this issue is something that will pop up again until the change lands, and |
Reopening just to make it easier for folks to find this issue, but |
Also, make Bazel run with Python2 for rules_docker, because of bazelbuild/rules_docker#842.
Also, make Bazel run with Python2 for rules_docker, because of bazelbuild/rules_docker#842.
Also, make Bazel run with Python2 for rules_docker, because of bazelbuild/rules_docker#842.
* Update com_github_prysmaticlabs_go_ssz commit hash to 0fdbce2 * Update io_bazel_rules_k8s commit hash to cddc035 * Update dependency build_bazel_rules_nodejs to v0.32.2 * Update dependency com_github_prometheus_common to v0.6.0 * Update dependency com_github_syndtr_goleveldb to v1 * revert ssz breakage * Update libp2p * update infra * update infra * specify node_modules * add flag * clarify in comment * update rules_docker * workarounds for python2. see: bazelbuild/rules_docker#842
If |
I've got a Python-3 compatible branch that works for basic things for me, could use some help testing, see: google/containerregistry#109 (comment) |
Hi @c4urself , |
@nlopezgi -- understood, looking forward to the Golang stuff getting finished. I've got a working version of rules_docker under Python2 and Python3 by simply changing the containerregistry rules to a |
too crazy for me (plus there's technical reasons why that would be a nightmare for us to maintain). I really don't want to make this situation more complex by adding another source of dependency / variability. But thanks for the suggestion! |
Do we have an ETA for the golang conversion? Can we convince containerregistry to accept the contribution? It is definitely annoying to simultaneously default bazel to py3 while having core rules like rules_docker not support py3. |
status has been updated in #580. I would love for containerregistry to take contributions, but it seems the team in charge has other properties atm. As for changing the bazel default, that's a Bazel 1.0 decision that is probably hard to roll back. We appreciate your patience and hope to finish the migration soon. |
Less extreme idea.....
|
Because the container_push rule from rules_docker is written in Python and its depend on the Python 2 packages, we need to enforce the Bazel to use Python 2 with this rule. These settings can be removed after the rules_docker migrate this rule with go. See also: - https://github.com/bazelbuild/rules_docker#known-issues - bazelbuild/rules_docker#842
Sure, let me know, happy to work with whoever, for now I'm going to use my Python-3 compatible fork of |
The main issue we have that makes these alternatives challenging is that the SoT for containerregistry is an internal google repo, and rules_docker needs to maintain compliance with this internal version to support internal use cases (even though rules_docker SoT is github). Changing the dep in rules_docker to something else would mean, for us, that the automation we have set in place to sync our SoT (in github) with internal repos would likely require manual intervention at each change to make sure discrepancies between SoT and internal rules do not cause breakages. Moreover, since our SoT is github, our test coverage is mostly here, so breaking internal users unintentionally would be a common occurrence. |
Because the container_push rule from rules_docker is written in Python and its depend on the Python 2 packages, we need to enforce the Bazel to use Python 2 with this rule. These settings can be removed after the rules_docker migrate this rule with go. See also: - https://github.com/bazelbuild/rules_docker#known-issues - bazelbuild/rules_docker#842
See following issues for details * bazelbuild/rules_docker#842 * bazelbuild/rules_docker#580 * bazelbuild/bazel#7899 Signed-off-by: stuart.warren <[email protected]>
Most of the problems mentioned in this issue should now be fixed because rules_docker python binaries have been migrated to Go binaries that depend on go-containerregistry. See #580. |
🎉 🙏 |
Hello! When running rules_docker using Python 3, I get the following error:
From seeing this, I'm assuming rules_docker was written for Python 2.
The workaround I found is to:
python
topython2
--incompatible_use_python_toolchains
--incompatible_py3_is_default=false
I think it should be simple to make rules_docker compatible with Python toolchains. We would just need to declare
python_version = "PY2"
somewhere within rules_docker... thoughts?The text was updated successfully, but these errors were encountered: