1

I have a repository which contains protocol buffer messages and services, originally written for a Golang project. I need to write a Python microservice but I'm not 100% clued up on how Python dependency management works. I need to import the definitions into my new Python project and compile them to Python.

How should I import my protocol buffer definitions repository into my Python project and compile the protobufs for Python? I can't copy the .pb files into my new project as they're shared amongst a number of other projects.

1 Answer 1

1

Protobufs is installable via pip

$ pip install protobuf

Read Installing Python Modules in the documentation if you need help on using pip.

Sign up to request clarification or add additional context in comments.

3 Comments

Ok cool. How about importing my protobuf definitions from my local repository into my project? That's the thing that's really confusing me.
Have you read the getting started? Also you may want to clarify your question then.
Hey Jonas, thanks for the link. I've clarified my question. I understand how to run protoc -I=$SRC_DIR --python_out=$DST_DIR $SRC_DIR/addressbook.proto but how do I import modules from a completely different repository and ensure everyone working on the project gets the latest versions?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.