Hi, does the native options parser handle intentio...
# general
s
Hi, does the native options parser handle intentionally drop support for list manipulations? If so, should the docs be updated? For example, using the
+/-
symbols or using
[..]
to overwrite previous value. pants.toml:
Copy code
[GLOBAL]
tag = ["-integration_test"]
command (I've tried nearly every quote/bracket/+ combination):
Copy code
pants test :: --tag='["integration_test"]'
Warning with pants 2.22:
Copy code
- Value mismatch for the option `tag`:
    Legacy value: ['integration_test'] of type <class 'list'>, from source FLAG
    Native value: ['-integration_test'] of type <class 'list'>, from source CONFIG
h
No, that should work, it’s a bug if it doesn’t.
f
Shouldn't the
-
be outside of the quotes?
h
Although I think the
-
should go outside the brackets?
Copy code
tag = '-["integration_test"]'
s
in pants.toml?
f
yes, the value in the pants.toml should be a string (and not a list) if you want to use the list editing
setting it to a list will just overwrite and not edit
s
Hmm, I don't think thats working either. It might resolve the list manipulation error, but now doesn't behave as expected.
Copy code
# pants.toml
# disable these type of tests by default locally
tag = '-[ "integration_test" ]'
And inspecting my file just to be sure:
Copy code
➜  pants peek file_test.py | jq '.[0].tags'
[
  "integration_test"
]
Running pants still calls that test by default:
Copy code
➜  pants test file_test.py                 
15:38:16.06 [INFO] Completed: Run Pytest - file_test.py:tests - succeeded.

✓ file_test.py:tests succeeded in 10.37s (cached locally).
Where the expected result (and what I get with
tag=["-integration_test"]
is this:
Copy code
➜  pants test file_test.py
15:39:53.19 [WARN] No files or targets specified. The `test` goal works with these target types...
f
If you run
pants help global
, what does Pants output for the default and current values of the
tag
config?
(The help system helpfully outputs the resolved default and current values besides documenting the options.)
s
(woah, didn't know that! nice)
With this pants.toml:
tag = '-["integration_test"]'
Copy code
tag
      default: []
      current value: [] (from pants.toml)
f
hmm,
tag = '-["integration_test"]'
should mean remove any entry with the content
integration_test
from the config
s
As opposed to what I've been using until now:
tag = ["-integration_test"]
Copy code
tag
      default: []
      current value: [
          "-integration_test"
      ] (from pants.toml)
f
ah yeah, with the content
"-integration_test"
then that means to exclude targets with that tag
two different semantic meanings of
-
going on here
1
s
So with the latter syntax, how do I override that when I want to include those targets
f
then I suppose you could combine both meanings:
--tag='-["-integration_test"]'
👀 1
s
Haha yea that seems to work?
Copy code
➜  pants help global
  tag
      default: []
      current value: [
          "-integration_test"
      ] (from pants.toml)

➜  pants --tag='-["-integration_test"]' help global
  tag
      default: []
      current value: [] (from pants.toml, from command-line flag)
Great, thank you
I might just override the whole list at this point to avoid double negative confusions. But this is good to know
👍 1
f
And I don't think Pants is smart enough to handle both
integration_test
and
-integration-test
being present in the
tag
config
1