polite-nail-30687
06/12/2024, 9:10 PMprotobuf_sources(
**parametrize("py39", python_interpreter_constraints=[">=3.9.15","<3.10"], python_resolve="default"),
**parametrize("py310", python_interpreter_constraints=["==3.10.*"], python_resolve="other"),
)
I get this error when i run export-codegen
22:04:43.84 [ERROR] 1 Exception encountered:
Engine traceback:
in `export-codegen` goal
ProcessExecutionFailure: Process 'Generating Go sources from path/to/proto@parametrize=py39.' failed with exit code 1.
stdout:
stderr:
path/to/proto/a.proto: File not found.
path/to/proto/b.proto:6:1: Import "path/to/proto/a.proto" was not found or had errors
Use `--keep-sandboxes=on_failure` to preserve the process chroot for inspection.
The folder has a BUILD.pants
and a number of protos that import from each other, worked before adding parametrize.curved-television-6568
06/13/2024, 8:11 AMpolite-nail-30687
06/17/2024, 3:44 PMpolite-nail-30687
07/15/2024, 3:59 PMcurved-television-6568
07/15/2024, 8:30 PM220835.45 [WARN] The target src/protos/test.proto@parametrize=py39 importsin the file src/protos/test.proto, but Pants cannot safely infer a dependency because more than one target owns this file, so it is ambiguous which to use: ['src/protos/testtwo.proto@parametrize=py310', 'src/protos/testtwo.proto@parametrize=py39'].protos/testtwo.proto
Please explicitly include the dependency you want in thefield of src/protos/test.proto@parametrize=py39, or ignore the ones you do not want by prefixing withdependencies
or!
so that one or no targets are left.!!
Alternatively, you can remove the ambiguity by deleting/changing some of the targets so that only 1 target owns this file. Refer to https://www.pantsbuild.org/2.21/docs/using-pants/troubleshooting-common-issues#import-errors-and-missing-dependencies.Huh. Seems dep inference doesn't handle this situation very well, as indicated by the warning message. I explicitly added the dependency and then the export worked. Def worth filing an issue for, you have the great repro case to go with it š
⯠git diff
diff --git a/src/protos/BUILD.pants b/src/protos/BUILD.pants
index 01ca744..580fe83 100644
--- a/src/protos/BUILD.pants
+++ b/src/protos/BUILD.pants
@@ -1,4 +1,9 @@
protobuf_sources(
+ overrides={
+ 'test.proto': dict(
+ dependencies=['src/protos/testtwo.proto'],
+ ),
+ },
**parametrize("py39", python_interpreter_constraints=[">=3.9.15","<3.10"]),
- **parametrize("py310", python_interpreter_constraints=["==3.10.*"]),
+ **parametrize("py310", python_interpreter_constraints=["==3.10.*"], python_resolve="object_detection"),
)
(I had thrown in the resolve there for good measure, but not sure if it was the right thing to do, nor needed..)
⯠tree dist
dist
āāā codegen
āāā src
āāā protos
āāā test.pb.go
āāā test_pb2.py
āāā test_pb2.pyi
āāā testtwo.pb.go
āāā testtwo_pb2.py
āāā testtwo_pb2.pyi
4 directories, 6 files
bland-cricket-38384
09/02/2024, 6:46 PMpython_resolve
field that's parameterized. If I explicitly include the generic proto dependency, it resolves everything fine.
But this isn't a great solution for me as we have so many proto files interconnecting. It's annoying to manually handle all the dependencies.