Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I share Protocol Buffer .proto files between multiple repositories

We are considering using Protocol Buffers for communicating between a python & a node.js service that each live in their own repos.

Since the .proto files must be accessible to both repos, how should we share the .proto files?

We are currently considering:

  1. Creating a repo for all our .proto files, and making it a git subtree of all our services
  2. Creating a repo for all our .proto files, publishing both a private python module and private node module on push, and requiring the modules from the respective services
  3. Creating a repo for all our .proto files, and specifying the repository as the destination of a pip / npm package

What is the standard way to share .proto files between repositories?

like image 878
Swaraj Avatar asked Aug 09 '16 23:08

Swaraj


People also ask

How do you share on Proto?

You can share your Proto.io project using Share links, that is, links that others can access. You can choose to share your prototype as: Live Version: Share a live version of your prototype. Any changes made to your prototype will be visible to the people who access this Share link.

How do I send Protobuf over HTTP?

You can certainly send even a binary payload with an HTTP request, or in an HTTP response. Just write the bytes of the protocol buffer directly into the request/response, and make sure to set the content type to "application/octet-stream". The client, and server, should be able to take care of the rest easily.

Is Protobuf forward compatible?

So long as you're careful about when and how you change and remove fields, your protobuf will be forward and backward compatible.


2 Answers

This depends on your development process.

A git subtree / submodule seems like a sensible solution for most purposes. If you had more downstream projects, publishing a ready-made module would make sense, as then the protobuf generator wouldn't be needed for every project.

like image 128
jpa Avatar answered Oct 08 '22 22:10

jpa


We, in the same situation, used 3 repos: server-side was written in c++, client-side in actionscript 3, and protobufs was in the third, and was used both of them. For a big team, and big project I think it was a good choice.

like image 39
Dmitry Malugin Avatar answered Oct 08 '22 23:10

Dmitry Malugin