proud-dentist-22844
12/22/2022, 3:44 PMinterpreter_constraints
. The key piece I'm questioning is in this BUILD file:
https://github.com/StackStorm/st2/pull/5850/files#diff-a1de578ad6ec792e46e84af2ab04188980ed060c25f673c018cf0cf4bd142d93
I had interpreter constraints in pants.toml
for the pants-plugins
resolve without applying them here. I assumed that the [python.resolves_to_interpreter_constraints].pants-plugins
would automatically be applied to anything that used that resolve. But, the default comes from [python].interpreter_constraints
instead, which is not compatible with that resolve.
Was my assumption off base? Why do I need to duplicate the constraints in both places? Could we change how default interpreter_constraints
get calculated so it uses [python.resolves_to_interpreter_constraints].<resolve>
first before falling back to [python].interpreter_constraints
? Is there a feature here that I'm misunderstanding?hundreds-father-404
12/22/2022, 3:46 PMproud-dentist-22844
12/22/2022, 4:04 PM==3.6.*
and ==3.8.*
) but that messed up building one wheel for all of those. So I switched to >=3.6,<3.9
. the pants-plugins resolve is the exception - I don't care much about the constraints for it, I just want it compatible with pants.
(Aside: a shortcut constraints keyword similar to the pants_requirements
target that looks up its value based on the version of pants in pants.toml would be really nice. That would simplify the pants-plugins resolve config so I don't have to manually track what pants requires)
But, back to your point about testing multiple versions: we run tests (for code in our default resolve) on 3.6 and 3.8. It's not clear how I'll accomplish that (once pants can run our tests). For CI, I'm going to only install the target version of python and maybe manipulate the search paths to ensure the version of python I want is selected. On my local machine, that will be more awkward as I have installs of lots of different versions of python including every minor (not patch) version from 3.4 to 3.11 plus 2.7. So, a more standardized way to specify which interpreter(s) to use for tests would be excellent.curved-television-6568
12/22/2022, 4:34 PM[">=3.6,<3.9"]
, but if you want to test with multiple versions go with multiple ICs instead: ["==3.6.*", "==3.7.*", ">=3.8,<3.10", …]
enough-analyst-54434
12/22/2022, 4:39 PMtox -p -epy3{6,8,9}
behavior is probably best addressed 1st class comprehensively with fresh eyes.proud-dentist-22844
12/22/2022, 5:03 PMIf you just want a single run, use a single value: [">=3.6,<3.9"], but if you want to test with multiple versions go with multiple ICs instead: ["==3.6.*", "==3.7.*", ">=3.8,<3.10", …]
Yes. That doesn't work. I need my wheel to have one IC, but I want to test with multiple. So, would I have to parametrize all of my python_tests to use the list instead of the single constraint?
Could we change how defaultfor targets get calculated so it usesinterpreter_constraints
first before falling back to[python.resolves_to_interpreter_constraints].<resolve>
?[python].interpreter_constraints
hundreds-father-404
12/22/2022, 5:08 PMhappy-kitchen-89482
12/22/2022, 10:16 PMproud-dentist-22844
12/28/2022, 2:40 PMpants.toml
vs BUILD
. https://github.com/pantsbuild/pants/issues/16566#issuecomment-1366593885[python.resolves_to_interpreter_constraints]
---helps minimize config duplication, allowing me to not add ICs in BUILD
files.happy-kitchen-89482
12/28/2022, 5:04 PMproud-dentist-22844
12/28/2022, 5:48 PM[python].interpreter_constraints
and [python.resolves_to_interpreter_constraints]
from pants.toml
? And just collecting the relevant info from all the BUILD files? That could work too.__defaults__(all={"interpreter_constraings": ...})
instead of adding it to pants.toml
enough-analyst-54434
12/28/2022, 5:58 PMpex_binary
?proud-dentist-22844
12/28/2022, 5:58 PMpython_test*
and python_source*
and python_distribution
and friends support it.enough-analyst-54434
12/28/2022, 5:58 PMhundreds-father-404
12/28/2022, 6:01 PMproud-dentist-22844
12/28/2022, 6:03 PMenough-analyst-54434
12/28/2022, 6:03 PMproud-dentist-22844
12/28/2022, 6:04 PMenough-analyst-54434
12/28/2022, 6:04 PMproud-dentist-22844
12/28/2022, 6:08 PMWhy can't build metadata be in toml. Why two formats?Ah. true. The main pants config file could also be python-esque. TOML is a lot more restrictive, so I wouldn't want it in BUILD files where the expressive syntax of python is very useful. And having something with a more limited syntax, like toml, to define the version of pants to use is helpful because you can more easily scrape settings like that with bash+grep+etc.
happy-kitchen-89482
12/28/2022, 6:09 PMproud-dentist-22844
12/28/2022, 6:11 PMhappy-kitchen-89482
12/28/2022, 6:14 PM