Files
qdrant-client/tools/generate_grpc_client.sh
Arnaud Gourlay ddd24214b8 v0.10.0 (#71)
* generate gRPC client

* generate REST client

* draft

* wip

* fix conversion test

* old api compatible

* clean deprecated

* batch search + reco tests

* multi-vector test

* full-text filtering

* Fast protobuf (#67)

* generate grpc client

use new grpc client in qdrant methods

fix grpc parallel issue

remove betterproto

remove betterproto

remove betterproto type annotation

extend test coverage

upd protobuf to master

* rm eventloop

* upd version

* shortcut for models

* v0.10.1 compatibility hotfix: make deprecated ram_data_size optional

Co-authored-by: Andrey Vasnetsov <andrey@vasnetsov.com>
2022-09-19 12:59:29 +02:00

39 lines
1.2 KiB
Bash
Executable File

#!/usr/bin/env bash
set -e
PROJECT_ROOT="$(pwd)/$(dirname "$0")/../"
cd $(mktemp -d)
git clone --sparse --filter=blob:none --depth=1 git@github.com:qdrant/qdrant.git
cd qdrant
git sparse-checkout add lib/api/src/grpc/proto
PROTO_DIR="$(pwd)/lib/api/src/grpc/proto"
# Ensure current path is project root
cd $PROJECT_ROOT
CLIENT_DIR="qdrant_client/proto"
cp $PROTO_DIR/*.proto $CLIENT_DIR/
# Remove internal services *.proto
rm $CLIENT_DIR/points_internal_service.proto
rm $CLIENT_DIR/collections_internal_service.proto
rm $CLIENT_DIR/raft_service.proto
cat $CLIENT_DIR/qdrant.proto \
| grep -v 'collections_internal_service.proto' \
| grep -v 'points_internal_service.proto' \
| grep -v 'raft_service.proto' \
> $CLIENT_DIR/qdrant_tmp.proto
mv $CLIENT_DIR/qdrant_tmp.proto $CLIENT_DIR/qdrant.proto
python -m grpc_tools.protoc --proto_path=qdrant_client/proto/ -I ./qdrant_client/grpc ./qdrant_client/proto/*.proto --python_out=./qdrant_client/grpc --grpc_python_out=./qdrant_client/grpc
# maybe I'll remove this crutch when google makes normal imports for issue from 2016
# https://github.com/protocolbuffers/protobuf/issues/1491
sed -i -re 's/^import (\w*)_pb2/from . import \1_pb2/g' ./qdrant_client/grpc/*.py