Replies: 2 comments
-
This is probably related to using a version-aware py_binary rule. Under the hood, the way it works is a non-version aware py_binary is created, then a version-aware wrapper rule (also a binary) applies a transition and depends on the inner binary. The version-aware wrapper basically just forwards along information from the inner binary. python/config_settings/transition.bzl has the code for this. However, this shouldn't always cause both to materialize in bazel-bin. Only the requested target (the outer wrapper) should be materialized. If both are showing up, then it would mean something is explicitly building the inner binary (which shouldn't be done, its just an helper to the outer target). |
Beta Was this translation helpful? Give feedback.
-
Really appreciate the feedback. I'm definitely building a version aware py_binary. My BUILD.bazel looks like:
and WORKSPACE.bazel is:
Appreciate the pointer to transition.bzl. I will see if I can trace through it and see what is building both versions. |
Beta Was this translation helpful? Give feedback.
-
I have a question about a difference I noticed in outputs produced by the built-in py_binary versus the rules_python py_binary when building the same target. I have a trivial project that builds a single py_binary called python_binary_1. When I build python_binary_1 with the built-in py_binary I get the following output in bazel-out:
And, when building with the rules_python py_binary I get this:
Both versions work fine. My question is why does the rules_python version produce the second copy of all the files with the leading underscore? Both the python_binary_1.runfiles and _python_binary_1.runfiles contain the exact same contents (basically a bunch of symlinks pointing back to the pip install in the external folder). The particular issue this causes us is that we have a monorepo with a large number of python projects and this change has doubled the number of files produced by a build. Since they are symlinks it's not an issue of disk space, but it is an issue from the perspective of inode use. Just wondering what's the purpose of this duplication and if there is a way to suppress it?
Thanks for your attention.
Beta Was this translation helpful? Give feedback.
All reactions