Skip to content

Commit 321942d

Browse files
authored
chore: fix import paths in protoc generated code (#255)
Signed-off-by: Sreekanth <prsreekanth920@gmail.com>
1 parent cdf8d8e commit 321942d

15 files changed

Lines changed: 273 additions & 277 deletions

File tree

Makefile

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,10 @@ setup:
2626
poetry install --with dev --no-root
2727

2828
proto:
29-
poetry run python3 -m grpc_tools.protoc --pyi_out=pynumaflow/proto/sinker -I=pynumaflow/proto/sinker --python_out=pynumaflow/proto/sinker --grpc_python_out=pynumaflow/proto/sinker pynumaflow/proto/sinker/*.proto
30-
poetry run python3 -m grpc_tools.protoc --pyi_out=pynumaflow/proto/mapper -I=pynumaflow/proto/mapper --python_out=pynumaflow/proto/mapper --grpc_python_out=pynumaflow/proto/mapper pynumaflow/proto/mapper/*.proto
31-
poetry run python3 -m grpc_tools.protoc --pyi_out=pynumaflow/proto/reducer -I=pynumaflow/proto/reducer --python_out=pynumaflow/proto/reducer --grpc_python_out=pynumaflow/proto/reducer pynumaflow/proto/reducer/*.proto
32-
poetry run python3 -m grpc_tools.protoc --pyi_out=pynumaflow/proto/sourcetransformer -I=pynumaflow/proto/sourcetransformer --python_out=pynumaflow/proto/sourcetransformer --grpc_python_out=pynumaflow/proto/sourcetransformer pynumaflow/proto/sourcetransformer/*.proto
33-
poetry run python3 -m grpc_tools.protoc --pyi_out=pynumaflow/proto/sideinput -I=pynumaflow/proto/sideinput --python_out=pynumaflow/proto/sideinput --grpc_python_out=pynumaflow/proto/sideinput pynumaflow/proto/sideinput/*.proto
34-
poetry run python3 -m grpc_tools.protoc --pyi_out=pynumaflow/proto/sourcer -I=pynumaflow/proto/sourcer --python_out=pynumaflow/proto/sourcer --grpc_python_out=pynumaflow/proto/sourcer pynumaflow/proto/sourcer/*.proto
35-
poetry run python3 -m grpc_tools.protoc --pyi_out=pynumaflow/proto/accumulator -I=pynumaflow/proto/accumulator --python_out=pynumaflow/proto/accumulator --grpc_python_out=pynumaflow/proto/accumulator pynumaflow/proto/accumulator/*.proto
36-
37-
38-
sed -i.bak -e 's/^\(import.*_pb2\)/from . \1/' pynumaflow/proto/*/*.py
39-
rm pynumaflow/proto/*/*.py.bak
29+
poetry run python3 -m grpc_tools.protoc -Ipynumaflow/proto/sinker=pynumaflow/proto/sinker --pyi_out=. --python_out=. --grpc_python_out=. pynumaflow/proto/sinker/*.proto
30+
poetry run python3 -m grpc_tools.protoc -Ipynumaflow/proto/mapper=pynumaflow/proto/mapper --pyi_out=. --python_out=. --grpc_python_out=. pynumaflow/proto/mapper/*.proto
31+
poetry run python3 -m grpc_tools.protoc -Ipynumaflow/proto/reducer=pynumaflow/proto/reducer --pyi_out=. --python_out=. --grpc_python_out=. pynumaflow/proto/reducer/*.proto
32+
poetry run python3 -m grpc_tools.protoc -Ipynumaflow/proto/sourcetransformer=pynumaflow/proto/sourcetransformer --pyi_out=. --python_out=. --grpc_python_out=. pynumaflow/proto/sourcetransformer/*.proto
33+
poetry run python3 -m grpc_tools.protoc -Ipynumaflow/proto/sideinput=pynumaflow/proto/sideinput --pyi_out=. --python_out=. --grpc_python_out=. pynumaflow/proto/sideinput/*.proto
34+
poetry run python3 -m grpc_tools.protoc -Ipynumaflow/proto/sourcer=pynumaflow/proto/sourcer --pyi_out=. --python_out=. --grpc_python_out=. pynumaflow/proto/sourcer/*.proto
35+
poetry run python3 -m grpc_tools.protoc -Ipynumaflow/proto/accumulator=pynumaflow/proto/accumulator --pyi_out=. --python_out=. --grpc_python_out=. pynumaflow/proto/accumulator/*.proto

pynumaflow/proto/accumulator/accumulator_pb2.py

Lines changed: 22 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pynumaflow/proto/accumulator/accumulator_pb2_grpc.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
import grpc
44
import warnings
55

6-
from . import accumulator_pb2 as accumulator__pb2
76
from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2
7+
from pynumaflow.proto.accumulator import accumulator_pb2 as pynumaflow_dot_proto_dot_accumulator_dot_accumulator__pb2
88

99
GRPC_GENERATED_VERSION = '1.75.0'
1010
GRPC_VERSION = grpc.__version__
@@ -19,7 +19,7 @@
1919
if _version_not_supported:
2020
raise RuntimeError(
2121
f'The grpc package installed is at version {GRPC_VERSION},'
22-
+ f' but the generated code in accumulator_pb2_grpc.py depends on'
22+
+ f' but the generated code in pynumaflow/proto/accumulator/accumulator_pb2_grpc.py depends on'
2323
+ f' grpcio>={GRPC_GENERATED_VERSION}.'
2424
+ f' Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}'
2525
+ f' or downgrade your generated code using grpcio-tools<={GRPC_VERSION}.'
@@ -40,13 +40,13 @@ def __init__(self, channel):
4040
"""
4141
self.AccumulateFn = channel.stream_stream(
4242
'/accumulator.v1.Accumulator/AccumulateFn',
43-
request_serializer=accumulator__pb2.AccumulatorRequest.SerializeToString,
44-
response_deserializer=accumulator__pb2.AccumulatorResponse.FromString,
43+
request_serializer=pynumaflow_dot_proto_dot_accumulator_dot_accumulator__pb2.AccumulatorRequest.SerializeToString,
44+
response_deserializer=pynumaflow_dot_proto_dot_accumulator_dot_accumulator__pb2.AccumulatorResponse.FromString,
4545
_registered_method=True)
4646
self.IsReady = channel.unary_unary(
4747
'/accumulator.v1.Accumulator/IsReady',
4848
request_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString,
49-
response_deserializer=accumulator__pb2.ReadyResponse.FromString,
49+
response_deserializer=pynumaflow_dot_proto_dot_accumulator_dot_accumulator__pb2.ReadyResponse.FromString,
5050
_registered_method=True)
5151

5252

@@ -75,13 +75,13 @@ def add_AccumulatorServicer_to_server(servicer, server):
7575
rpc_method_handlers = {
7676
'AccumulateFn': grpc.stream_stream_rpc_method_handler(
7777
servicer.AccumulateFn,
78-
request_deserializer=accumulator__pb2.AccumulatorRequest.FromString,
79-
response_serializer=accumulator__pb2.AccumulatorResponse.SerializeToString,
78+
request_deserializer=pynumaflow_dot_proto_dot_accumulator_dot_accumulator__pb2.AccumulatorRequest.FromString,
79+
response_serializer=pynumaflow_dot_proto_dot_accumulator_dot_accumulator__pb2.AccumulatorResponse.SerializeToString,
8080
),
8181
'IsReady': grpc.unary_unary_rpc_method_handler(
8282
servicer.IsReady,
8383
request_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString,
84-
response_serializer=accumulator__pb2.ReadyResponse.SerializeToString,
84+
response_serializer=pynumaflow_dot_proto_dot_accumulator_dot_accumulator__pb2.ReadyResponse.SerializeToString,
8585
),
8686
}
8787
generic_handler = grpc.method_handlers_generic_handler(
@@ -112,8 +112,8 @@ def AccumulateFn(request_iterator,
112112
request_iterator,
113113
target,
114114
'/accumulator.v1.Accumulator/AccumulateFn',
115-
accumulator__pb2.AccumulatorRequest.SerializeToString,
116-
accumulator__pb2.AccumulatorResponse.FromString,
115+
pynumaflow_dot_proto_dot_accumulator_dot_accumulator__pb2.AccumulatorRequest.SerializeToString,
116+
pynumaflow_dot_proto_dot_accumulator_dot_accumulator__pb2.AccumulatorResponse.FromString,
117117
options,
118118
channel_credentials,
119119
insecure,
@@ -140,7 +140,7 @@ def IsReady(request,
140140
target,
141141
'/accumulator.v1.Accumulator/IsReady',
142142
google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString,
143-
accumulator__pb2.ReadyResponse.FromString,
143+
pynumaflow_dot_proto_dot_accumulator_dot_accumulator__pb2.ReadyResponse.FromString,
144144
options,
145145
channel_credentials,
146146
insecure,

0 commit comments

Comments
 (0)