Bazel build of Python library

I’m trying to use Bazel to build PyTorch and I have it mostly working. Running into an annoying issue though: I am not sure what target to use in a py_binary so that I can depend on Torch from Python.

There’s the :torch target which produces There’s the :torch_python that produces the library with the right Python bindings. There’s the :_C target that wraps the latter in a pybind_extension, and that is almost what I need, but not quite. That’s the prerequisite for doing import torch.C_ from Python… but as far as I can tell there is nothing that packages up the torch module itself (and would let me do import torch).

I feel like that would be crazy - it’s just something that can’t be missing. And yet I cannot find it. I found an older post that seems to be adding what I want (PyTorch and Bazel) but I’m just wondering if there is a proper solution already upstream.