quaint-telephone-89068
03/01/2023, 9:13 PMinterpreter_constraints = ["CPython==3.8.*", "CPython==3.9.*"]. However, it seems like this is (strongly) not recommended, and leads to strange behaviour, and a lot of questions in Slack:
1. https://pantsbuild.slack.com/archives/C046T6T9U/p1677698844617669
2. https://pantsbuild.slack.com/archives/C046T6T9U/p1668095636694669?thread_ts=1668089867.223149&cid=C046T6T9U (particularly subtle issues around appending to the ICs list implicitly!)
3. https://pantsbuild.slack.com/archives/C046T6T9U/p1670512567148199
Background from @enough-analyst-54434 in that last thread:
the affordance for OR was added purely for Twitter internal needs back in the Pants v1 days. They never actually needed the feature and could've spelled what they needed with a range + ,!=X,!=Y,etc. Unfortunately that is still lying around and is really legacy. Although this is certainly a bug, be warned - best to stay away from use of the OR facility. It is non-standard in the Python world and non-standard will always get you in the end.For instance: •
interpreter_constraints = ["CPython==3.8.*", "CPython==3.9.*"] should be something like interpreter_constraints = ["CPython==3.8.*,==3.9.*"]
• interpreter_constraints = ["CPython==2.7.*", "CPython>=3.7.*"] should be something like interpreter_constraints = [">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*"]
Describe the solution you'd like
It seems like the situation could be improved by deprecating setting interpreter_constraints to a list with more than one element (and/or not deprecate it, but require opt-in like allow_non_pypa_multiple_interpreter_constaints = true or similar), with a warning that suggests how using a single constraint (with exclusions, if required) is better.
Preferably, Pants could move towards having interpreter_constraints be just a plain string interpreter_contraints = "CPython==...,==..." to set the appropriate single IC directly (without the implicit appending that caused the confusion in thread 2 above).
Describe alternatives you've considered
🤷♂️
Additional context
N/A
pantsbuild/pants