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

Allow protobuf_library targets to specify a python source root. #10549

Merged
merged 2 commits into from Aug 5, 2020

Conversation

benjyw
Copy link
Sponsor Contributor

@benjyw benjyw commented Aug 4, 2020

If specified, the sources will be generated under this
source root. This can allow users to sidestep issues around
namespace packages and/or __init__.py files.
E.g., if importing works correctly under src/python then
generating .py files under that root will allow them to be
imported, whereas generating them under src/protobuf
might require adding __init__.py files to get imports
to work.

[ci skip-rust]

[ci skip-build-wheels]

If specified, the sources will be generated under this
source root. This can allow users to sidestep issues around
namespace packages and/or __init__.py files.

[ci skip-rust]

[ci skip-build-wheels]
@coveralls
Copy link

coveralls commented Aug 4, 2020

Coverage Status

Coverage remained the same at 0.0% when pulling a7c33b4 on benjyw:protobuf_init_py2 into 4781aaa on pantsbuild:master.

Copy link
Contributor

@Eric-Arellano Eric-Arellano left a comment

Choose a reason for hiding this comment

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

Super cool!

@benjyw
Copy link
Sponsor Contributor Author

benjyw commented Aug 4, 2020

Added a test to assert that we can generate from a non-root source root (src/proto/protos/f.proto) to the root source root (protos/f_pb2.py).

# Rust tests and lints will be skipped. Delete if not intended.
[ci skip-rust]

# Building wheels and fs_util will be skipped. Delete if not intended.
[ci skip-build-wheels]
@benjyw benjyw merged commit 48d6cbf into pantsbuild:master Aug 5, 2020
@benjyw benjyw deleted the protobuf_init_py2 branch August 5, 2020 02:06
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.

None yet

3 participants