cool-easter-32542
05/29/2023, 8:55 AM__defaults__(
{
python_source: dict(resolve=parametrize("cpu", "gpu", "reqs")),
python_sources: dict(resolve=parametrize("cpu", "gpu", "reqs")),
pex_binary: dict(resolve=parametrize("cpu", "gpu", "reqs")),
}
)
However; parametrizing protobuf_sources.python_resolve here fails with the following error:
pants/src/python/pants/engine/internals/graph.py
Lines 437 to 441 in </pantsbuild/pants/commit/a34feabef5400eb52472c34900ed39438dfa1d55|a34feab>
Then; I tried to simply generate all the variants in a loop:
for resolve in ['reqs', 'cpu', 'gpu']:
protobuf_sources(
name=f'proto_{resolve}',
python_resolve=resolve,
...,
)
However; we have two files in our set: foo_v2, which imports foo_v1. Thus, this approach to ambiguity of which foo_v1.proto it would be importing.
Thus, I had to expand to two protobuf_source statements with explicit dependencies:
for resolve in ['reqs', 'cpu', 'gpu']:
protobuf_source(
name=f"foo_v1_{resolve}",
source="foo_v1.proto",
grpc=True,
python_resolve=resolve,
)
protobuf_source(
name=f"foo_v2_{resolve}",
source="foo_v2.proto",
grpc=True,
python_resolve=resolve,
dependencies=[f":foo_v1_{resolve}"],
)
Pants version
Stable, 2.15.0
OS
Linux
Additional info
Will try to isolate a repro soon!
pantsbuild/pants