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

Proto resolution mess up #21173

Open
leozc opened this issue Jul 15, 2024 · 4 comments
Open

Proto resolution mess up #21173

leozc opened this issue Jul 15, 2024 · 4 comments
Labels

Comments

@leozc
Copy link

leozc commented Jul 15, 2024

Describe the bug
A python protobuf_sources dependency is checked, and reported error by JVM

pants check src/jvm::
07:44:27.11 [ERROR] 1 Exception encountered:

Engine traceback:
  in `check` goal

InvalidTargetException: src/proto/events/BUILD:1: Unrecognized field `python_resolve=python-ds` in target src/proto/events:events. Valid fields for the target type `protobuf_sources`: ['dependencies', 'description', 'go_mod_address', 'grpc', 'jvm_jdk', 'jvm_resolve', 'overrides', 'sources', 'tags'].

Pants version
https://github.com/leozc/test_pants_proto/blob/main/README.md

OS
MacOs, Apple Silicon

Additional info
https://github.com/leozc/test_pants_proto/blob/main/README.md

@leozc leozc added the bug label Jul 15, 2024
@benjyw
Copy link
Contributor

benjyw commented Jul 15, 2024

This is because the Python protobuf plugin is inferring a dependency from the protobuf_sources target to the protobuf distribution, and then the Java backend is trying to build a classpath entry out of this, and obviously cannot.

As a workaround you can turn the dep inference off with

[python-protobuf]
infer_runtime_dependency = false

in pants.toml. But then your Python side may not work, and you'll have to manually add back that dep from the relevant python_sources so it gets pulled in. Again, this is just a workaround until I figure out something more robust.

@benjyw
Copy link
Contributor

benjyw commented Jul 15, 2024

@leozc can you add some python code that uses the python-generated protobuf code (generated from the same Event.proto) to the example repo? I'd like to see more closely how those interact.

@leozc
Copy link
Author

leozc commented Jul 16, 2024

will do

@benjyw
Copy link
Contributor

benjyw commented Jul 20, 2024

@leozc best to @ me here and/or on Slack when this is ready, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants