Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

grpcio_tools: implement setuptools entrypoint for generating file #28662

Open
plannigan opened this issue Jan 23, 2022 · 5 comments
Open

grpcio_tools: implement setuptools entrypoint for generating file #28662

plannigan opened this issue Jan 23, 2022 · 5 comments

Comments

@plannigan
Copy link

Currently grpc_tools provides a command for integrating with setuptools. However, this requires custom integration on the part of the package (example: grpc_health_checking) and explicitly calling the command when building the wheel.

Is your feature request related to a problem? Please describe.

With the introduction of PEP 517 and PEP 518, directly calling setup.py will start becoming less common. Additionally this type of integration will not work with projects that use this mechanism and solely use setup.cfg

Describe the solution you'd like

Custom commands are not the only integration point that is available. setuptools. also supports entrypoints that allows for packages to act as plugins and provide custom behavior. This is documented with examples generating files based on revision control information. However, this could also be used to generate source files based on .proto files.

Describe alternatives you've considered

A project I currently work on needs to call a custom script to generate the files before building the package with build.

Additional context

I'd be interested in working on the implementation of this functionality if it is something that would be accepted.

@lidizheng
Copy link
Contributor

Hi @plannigan. This sounds like a good helper feature. To make sure I understand, what you are proposing is a Makefile-like mechanism for setup.py? If a file is missing, the setup.cfg will specify how to build it and what is required to build it.

CC @gnossen WDYT?

@gnossen
Copy link
Contributor

gnossen commented Feb 16, 2022

Sounds totally reasonable to me. I'd be more than happy to review/accept a change like this.

Thanks for the offer @plannigan !

@plannigan
Copy link
Author

Something like that. The project I where I use grpc does not use the custom command (didn't know it existed until I started looking specifically into this issue). The current setup is a shell script that executed first that will call python -m grpc_tools.protoc with the relevant CLI arguments (--python_out, --grpc_python_out, & --proto_path). So I was thinking about something that could read pyproject.toml for configuration parameters that would allow the setuptools plugin to execute the same code path.

Also, my project also uses mypy-protobuf. So it could be nice if there was a way to accept other CLI arguments as well. But that doesn't need to be the primary concern.

@lidizheng
Copy link
Contributor

lidizheng commented Feb 16, 2022

@plannigan If you have a clear idea of what this feature will look like, can you put together a short proposal for what you want to do to https://github.com/grpc/proposal ? One example proposal can be https://github.com/grpc/proposal/blob/master/L95-python-reflection-client.md.

If possible, I think gRPC should support different ProtoBuf implementations. gRPC Java does.

@plannigan
Copy link
Author

Proposal: grpc/proposal#290

@yashykt yashykt assigned gnossen and unassigned yashykt Apr 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants