pybind / pybind/pybind11_protobuf

proto package is not preserved

Open
#91 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
67
Forks
37
PR merge metrics
No merged PRs in 30d

Description

For this test I pulled the example code from
https://github.com/davidtwomey/pybind11_protobuf_example.git and updated it to use native_proto_caster + latest versions of libs
pybind_proto_example.zip
.

The issue is that the proto created in python has the type <class 'example_pb2.TestMessage'>
but the proto created in C++ has the type <class 'TestMessage'>

The module name is not preserved despite package being specified in example.proto. This breaks isinstance().

We see even more weirdness in our code with nested protos. Sometimes the nested proto includes the full module name (python-style) and sometimes it doesn't (C++ style).

Questions:

  1. Why is it happening?
  2. Is it safe?

To test:
unzip the attached code and run bazel run example

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Unzip the attached pybind_proto_example.zip and first run bazel run example to reproduce the differing Python and C++ types. Read example.proto and the native_proto_caster usage in the example, then trace how the package name is retained for top-level and nested protos. Done means explaining whether the behavior is safe and identifying the change needed to preserve the module name consistently.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
api
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.