pybind11_protobuf icon indicating copy to clipboard operation
pybind11_protobuf copied to clipboard

BUILD file not found in directory 'python' of external repository @com_google_protobuf

Open translunar opened this issue 1 year ago • 11 comments

Referencing #139, I almost got pybind11_protobuf working in my repository, but I get the following error: BUILD:39:17: no such package '@com_google_protobuf//python': BUILD file not found in directory 'python' of external repository @com_google_protobuf. Add a BUILD file to a directory to mark it as a package. and referenced by '//mypath:my_ext.so'.

Is this to be expected in the current development state?

translunar avatar Jun 18 '24 22:06 translunar

I think this has been a somewhat of a known issue for a while. Upstream protobuf maintainers have not committed to a stable Bazel interface for other projects to depend on as an external repository.

As a workaround, in my projects, I use a small patch to redirect Python to that defined my local toolchain. I can post an example when I'm back at the keyboard.

jiawen avatar Jun 19 '24 02:06 jiawen

I'd be super grateful for an example! Thank you.

translunar avatar Jun 19 '24 17:06 translunar

@jiawen Hi, just wanted to follow up on this

translunar avatar Jul 01 '24 20:07 translunar

@jiawen Hi, just wanted to follow up on this

Sorry I should have given you a timeline. I'm still afk on vacation but will be back online in about a week.

jiawen avatar Jul 01 '24 21:07 jiawen

Following up on this once more :)

translunar avatar Sep 06 '24 18:09 translunar

Sorry I completely let this fall off my radar. Let me spend a few cycles today.

jiawen avatar Sep 10 '24 15:09 jiawen

I put up a working end to end example here: https://github.com/jiawen/pybind_proto_example.

Try:

bazelisk test :line_utils_py_test --test_output=all

jiawen avatar Sep 11 '24 17:09 jiawen

@laramiel @rickeylev @rwgk - I don't know how much interest there is in such an example. Or where it should live since it touches the whole stack. Maybe my personal repo isn't a terrible place :).

jiawen avatar Sep 11 '24 17:09 jiawen

@alexeagle - IMHO this whole stack is barely held together by twine but seems to work well. Of note is this tiny but gross patch needed to make protobuf compile with Bazel and have Python find it.

jiawen avatar Sep 11 '24 17:09 jiawen

Barely held together by twine is accurate. It's also churning more as the protobuf team has decided to deprecate rules_proto and move things into their repo.

alexeagle avatar Sep 12 '24 03:09 alexeagle

@laramiel @rickeylev @rwgk - I don't know how much interest there is in such an example. Or where it should live since it touches the whole stack. Maybe my personal repo isn't a terrible place :).

FYI: I'm not a Googler anymore and will not work on this repo anymore.

rwgk avatar Sep 12 '24 17:09 rwgk