Skip to content

Bump the proto requirements to match the generated data. #4473

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

Merged
merged 16 commits into from
Sep 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 6 additions & 24 deletions check/build-changed-protos
Original file line number Diff line number Diff line change
Expand Up @@ -55,35 +55,17 @@ else
fi

# All the protos.
protos=$(find -type f -name "*.proto" -printf '%P\n' \
| grep "google/api/.*\.proto$" \
| sed -e "s/\.proto$//")
echo "Building protos in $(pwd)"

# Get the changed protos and strip them of ".proto"
changed=$(git diff --name-only ${rev} -- \
| grep "google/api/.*\.proto$" \
| sed -e "s/\.proto$//"
)
if [[ ! -z "$changed" ]]; then
for base in $changed
do
echo -e "Found changed proto: '${base}.proto'"
done
fi

# We potentially will attempt to build a second time.
for base in $changed
do
python -m grpc_tools.protoc -I=cirq-google --python_out=cirq-google --mypy_out=cirq-google ${base}.proto
done
dev_tools/build-protos.sh

# Filenames with spaces will be ugly (each part will be listed separately)
# but the error logic will still work.
untracked=$(git status --porcelain 2>/dev/null | grep "^?? cirq/google" | cut -d " " -f 2)
uncommitted=$(git status --porcelain 2>/dev/null | grep -E "^?? cirq-google" | cut -d " " -f 3)

if [[ ! -z "$untracked" ]]; then
echo -e "\033[31mERROR: Uncommitted generated files found! Please generate and commit these files:\033[0m"
for generated in $untracked
if [[ ! -z "$uncommitted" ]]; then
echo -e "\033[31mERROR: Uncommitted generated files found! Please generate and commit these files using dev_tools/build-protos.sh:\033[0m"
for generated in $uncommitted
do
echo -e "\033[31m ${generated}\033[0m"
done
Expand Down
2 changes: 1 addition & 1 deletion cirq-google/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
google-api-core[grpc] >= 1.14.0, < 2.0.0dev
protobuf~=3.13.0
protobuf>=3.13.0
6 changes: 2 additions & 4 deletions dev_tools/requirements/deps/protos.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# dependencies for proto generation - used by cirq-google

# 1.26.0 is the min version that has python 3.8 wheels
# however, we can't really go much higher - the protoc version needs to be <= 3.9.2
# otherwise it will generate pb2 files that are incompatible with tensorflow quantum
grpcio-tools~=1.26.0
# This bundles protoc 3.13.0, which we use for generating proto code.
grpcio-tools~=1.34.1

mypy-protobuf==1.10