<@U06A03HV1> should we be applying something like...
# development
h
@witty-crayon-22786 should we be applying something like https://github.com/pantsbuild/pants/pull/14788 to command line specs?
i used this diff
Copy code
diff --git a/src/python/pants/util/BUILD b/src/python/pants/util/BUILD
index 76d0a50a8..660377f23 100644
--- a/src/python/pants/util/BUILD
+++ b/src/python/pants/util/BUILD
@@ -3,4 +3,7 @@
 
 python_sources()
 
-python_tests(name="tests")
+python_tests(
+    name="tests",
+    interpreter_constraints=parametrize(py39=["==3.9.*"], py310=[">=3.9"]),
+)
./pants test src/python/pants/util:tests
fails and suggest instead
src/python/pants/util:tests@interpreter_constraints=py39
and
src/python/pants/util:tests@interpreter_constraints=py310
That is surprising to me. It is a moved field, so I would expect only the original target generator to exist
(lol this interaction is so confusing)
w
each of
src/python/pants/util:tests@interpreter_constraints=py39
and
src/python/pants/util:tests@interpreter_constraints=py310
… are target generators, yea. they depend on the files that they generated
h
So, the dependencies field should be able to reference either of those target generators as a alias for each generated target. Or, thanks to your PR, we also have an affordance that you can use the original target generator without parameters
w
but… yes. it might make sense to have CLI specs expand to all matching parametrized targets. https://github.com/pantsbuild/pants/pull/14788 expanded to exactly one.
👍 1
h
I think that it would remove some confusion
My vague understanding is that we are giving you several degrees of specificity
1) everything 2) everything for a particular param 3) one generated target
w
My vague understanding is that we are giving you several degrees of specificity
on the CLI, yea… the affordance in BUILD files still resolves to exactly one matching target.
👍 2
h
It would help me with the update I am doing to the docs on parameterization. I would like to be able to claim that you can generally refer to the original target, and things will still work just be less precise
w
i’ll create a ticket.
❤️ 1
h
ah yeah cool, this applies to atom targets too:
Copy code
diff --git a/src/python/pants/util/BUILD b/src/python/pants/util/BUILD
index 76d0a50a8..091736175 100644
--- a/src/python/pants/util/BUILD
+++ b/src/python/pants/util/BUILD
@@ -3,4 +3,8 @@
 
 python_sources()
 
-python_tests(name="tests")
+python_test(
+    name="test",
+    source="strutil_test.py",
+    interpreter_constraints=parametrize(py39=["==3.9.*"], py310=[">=3.9"]),
+)
Copy code
$ ./pants test src/python/pants/util:test
The address `src/python/pants/util:test` was not generated by the target `src/python/pants/util:test`, which only generated these addresses:

  * src/python/pants/util:test@interpreter_constraints=py39
  * src/python/pants/util:test@interpreter_constraints=py310
w
h
OK, parameterization section is rewritten. Feedback welcomed https://www.pantsbuild.org/v2.11/docs/targets#parametrizing-targets
I am still trying to figure out what to do with the warning box I updated the warning box too herehttps://www.pantsbuild.org/v2.11/docs/targets#source-and-sources-field
I think that I'm not going to touch the overrides field in docs... too niche and confusing
w
looks great. i’ll break out a tiny section to clarify the
```Generally, you can still use
example:tests
without the
@
suffix as an alias to all the
created targets.```
bit
🙌 1