From 0dee012ec421ee5cf8735a022c34f94c78347deb Mon Sep 17 00:00:00 2001 From: yangxuan Date: Wed, 15 May 2024 16:32:46 +0800 Subject: [PATCH] enhance: [2.4]Expand grpcio version to latest Signed-off-by: yangxuan --- .github/workflows/check_milvus_proto.yml | 1 + .github/workflows/code_checker.yml | 2 +- .github/workflows/pull_request.yml | 2 +- Makefile | 9 +++++---- README.md | 7 +++---- pymilvus/grpc_gen/common_pb2.py | 2 +- pymilvus/grpc_gen/feder_pb2.py | 2 +- pymilvus/grpc_gen/milvus_pb2.py | 2 +- pymilvus/grpc_gen/msg_pb2.py | 2 +- pymilvus/grpc_gen/python_gen.sh | 2 -- pymilvus/grpc_gen/rg_pb2.py | 2 +- pymilvus/grpc_gen/schema_pb2.py | 2 +- pyproject.toml | 10 +++++++--- requirements.txt | 6 +++--- 14 files changed, 27 insertions(+), 24 deletions(-) diff --git a/.github/workflows/check_milvus_proto.yml b/.github/workflows/check_milvus_proto.yml index 059c45494..5c4f2e307 100644 --- a/.github/workflows/check_milvus_proto.yml +++ b/.github/workflows/check_milvus_proto.yml @@ -31,5 +31,6 @@ jobs: - name: Try generate proto run: | git submodule update --init + make gen_proto make check_proto_product diff --git a/.github/workflows/code_checker.yml b/.github/workflows/code_checker.yml index b65be2e30..10488b616 100644 --- a/.github/workflows/code_checker.yml +++ b/.github/workflows/code_checker.yml @@ -24,7 +24,7 @@ jobs: pip install -e . - name: Install requirements run: | - pip install -r requirements.txt + pip install -e ".[dev]" - name: Run pylint shell: bash run: | diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 22b2b6629..74389642a 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -28,7 +28,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install -e ".[test]" + pip install -e ".[dev]" - name: Test with pytest run: | diff --git a/Makefile b/Makefile index 8fcea583c..2dfd51128 100644 --- a/Makefile +++ b/Makefile @@ -2,12 +2,12 @@ unittest: PYTHONPATH=`pwd` python3 -m pytest tests --cov=pymilvus -v lint: - PYTHONPATH=`pwd` black pymilvus --check - PYTHONPATH=`pwd` ruff check pymilvus + PYTHONPATH=`pwd` python3 -m black pymilvus --check + PYTHONPATH=`pwd` python3 -m ruff check pymilvus format: - PYTHONPATH=`pwd` black pymilvus - PYTHONPATH=`pwd` ruff check pymilvus --fix + PYTHONPATH=`pwd` python3 -m black pymilvus + PYTHONPATH=`pwd` python3 -m ruff check pymilvus --fix codecov: PYTHONPATH=`pwd` pytest --cov=pymilvus --cov-report=xml tests -x -v -rxXs @@ -25,6 +25,7 @@ get_proto: git submodule update --init gen_proto: + python3 -m pip install -e ".[dev]" cd pymilvus/grpc_gen && ./python_gen.sh check_proto_product: gen_proto diff --git a/README.md b/README.md index 1d99640cb..4704eacb4 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,7 @@ You can install PyMilvus via `pip` or `pip3` for Python 3.8+: ```shell $ pip3 install pymilvus $ pip3 install pymilvus[model] # for milvus-model +$ pip3 install pymilvus[bulk_writer] # for bulk_writer ``` You can install a specific version of PyMilvus by: @@ -62,8 +63,6 @@ $ git submodule update --init Q2. How to generate python files from milvus-proto? -**Before generating python files, please install requirements in `requirements.txt`** - A2. ```shell $ make gen_proto @@ -94,10 +93,10 @@ Q6. How to run unittests? A6 ```shell -$ pip install ".[test]" +$ pip install ".[dev]" $ make unittest ``` -Q7. `zsh: no matches found: pymilvus[model]` in mac, how do I solve this? +Q7. `zsh: no matches found: pymilvus[model]`, how do I solve this? A7 ```shell diff --git a/pymilvus/grpc_gen/common_pb2.py b/pymilvus/grpc_gen/common_pb2.py index 93cb1f833..16cd10f9b 100644 --- a/pymilvus/grpc_gen/common_pb2.py +++ b/pymilvus/grpc_gen/common_pb2.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: common.proto -# Protobuf Python Version: 4.25.0 +# Protobuf Python Version: 4.25.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool diff --git a/pymilvus/grpc_gen/feder_pb2.py b/pymilvus/grpc_gen/feder_pb2.py index 992594e4a..2d24371b4 100644 --- a/pymilvus/grpc_gen/feder_pb2.py +++ b/pymilvus/grpc_gen/feder_pb2.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: feder.proto -# Protobuf Python Version: 4.25.0 +# Protobuf Python Version: 4.25.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool diff --git a/pymilvus/grpc_gen/milvus_pb2.py b/pymilvus/grpc_gen/milvus_pb2.py index 7d991f64a..4c5b39cab 100644 --- a/pymilvus/grpc_gen/milvus_pb2.py +++ b/pymilvus/grpc_gen/milvus_pb2.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: milvus.proto -# Protobuf Python Version: 4.25.0 +# Protobuf Python Version: 4.25.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool diff --git a/pymilvus/grpc_gen/msg_pb2.py b/pymilvus/grpc_gen/msg_pb2.py index 8673318fb..4492b9bb5 100644 --- a/pymilvus/grpc_gen/msg_pb2.py +++ b/pymilvus/grpc_gen/msg_pb2.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: msg.proto -# Protobuf Python Version: 4.25.0 +# Protobuf Python Version: 4.25.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool diff --git a/pymilvus/grpc_gen/python_gen.sh b/pymilvus/grpc_gen/python_gen.sh index a227b2d90..435fe2e08 100755 --- a/pymilvus/grpc_gen/python_gen.sh +++ b/pymilvus/grpc_gen/python_gen.sh @@ -3,8 +3,6 @@ OUTDIR=. PROTO_DIR="milvus-proto/proto" -python -m pip install "grpcio-tools==$(python3 -c 'import grpc; print(grpc.__version__)')" - python -m grpc_tools.protoc -I ${PROTO_DIR} --python_out=${OUTDIR} --pyi_out=${OUTDIR} ${PROTO_DIR}/common.proto python -m grpc_tools.protoc -I ${PROTO_DIR} --python_out=${OUTDIR} --pyi_out=${OUTDIR} ${PROTO_DIR}/schema.proto python -m grpc_tools.protoc -I ${PROTO_DIR} --python_out=${OUTDIR} --pyi_out=${OUTDIR} ${PROTO_DIR}/feder.proto diff --git a/pymilvus/grpc_gen/rg_pb2.py b/pymilvus/grpc_gen/rg_pb2.py index 1806e7b7f..22c27cda7 100644 --- a/pymilvus/grpc_gen/rg_pb2.py +++ b/pymilvus/grpc_gen/rg_pb2.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: rg.proto -# Protobuf Python Version: 4.25.0 +# Protobuf Python Version: 4.25.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool diff --git a/pymilvus/grpc_gen/schema_pb2.py b/pymilvus/grpc_gen/schema_pb2.py index b9dd24c21..5f8f8d39a 100644 --- a/pymilvus/grpc_gen/schema_pb2.py +++ b/pymilvus/grpc_gen/schema_pb2.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: schema.proto -# Protobuf Python Version: 4.25.0 +# Protobuf Python Version: 4.25.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool diff --git a/pyproject.toml b/pyproject.toml index 5032eac7c..53d56f2e2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -18,7 +18,7 @@ description = "Python Sdk for Milvus" readme = "README.md" dependencies=[ "setuptools >= 67", # python3.12 pkg_resources - "grpcio>=1.49.1,<=1.60.0", + "grpcio>=1.49.1, <=1.63.0", "protobuf>=3.20.0", "environs<=9.5.0", "ujson>=2.0.0", @@ -49,11 +49,15 @@ model = [ "milvus-model>=0.1.0", ] -test = [ +dev = [ + # The generated codes of 1.63.0 is incompatible with versions < 1.63.0, + # so we use fixed grpcio version to develop. + "grpcio==1.62.2", + "grpcio-tools==1.62.2", + "grpcio-testing==1.62.2", "pytest>=5.3.4", "pytest-cov>=2.8.1", "pytest-timeout>=1.3.4", - "grpcio-testing", "ruff>0.4.0", "black", ] diff --git a/requirements.txt b/requirements.txt index 4015bf4e4..f6277f28d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,9 +2,9 @@ build==0.4.0 certifi==2023.7.22 chardet==4.0.0 environs==9.5.0 -grpcio==1.60.0 -grpcio-testing==1.60.0 -grpcio-tools==1.60.0 +grpcio==1.62.2 +grpcio-testing==1.62.2 +grpcio-tools==1.62.2 protobuf==4.25.2 idna==2.10 packaging==20.9