diff --git a/k8s/internal/Makefile b/k8s/internal/Makefile index ad172a017ab7..265370a3013c 100644 --- a/k8s/internal/Makefile +++ b/k8s/internal/Makefile @@ -162,34 +162,34 @@ graphscope-client-manylinux2014-py3-nodocker: if [[ "${ARCH}" == "aarch64" ]]; then \ python3 -m pip install grpcio==1.49.1 --no-binary grpcio; \ python3 -m pip install grpcio-tools==1.49.1 --no-binary grpcio-tools; \ - python3 -m pip install "numpy==1.23.2" "pandas" wheel "auditwheel==5.0.0"; \ else \ - python3 -m pip install "numpy==1.23.2" "pandas" "grpcio" "grpcio-tools" wheel "auditwheel==5.0.0"; \ + python3 -m pip install "grpcio" "grpcio-tools"; \ fi; \ + python3 -m pip install mypy-protobuf "numpy==1.23.2" "pandas" wheel "auditwheel==5.0.0"; \ elif [[ "$$py" == "cp310-cp310" ]]; then \ if [[ "${ARCH}" == "aarch64" ]]; then \ python3 -m pip install grpcio==1.49.1 --no-binary grpcio; \ python3 -m pip install grpcio-tools==1.49.1 --no-binary grpcio-tools; \ - python3 -m pip install "numpy==1.21.2" "pandas" wheel "auditwheel==5.0.0"; \ else \ - python3 -m pip install "numpy==1.21.2" "pandas" "grpcio>=1.49" "grpcio-tools>=1.49" wheel "auditwheel==5.0.0"; \ + python3 -m pip install "grpcio>=1.49" "grpcio-tools>=1.49"; \ fi; \ + python3 -m pip install mypy-protobuf "numpy==1.21.2" "pandas" wheel "auditwheel==5.0.0"; \ elif [[ "$$py" == "cp39-cp39" ]]; then \ if [[ "${ARCH}" == "aarch64" ]]; then \ python3 -m pip install grpcio==1.49.1 --no-binary grpcio; \ python3 -m pip install grpcio-tools==1.49.1 --no-binary grpcio-tools; \ - python3 -m pip install "numpy==1.19.3" "pandas" wheel "auditwheel==5.0.0"; \ else \ - python3 -m pip install "numpy==1.19.3" "pandas" "grpcio>=1.49" "grpcio-tools>=1.49" wheel "auditwheel==5.0.0"; \ + python3 -m pip install "grpcio>=1.49" "grpcio-tools>=1.49"; \ fi; \ + python3 -m pip install mypy-protobuf "numpy==1.19.3" "pandas" wheel "auditwheel==5.0.0"; \ else \ if [[ "${ARCH}" == "aarch64" ]]; then \ python3 -m pip install grpcio==1.49.1 --no-binary grpcio; \ python3 -m pip install grpcio-tools==1.49.1 --no-binary grpcio-tools; \ - python3 -m pip install "numpy" "pandas" wheel "auditwheel==5.0.0"; \ else \ - python3 -m pip install "numpy==1.18.5" "pandas" "grpcio>=1.49" "grpcio-tools>=1.49" wheel "auditwheel==5.0.0"; \ + python3 -m pip install "grpcio>=1.49" "grpcio-tools>=1.49"; \ fi; \ + python3 -m pip install mypy-protobuf "numpy" "pandas" wheel "auditwheel==5.0.0"; \ fi; \ sudo rm -rf build; \ sudo rm -rf dist/*.whl; \ @@ -214,20 +214,20 @@ graphscope-client-darwin-py3: py=$$(python3 -V 2>&1 | awk '{print $$2}' | awk -F '.' '{print $$1$$2}') && \ pip3 install -U pip && \ if [[ "$$py" == "311" ]]; then \ - pip3 install "numpy==1.23.2" "pandas" "grpcio>=1.49" "grpcio-tools>=1.49" delocate wheel; \ + pip3 install mypy-protobuf "numpy==1.23.2" "pandas" "grpcio>=1.49" "grpcio-tools>=1.49" delocate wheel; \ elif [[ "$$py" == "310" ]]; then \ - pip3 install "numpy==1.21.2" "pandas" "grpcio>=1.49" "grpcio-tools>=1.49" delocate wheel; \ + pip3 install mypy-protobuf "numpy==1.21.2" "pandas" "grpcio>=1.49" "grpcio-tools>=1.49" delocate wheel; \ elif [[ "$$py" == "cp39-cp39" ]]; then \ if [[ "${ARCH}" == "arm64" ]]; then \ - pip3 install "numpy==1.21.0" "pandas" "grpcio>=1.49" "grpcio-tools>=1.49" delocate wheel; \ + pip3 install mypy-protobuf "numpy==1.21.0" "pandas" "grpcio>=1.49" "grpcio-tools>=1.49" delocate wheel; \ else \ - pip3 install "numpy==1.19.3" "pandas" "grpcio>=1.49" "grpcio-tools>=1.49" delocate wheel; \ + pip3 install mypy-protobuf "numpy==1.19.3" "pandas" "grpcio>=1.49" "grpcio-tools>=1.49" delocate wheel; \ fi; \ else \ if [[ "${ARCH}" == "arm64" ]]; then \ - pip3 install "numpy==1.21.0" "pandas" "grpcio>=1.49" "grpcio-tools>=1.49" delocate wheel; \ + pip3 install mypy-protobuf "numpy==1.21.0" "pandas" "grpcio>=1.49" "grpcio-tools>=1.49" delocate wheel; \ else \ - pip3 install "numpy==1.18.5" "pandas" "grpcio>=1.49" "grpcio-tools>=1.49" delocate wheel; \ + pip3 install mypy-protobuf "numpy==1.18.5" "pandas" "grpcio>=1.49" "grpcio-tools>=1.49" delocate wheel; \ fi; \ fi; \ rm -rf build dist/*.whl || true && \ diff --git a/python/graphscope/proto/proto_generator.py b/python/graphscope/proto/proto_generator.py index fd1f7824bc1c..503dba2fab5a 100755 --- a/python/graphscope/proto/proto_generator.py +++ b/python/graphscope/proto/proto_generator.py @@ -60,6 +60,7 @@ def python_out(relative_dir, output_dir): "grpc_tools.protoc", "-I%s" % ".", "--python_out=%s" % os.path.join(output_dir), + "--mypy_out=%s" % os.path.join(output_dir), proto_file, ], stderr=subprocess.STDOUT, @@ -96,7 +97,9 @@ def python_service_out(relative_dir, output_dir): "grpc_tools.protoc", "-I%s" % ".", "--python_out=%s" % output_dir, + "--mypy_out=%s" % os.path.join(output_dir), "--grpc_python_out=%s" % output_dir, + "--mypy_grpc_out=%s" % os.path.join(output_dir), proto_file, ], stderr=subprocess.STDOUT, diff --git a/python/pyproject.toml b/python/pyproject.toml index 6e32c62062ad..916bb8ac460a 100644 --- a/python/pyproject.toml +++ b/python/pyproject.toml @@ -1,5 +1,5 @@ [build-system] -requires = ["setuptools_scm", "grpcio>=1.49", "grpcio-tools>=1.49", "numpy", "wheel"] +requires = ["setuptools_scm", "grpcio>=1.49", "grpcio-tools>=1.49", "mypy-protobuf", "numpy", "wheel"] [tool.black] line-length = 88 diff --git a/python/requirements.txt b/python/requirements.txt index 2eb67005455c..15932e2d843f 100644 --- a/python/requirements.txt +++ b/python/requirements.txt @@ -4,6 +4,7 @@ grpcio>=1.49 grpcio-tools>=1.49 kubernetes>=24.2.0 msgpack +mypy-protobuf>=3.4.0 nest_asyncio networkx==2.8.0;python_version>="3.8" networkx==2.6.0;python_version<"3.8"