Skip to content

Commit af69447

Browse files
Cleanup protoc-gen-connect-python (#8)
Just some minor cleanup, even if we decide to eventually move to writing the plugin in Python. * Remove old dependency * Update to non-deprecated dev dependencies * Fix maintainer email * Add Dependabot configuration for Go Signed-off-by: Stefan VanBuren <[email protected]>
1 parent b2fe4fc commit af69447

File tree

6 files changed

+22
-18
lines changed

6 files changed

+22
-18
lines changed

.github/dependabot.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,12 @@ updates:
1818
python:
1919
patterns:
2020
- "*"
21+
- package-ecosystem: gomod
22+
directories:
23+
- "protoc-gen-connect-python/"
24+
schedule:
25+
interval: weekly
26+
groups:
27+
go:
28+
patterns:
29+
- "*"

protoc-gen-connect-python/generator/generator.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,17 @@ import (
88
"strings"
99
"unicode"
1010

11-
plugin "github.com/golang/protobuf/protoc-gen-go/plugin"
1211
"google.golang.org/protobuf/proto"
1312
"google.golang.org/protobuf/reflect/protodesc"
1413
"google.golang.org/protobuf/reflect/protoreflect"
1514
"google.golang.org/protobuf/types/descriptorpb"
15+
"google.golang.org/protobuf/types/pluginpb"
1616
)
1717

18-
func Generate(r *plugin.CodeGeneratorRequest) *plugin.CodeGeneratorResponse {
19-
resp := &plugin.CodeGeneratorResponse{}
18+
func Generate(r *pluginpb.CodeGeneratorRequest) *pluginpb.CodeGeneratorResponse {
19+
resp := &pluginpb.CodeGeneratorResponse{}
2020

21-
resp.SupportedFeatures = proto.Uint64(uint64(plugin.CodeGeneratorResponse_FEATURE_PROTO3_OPTIONAL) | uint64(plugin.CodeGeneratorResponse_FEATURE_SUPPORTS_EDITIONS))
21+
resp.SupportedFeatures = proto.Uint64(uint64(pluginpb.CodeGeneratorResponse_FEATURE_PROTO3_OPTIONAL) | uint64(pluginpb.CodeGeneratorResponse_FEATURE_SUPPORTS_EDITIONS))
2222
resp.MinimumEdition = proto.Int32(int32(descriptorpb.Edition_EDITION_PROTO3))
2323
resp.MaximumEdition = proto.Int32(int32(descriptorpb.Edition_EDITION_2023))
2424

@@ -60,7 +60,7 @@ func Generate(r *plugin.CodeGeneratorRequest) *plugin.CodeGeneratorResponse {
6060
return resp
6161
}
6262

63-
func GenerateConnectFile(fd protoreflect.FileDescriptor, conf Config) (*plugin.CodeGeneratorResponse_File, error) {
63+
func GenerateConnectFile(fd protoreflect.FileDescriptor, conf Config) (*pluginpb.CodeGeneratorResponse_File, error) {
6464
filename := fd.Path()
6565

6666
fileNameWithoutSuffix := strings.TrimSuffix(filename, path.Ext(filename))
@@ -131,7 +131,7 @@ func GenerateConnectFile(fd protoreflect.FileDescriptor, conf Config) (*plugin.C
131131
return nil, err
132132
}
133133

134-
resp := &plugin.CodeGeneratorResponse_File{
134+
resp := &pluginpb.CodeGeneratorResponse_File{
135135
Name: proto.String(strings.TrimSuffix(filename, path.Ext(filename)) + "_connect.py"),
136136
Content: proto.String(buf.String()),
137137
}

protoc-gen-connect-python/go.mod

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@ module github.com/connectrpc/connect-python/protoc-gen-connect-python
22

33
go 1.24.3
44

5-
require (
6-
github.com/golang/protobuf v1.5.4
7-
google.golang.org/protobuf v1.36.8
8-
)
5+
require google.golang.org/protobuf v1.36.8
96

107
require github.com/google/go-cmp v0.7.0 // indirect

protoc-gen-connect-python/go.sum

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
2-
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
31
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
42
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
53
google.golang.org/protobuf v1.36.8 h1:xHScyCOEuuwZEc6UtSOvPbAT4zRh0xcNRYekJwfqyMc=

protoc-gen-connect-python/main.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import (
55
"log"
66
"os"
77

8-
plugin "github.com/golang/protobuf/protoc-gen-go/plugin"
98
"google.golang.org/protobuf/proto"
9+
"google.golang.org/protobuf/types/pluginpb"
1010

1111
"github.com/connectrpc/connect-python/protoc-gen-connect-python/generator"
1212
)
@@ -17,7 +17,7 @@ func main() {
1717
log.Fatalln("could not read from stdin", err)
1818
return
1919
}
20-
var req = &plugin.CodeGeneratorRequest{}
20+
req := &pluginpb.CodeGeneratorRequest{}
2121
err = proto.Unmarshal(data, req)
2222
if err != nil {
2323
log.Fatalln("could not unmarshal proto", err)
@@ -30,7 +30,7 @@ func main() {
3030
resp := generator.Generate(req)
3131

3232
if resp == nil {
33-
resp = &plugin.CodeGeneratorResponse{}
33+
resp = &pluginpb.CodeGeneratorResponse{}
3434
}
3535

3636
data, err = proto.Marshal(resp)

protoc-gen-connect-python/pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ maintainers = [
66
{ name = "Anuraag Agrawal", email = "[email protected]" },
77
{ name = "Spencer Nelson", email = "[email protected]" },
88
{ name = "Stefan VanBuren", email = "[email protected]" },
9-
{ name = "Yasushi Itoh", email = "i2y@todo" },
9+
{ name = "Yasushi Itoh", email = "i2y[email protected]" },
1010
]
1111
requires-python = ">= 3.10"
1212
readme = "README.md"
@@ -47,8 +47,8 @@ Homepage = "https://github.com/connectrpc/connect-python"
4747
Repository = "https://github.com/connectrpc/connect-python"
4848
Issues = "https://github.com/connectrpc/connect-python/issues"
4949

50-
[tool.uv]
51-
dev-dependencies = ["wheel"]
50+
[dependency-groups]
51+
dev = ["wheel"]
5252

5353
[build-system]
5454
requires = ["uv_build>=0.8.13,<0.9.0"]

0 commit comments

Comments
 (0)