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
Improve Protobuf's handling of __init__.py
files
#10498
Comments
Sounds like relying on PEP420 is what proto expects you to do? |
I'm not sure we should be in the business of generating The requirement to have an We can encourage people to embed |
Embedding |
That makes sense. We've come up with a different solution, hopefully more elegant: #10549 |
Would this work for your case? Essentially your protobuf_library targets would specify |
That sounds pretty good. Is there a way to try this once it's merged? Are there nightly builds? |
You can actually run Pants at any master SHA. I will write up how to do so (you may need to update your |
Closed in #10549 |
@danieljanes I've updated the runner script at https://pantsbuild.github.io/setup/pants to support running at any (recent) master SHA. See comments in the script for how to do that. |
Thanks @benjyw. I've used this successfully to update the example repo https://github.com/danieljanes/pants-python-protobuf based on the PR from @Eric-Arellano - no |
Awesome! |
Now that we no longer automagically create files, it's confusing what users should do with Protobuf.
If they aren't using PEP 420, they will need to create an
__init__.py
in theprotobuf_library()
folder, along with apython_library
target to own it. Then, the new__init__.py
dependency inference rule will find this file and infer a dependency on it. This is not at all obvious, nor elegant to require putting a Python file in your generic.proto
folder.Instead, we should likely add an option
generate_init_pys
in a new[protoc-python]
subsystem, along with a plugin field onprotobuf_library
calledgenerate_init_pys
. If true, this will generate the__init__.py
file automatically.The text was updated successfully, but these errors were encountered: