Created
January 22, 2018 12:43
-
-
Save wilspi/806efd1f4f3579c7a00eb9aef2eda7f9 to your computer and use it in GitHub Desktop.
Generates client and server GRPC python code for all protos, given protos' directory. Read more here: https://grpc.io/docs/tutorials/basic/python.html#generating-client-and-server-code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Proto files directory | |
PROTOS_PATH="src/protos/" | |
# Directory in which auto generated code will be saved | |
AUTOGEN_GRPC_PATH="src/autogen_grp/" | |
# Generate python grpc code for each proto | |
# Requires grpcio-tools: pip install grpcio-tools | |
for file in "$PROTOS_PATH"* | |
do | |
if [[ $file =~ \.proto$ ]] | |
then | |
python -m grpc_tools.protoc -I $PROTOS_PATH --python_out=$AUTOGEN_GRPC_PATH --grpc_python_out=$AUTOGEN_GRPC_PATH "$file" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment