Hi all - I’m trying to see if there’s a way in pan...
# general
a
Hi all - I’m trying to see if there’s a way in pants to use a different interpreter constraint in pants based on the github runner python version matrix?
The problem is that if I have my python interpreter constraint set to something like >=3.8, pants chooses the first satisfiable component, but I really want it to be testing 3.10. Of course, if I try setting the constraint to 3.10, then I can’t run tests with 3.8.
Will I have to do something with environment variables here?
h
Yeah, you might want to set PANTS_PYTHON_INTERPRETER_CONSTRAINTS based on the matrix value
a
If I keep the interpreter_constraint in pants.toml will the env variable take precedence?
h
Yes, the order of precedence for every option is command line flag > env var > config
👍 1
b
hi @happy-kitchen-89482 apologies for jumping in on this thread. Perhaps I'm missing something, but this doesn't work as expected:
Copy code
PANTS_TAG="-mytag" pants --tag="mytag" test ::
according to the docs (and your post), I'd expect to invoke tests for all targets tagged with mytag. However I see no action (using pants v2.18.1), even though I get the expected tests by using either the env var or the tag. The same thing holds when setting the tag in
pants.toml
h
try
--tag="['mytag']"
, does that work?
tag
is a list-valued option, and scalar values across different sources (config, env vars and cmd-line args) get concatenated into a list. So in your example you end up with a value of "['-mytag', 'mytag']" and I guess the first one wins. Using a list literal as the value stomps the previous values instead of concatenating.
b
yes it does work, thanks for the explanation 🙇