lemon-oxygen-72498
12/08/2022, 3:16 PMinterpreter_constraints
on python_distribution
? Globally I have interpreter_constraints = ["==3.8.*", "==3.9.*"]
which pants refuse when `package`ing:
SetupPyError: Expected a single interpreter constraint for libs/image_augmentation:kaiko-image-augmentation-dist, got: CPython==3.8.* OR CPython==3.9.*.
Makes sense, so setting this defaults
in the top-level build file:
__defaults__(
{
python_distribution: dict(interpreter_constraints=["==3.8.*"]),
}
)
I obtain SetupPyError: Expected a single interpreter constraint for libs/image_ml:kaiko-image-ml-dist, got: CPython==3.8.* OR CPython==3.8.*,==3.9.*.
which looks weird to me, because it means the two fields are ORed, whereas I'm expecting __defaults__
to override the value.
At this point there's a nice hint saying to translate the conjunction using exclusions, so I changed the _defaults_
above to !=3.9.*
. Then it fails with:
Expected a single interpreter constraint for libs/image_augmentation:kaiko-image-augmentation-dist, got: CPython!=3.9.*,==3.8.* OR CPython!=3.9.*,==3.9.*.
which looks like I'm almost there if pants was trimming unsatisfiable disjunctions 😉
What else can I do 🙏 ?wide-midnight-78598
12/08/2022, 3:22 PM["CPython>=3.8,<3.10]"
work?lemon-oxygen-72498
12/08/2022, 3:31 PM["CPython>=3.8,<3.10]"
and ["==3.8.*", "==3.9.*"]
are semantically equivalent..
But that's a whole different story without an arithmetic solver under the hood 😞lemon-oxygen-72498
12/08/2022, 3:38 PMwide-midnight-78598
12/08/2022, 3:42 PMenough-analyst-54434
12/08/2022, 3:52 PMenough-analyst-54434
12/08/2022, 3:53 PMlemon-oxygen-72498
12/08/2022, 3:54 PMlemon-oxygen-72498
12/08/2022, 3:55 PMenough-analyst-54434
12/08/2022, 3:57 PMlemon-oxygen-72498
12/08/2022, 4:11 PMlemon-oxygen-72498
12/08/2022, 4:11 PMlemon-oxygen-72498
12/08/2022, 4:12 PMcurved-television-6568
12/08/2022, 6:56 PMwhereas I’m expectingI’m not sure about what’s going on, only thatto override the value.__defaults__
__defaults__
as such does override the value on python_distribution
(try to verify what you get if you set the value explicitly on the target, I would expect the same outcome)
Is it not that you have interpreter constraints from your global config on the python_sources
targets, and then the ICs from defaults on the python_distribution
targets, and the interplay is how Pants treats them when they’re not aligned..?lemon-oxygen-72498
12/09/2022, 8:43 AMtry to verify what you get if you set the value explicitly on the target, I would expect the same outcomeYes I had tried it and indeed I had the same outcome 👍
then the ICs from defaults on theYes this is also my understanding in the end. The "bug" is that pants doesn't reduce the interpreter constraints as much as I expected it would, yielding a disjunction of two constraints, whereas it could yield a single constraint.targets, and the interplay is how Pants treats them when they’re not aligned..?python_distribution