[python] Support importing without proto file name knowledge in Python generated protobuf code#275
Conversation
Signed-off-by: Karen X <karenxyr@gmail.com>
Signed-off-by: Karen X <karenxyr@gmail.com>
Signed-off-by: Karen X <karenxyr@gmail.com>
Signed-off-by: Karen X <karenxyr@gmail.com>
|
Surprisingly, the updates to
|
|
Fixed in #277 |
Signed-off-by: Karen X <karenxyr@gmail.com>
Signed-off-by: Karen X <karenxyr@gmail.com>
|
Gave this change a try with OSB and the new import scheme works fine. I notice the init.py files in the package are still relatively simple and achieve the goal of removing filenames from end user imports and am wondering why |
Signed-off-by: karenx <karenx@uber.com>
|
@finnegancarroll Ah, it was part of a legacy implementation where I was populating the init.py files with every single protobuf type like: Have removed this, thanks so much for catching this! |

Description
Python generated code users should not need to know the the protobuf filename that the message is located in (i.e. whether it's in document.proto, search.proto, or common.proto). This PR adds support for importing without reference to the filenames. Still backward compatible to support the previous way of importing.
Method 1: File Name Dependent (current import style)
Method 2: No File Name Dependency (new import style added in this PR)
Test plan
Details How it works
generate_init_files.pywill:*_pb2.pyfiles in the schemas and services directoriesBUILD.bazelintegrates the generated init files through thefix_python_importsgenrule