[bazel]: de-alias pybind11 headers target #79676
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In trying to set up python headers in an out-of-tree bazel MLIR project, I encountered the
pybind11_bazel
project, and found that the@python_runtime
target used here is not defined by it.Instead, it seems that
@python_runtime
is an alias used in some projects like Tensorflow (seehttps://github.com/tensorflow/tensorflow/blob/322936ffdd96ee59e27d028467fe458859cf3855/third_party/python_runtime/BUILD#L7-L7), where it is aliased to
@local_config_python
. In fact,@local_config_python
is defined by@pybind11_bazel
, and so it seems that this layer of indirection no longer serves a purpose, and instead just prevents anyone who doesn't clone Tensorflow's config from using the python bindings here.This commit updates the dependent targets to their canonical de-aliased equivalents, and I suspect this will not even break any downstream users since the new target is defined in those projects already.
Without this change, running, for example
gives the error
Minimal reproduction in https://github.com/j2kun/test_mlir_bazel_pybind, which, when pointing to a local LLVM repository that has this change (see
bazel/import_llvm.bzl
in that repository), results in that build succeeding.Hat tip to Maksim Levental for going on an hours-long investigation with me to figure this out.