-
Notifications
You must be signed in to change notification settings - Fork 493
Use buf for proto generation #286
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
34ab77f
6817bef
12f868f
2619194
4853f39
e340950
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| # Copyright (c) HashiCorp, Inc. | ||
| # SPDX-License-Identifier: MPL-2.0 | ||
|
|
||
| version: v1 | ||
| plugins: | ||
| - plugin: go | ||
| out: . | ||
| opt: | ||
| - paths=source_relative | ||
| - plugin: go-grpc | ||
| out: . | ||
| opt: | ||
| - paths=source_relative | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| # Copyright (c) HashiCorp, Inc. | ||
| # SPDX-License-Identifier: MPL-2.0 | ||
|
|
||
| version: v1 | ||
| build: | ||
| excludes: | ||
| - examples/ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| # Copyright (c) HashiCorp, Inc. | ||
| # SPDX-License-Identifier: MPL-2.0 | ||
|
|
||
| version: v1 | ||
| plugins: | ||
| - plugin: go | ||
| out: . | ||
| opt: | ||
| - paths=source_relative | ||
| - plugin: go-grpc | ||
| out: . | ||
| opt: | ||
| - paths=source_relative | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| # Copyright (c) HashiCorp, Inc. | ||
| # SPDX-License-Identifier: MPL-2.0 | ||
|
|
||
| version: v1 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,6 +3,7 @@ | |
|
|
||
| syntax = "proto3"; | ||
| package proto; | ||
| option go_package = "./proto"; | ||
|
|
||
| message GetRequest { | ||
| string key = 1; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,4 @@ | ||
| *.pyc | ||
| kv | ||
| kv-* | ||
| kv_* | ||
| !kv_*.py | ||
| /kv | ||
| /kv-* | ||
| /kv_* |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| # Copyright (c) HashiCorp, Inc. | ||
| # SPDX-License-Identifier: MPL-2.0 | ||
|
|
||
| version: v1 | ||
| plugins: | ||
| - plugin: go | ||
| out: . | ||
| opt: | ||
| - paths=source_relative | ||
| - plugin: go-grpc | ||
| out: . | ||
| opt: | ||
| - paths=source_relative | ||
| - plugin: python | ||
| out: plugin-python | ||
| - plugin: buf.build/grpc/python:v1.58.1 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So easy 😍. If you want, we could use remote plugins the same way for the go and go-grpc plugins and drop those tools from this repo. Usually the argument against it is that we don't want to depend on the BSR but since we're doing this for python anyway, why not?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah I think that would be a nice win to make it easy to use consistent plugin versions too. Added in e340950. |
||
| out: plugin-python | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| # Copyright (c) HashiCorp, Inc. | ||
| # SPDX-License-Identifier: MPL-2.0 | ||
|
|
||
| version: v1 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| /.venv |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| grpcio==1.59.0 | ||
| grpcio-health-checking==1.59.0 | ||
| protobuf==4.24.4 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,6 +3,7 @@ | |
|
|
||
| syntax = "proto3"; | ||
| package proto; | ||
| option go_package = "./proto"; | ||
|
|
||
| message GetRequest { | ||
| string key = 1; | ||
|
|
||
This file was deleted.
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are somewhat unusual. I might suggest using the "managed mode" feature of Buf's generation instead: https://buf.build/docs/generate/managed-mode. That would mean you can drop this option in all the files and buf would automatically set it to something sensible. It'll almost certainly look something like this:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a way to do this but keep the slightly odd
grpctestpackage name the same? I know it's only a test package, but it is technically part of the public API so I'd like to be quite strict about avoiding breaking changes, just to make the safety of the change easy to evaluate.