Good morning everyone, I would like to generate co...
# general
a
Good morning everyone, I would like to generate code from embedding.proto file for datalakesvc and embeddingsvc services. Here is the content of the BUILD file from protobuf embedding/v1
Copy code
protobuf_sources(
    name="embedding",
    python_source_root="src/python",
    grpc=True
)
Here is the content of the requirements.txt: alembic asyncpg cryptography fastapi grpcio grpcio-reflection grpcio-testing grpcio-tools httpx hupper nats-py pyjwt pydantic pydantic-settings pytest python-dotenv RAGatouille requests sqlalchemy[asyncio] uvicorn protobuf What is the goal statement for generating Python code from the .proto file using GRPC? According to https://www.pantsbuild.org/stable/docs/python/integrations/protobuf-and-grpc#protobuf-and-source-roots it is also not clear to me how code is generated. Best regards
b
I have the exact same question. Documentation doesn't mention explicitly when/how the protobuf python code is generated, I'm under the impression that it happens either: • by calling "pants tailor"? • when python code imports the protobuf generated python code? (which would be weird - since I haven't generated it yet...)
a
Hello, Do we have a solution found on this thread? I have tried to make use of
pants export-codegen ::
command that exported the
*_pb2.py
and
*_pb2_grpc.py
files at
dist/codegen
path. But, I am unable to get them available at the path of their respective
.proto
files.
Although we are using pants 2.24.1, I was able to take reference of this document https://www.pantsbuild.org/stable/docs/python/integrations/protobuf-and-grpc, which is for 2.26 version of pants, and with the help of this command, I was able to see the generated python files on this path -->
dist/export/python/virtualenvs
Copy code
pants export --resolve=<resolve> --export-py-generated-sources-in-resolve=<resolve>