Generate correct import using grpcio-tools

Report a Dgraph Client Bug

What Dgraph client (and version) are you using?

(put “x” in the box to select)

  • Dgo
  • PyDgraph
  • Dgraph4J
  • Dgraph-js
  • Dgraph-js-http
  • Dgraph.NET

pydgraph v21.03.0 (latest)

What version of Dgraph are you using?

Dgraph v22.0(latest)

Steps to reproduce the issue (command/config used to run Dgraph).

Start Dgraph by docker compose.

docker compose up -d


docker compose start

if the containers exists.

Add pydgraph to my project by pdm:

pdm add pydgraph

Start qtconsole and type

import pydgraph

Hit the issue How to generate correct import using grpcio-tools #9575

Possible solution

After forking pydgraph and using the command executed from pydgraph/pydgraph/scripts:

python -m grpc_tools.protoc -I../pydgraph --python_out=. --pyi_out=. --grpc_python_out=. ../pydgraph/pydgraph/proto/api.proto

the module names and imports are correct and work as expected in python 3.11.0


Is it possible to do this in the official repository?