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

L97: Python: Setuptools entrypoint for generating file #290

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

plannigan
Copy link

No description provided.

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Feb 19, 2022

CLA Signed

The committers are authorized under a signed CLA.

Copy link
Contributor

@lidizheng lidizheng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Patrick, sorry for the late review. This proposal will be a huge improvement to UX of using Python Protobuf with gRPC.

L96-python-setuptools-plugin.md Outdated Show resolved Hide resolved
L96-python-setuptools-plugin.md Outdated Show resolved Hide resolved
L96-python-setuptools-plugin.md Outdated Show resolved Hide resolved
L96-python-setuptools-plugin.md Outdated Show resolved Hide resolved
L96-python-setuptools-plugin.md Outdated Show resolved Hide resolved
the same `main()` function used by the `grpc_tools.protoc` CLI. A [tool table][tool_table] within the
file `pyproject.toml` will be used to accept configuration parameters. This will add a dependency on
tomli for now, but this will [not be needed][pep_680] starting in Python 3.11.

Copy link
Contributor

@lidizheng lidizheng Mar 3, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional: The import path generated by grpc_tools.protoc can be counterintuitive grpc/grpc#9575. In the config file, we might want to provide the flexibility to: 1. set the work directory; 2. the "prefixes_to_filter" argument.

CC @gnossen , if you got a second, can you help about how to use "prefixes_to_filter" in our generator?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prefixes_to_filter is currently not available in grpcio-tools, only in the Bazel rules, so I think it's okay to leave it out of this proposal, at least initially. Regardless, this is the best reference on usage.

L96-python-setuptools-plugin.md Outdated Show resolved Hide resolved
L96-python-setuptools-plugin.md Outdated Show resolved Hide resolved
L96-python-setuptools-plugin.md Outdated Show resolved Hide resolved
@plannigan plannigan force-pushed the L96-python-setuptools-plugin branch from b571cc7 to 29baceb Compare March 11, 2022 15:59
@plannigan plannigan changed the title L96: Python: Setuptools entrypoint for generating file L97: Python: Setuptools entrypoint for generating file Mar 11, 2022
@plannigan
Copy link
Author

Number had to be updated because #240 was merged using L96 after this PR was initially created.

Copy link
Contributor

@lidizheng lidizheng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update.


`grpcio-tools` will register a new entrypoint function to respond to the `setuptools.file_finders`
hook. This hook will generate Python files based on the `.proto` files and tell `setuptools where
they were generated.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we update the example to show how the proto to Python generation should work?

@plannigan plannigan force-pushed the L96-python-setuptools-plugin branch from 14e7d71 to 6ec57ba Compare May 5, 2022 00:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants