Skip to content
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

proto_api.h not included in python packages #9464

Closed
maxnoe opened this issue Feb 2, 2022 · 3 comments
Closed

proto_api.h not included in python packages #9464

maxnoe opened this issue Feb 2, 2022 · 3 comments

Comments

@maxnoe
Copy link

maxnoe commented Feb 2, 2022

What version of protobuf and what language are you using?
Version: master/3.19/3.14, seems to affect all recent versions
Language: C++/Python

What operating system (Linux, Windows, ...) and version?

Linux

What runtime / compiler are you using (e.g., python version or gcc version)

Not really applicable

What did you do?

Trying to compile a python extension using pybind11_protobuf, the Header proto_api.h, which is inside the python package in this repo is not found.

It seems this header is not included when installing the python package, e.g. in wheels or the arch linux python-protobuf package.

What did you expect to see

Header is included.

What did you see instead?

See above.

@haberman
Copy link
Member

haberman commented Feb 3, 2022

proto_api.h will be going away soon, as we will be releasing a new implementation of the Python Protobuf library that is based on https://github.com/protocolbuffers/upb instead of C++ protos.

The new Python Proto library cannot support the existing proto_api.h interface, as Python objects will not have a proto2::Message* inside of them. Instead they will have a upb_Message*.

We will likely expose a new/different capsule eventually to allow pybind11 users to access the upb proto object. But this will not be in the first version.

@haberman haberman closed this as completed Feb 3, 2022
@maxnoe
Copy link
Author

maxnoe commented Feb 4, 2022

What implications does this have for creating python bindings to a C++ library using the C++ protobuf library and not upb?

It sounds like it will require serialization/deseralization to transform c++ message instances into python upb instances.

That would be very unfortunate for us and would bring us back to the current state, which we had hoped to improve by using pybind11_protobuf

lopsided98 added a commit to lopsided98/nixpkgs that referenced this issue Aug 23, 2023
Needs:
  * re2 update (in staging currently)
  * pybind11_protobuf (for Python bindings)
    - CMake build system is kind of broken:
      pybind/pybind11_protobuf#128
    - Needs protobuf proto_api.h, which isn't installed and upstream says
      wontfix: protocolbuffers/protobuf#9464

See also:
  * conda-forge/or-tools-feedstock#47
  * pybind/pybind11_protobuf#60
lopsided98 added a commit to lopsided98/nixpkgs that referenced this issue Sep 2, 2023
Needs:
  * re2 update (in staging currently)
  * pybind11_protobuf (for Python bindings)
    - CMake build system is kind of broken:
      pybind/pybind11_protobuf#128
    - Needs protobuf proto_api.h, which isn't installed and upstream says
      wontfix: protocolbuffers/protobuf#9464

See also:
  * conda-forge/or-tools-feedstock#47
  * pybind/pybind11_protobuf#60
@StefanBruens
Copy link

We will likely expose a new/different capsule eventually to allow pybind11 users to access the upb proto object. But this will not be in the first version.

@haberman - do you have any way forward for making pybind11_protobuf buildable again? Something that is available now, not "eventually"?

As long as you don't have a replacement, you should not break dependent projects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants