At the moment I've started with the following directory structure:

repo/
    service/
        cpp/
        lib/
        python/
            service_pb2.py
            service_pb2_grpc.py
        service.proto
        CMakeLists.txt

and I've just tried adding an __init__.py to that python/ directory and 
pointing setuptools at service/python as the package_dir.  The issue then 
is that I get a module named service and I can import 
service.service_pb2_grpc.  However, service_pb2_grpc.py has an import 
service_pb2 instead of import service.service_pb2.

Not really sure how I can create a package using the auto-generated Python.

         

On Tuesday, 13 December 2022 at 11:07:06 UTC Shareef Jalloq wrote:

> Hi all,
>
> this is more of a request for best practice advice.  
>
> I'm trying to work out how to use proto files across projects.  I've seen 
> examples of people suggesting to submodule in the proto files to all 
> projects that use them.  That works nicely for most use cases where you 
> have a pure Git repo but what do people do when they're trying to 
> distribute a Python package that uses those proto files?
>
> If I want to be able to set up CI jobs to push packages to an index, and 
> have the Python *_pb2.py files generated as part of the flow, what do 
> people do here?  Or should I be looking at running protoc separately and 
> committing the resulting Python files before running the release flow?
>
> Shareef.
>

-- 
You received this message because you are subscribed to the Google Groups 
"grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to grpc-io+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/e3837c75-f886-497f-ac7c-02328d392f10n%40googlegroups.com.

Reply via email to