some-restaurant-1855
07/16/2024, 12:36 AMpex_binary
target.
at the highest level, i'm exploring solutions for dealing with torch
for multiple platforms + gpu or non-gpu setups (yet again) .
i've defined a few grouped parametrization targets for the three resolves/lockfiles i want to respect python_linux, python_linux_cuda, python_darwin
in my repo defaults for python sources /tests, have an explicit torch python_requirement
(:torch_manual
) with the same parametrization, and an override on torch
from my main 3rdparty/python/BUILD
python_requirements
generator (which is also parametrized the same way).
basically, the pex_binary
target i use in the project, which requires torch in the underlying python_sources
, identifies the 3rdparty:torch@parametrize=python_linux_cuda
requirement as a dep even though it shouldn't be there and my python_sources
target doesn't include it as one (via peek
and dependencies/dependents
querying.
i have a [gist](https://gist.github.com/binaryaaron/cf5638fcdde79b2537a6716ebd1e529f) with the pertinent files - the 3rdparty build file, project build, pants.toml, and root build file, and outputs showing the issues.
anyone familiar with parametrize
able to look?curved-television-6568
07/16/2024, 4:07 PMsome-restaurant-1855
07/16/2024, 5:34 PMpex_binary
- how would you let pants infer the required deps without specifying them explicitly?some-restaurant-1855
07/16/2024, 5:35 PMparametrize
groups / deps in cases like thissome-restaurant-1855
07/16/2024, 5:49 PMparametrize=X
would 'match' other parametrize=X
targets.
in my head, i sorta assumed the group name would "match" correctly - is the pex_binary
requirements target something that could support parametrization like i'm sorta assuming it could?
as a bit of an aside, would it be nuts to think about specifying the parametrize groups more like the following?
user defines the 'common' parametrize groups somewhere, e.g. a build file like:
parametrize_group(name="A", <options> )
parametrize_group(name="B", <options> )
parametrize_group(name="C", <options> )
parametrize_groups(dependencies = [":A", ":B", ":C"]
and when you add a group to a target, any group that matches one of the A, B, C
groups will use the 'global' group name more directly with args that overwrite what you might have defined in the hypothetical parametrize_group
target? e.g., still use
pex_binary(...,
**parametrize("A", **kargs), **parametrize("B", **kwargs)
)
and if the arg A
matches one of the above groups it'll ... just work? 😅
i imagine that'd be a reasonable amount of work to do, just curious