curved-manchester-66006
01/04/2023, 4:59 AMfoo
, or python3.10 and resolver bar
. (Said resolvers already have [python.resolves_to_interpreter_constraints]
)I then have a set of tests I want to parameterize to verify both cases actually work. In other words I want to run with (resolve=foo, interpreter_constraints=python3.7) and (resolve=bar, interpreter_constraints=python3.10) but not (foo && python3.10) or (bar && python3.7). I tired to do something like:
__defaults__(all=dict(
resolve=parametrize("foo", "bar"),
interpreter_constraints=parametrize(py3_7=["CPython>=3.7.1,<3.8"], py3_10=["CPython==3.10.*"])
But that generates the full matrix and pants yells with a InvalidFieldException
about interpreter_constraints
subsets. Is there a way to pair the parametrize or otherwise generate less than the full set of permutations?
I read https://github.com/pantsbuild/pants/issues/14863 and https://pantsbuild.slack.com/archives/C046T6T9U/p1671723858955379 and I'm not sure if I should take the current state of constraints+resolves as "confusing but works" or "can't do what I want yet"
(Thank you everyone for answering so many questions!)def python_mwaa_and_py310_sources(**kwargs):
kwargs.pop("interpreter_constraints", None)
kwargs.pop("resolve", None)
name = kwargs.pop("name", '')
if name:
name = name + '_'
python_sources(
name=f"{name}mwaa",
resolve="mwaa_pyop",
interpreter_constraints=["CPython>=3.7.1,<3.8"],
**kwargs,
)
python_sources(
name=f"{name}py310",
resolve="default",
interpreter_constraints=["CPython==3.10.*"],
**kwargs,
)