When I run the dependencies goal (or any goal for ...
# general
p
When I run the dependencies goal (or any goal for that matter), is there a way to only have it look at a specific target type ? i.e. I am running
./pants dependencies --dependencies-transitive --dependencies-type=3rdparty src/python/something/something::
and I want it to only look at
python_library
and ignore
python_tests
w
need to use a separate goal to do that…
filter
so
./pants filter --target-type=.. src/python/something/something:: > filtered.txt && ./pants --spec-file=filtered.txt dependencies ..
(checking syntax, but)
mm. it’s
filter --target-type
. but yea, other than that.
p
why this is a top level goal and not a global thing ? if we can filter targets by tag, why not by type ? is there a reason or just a missing feature ?
w
good question. i think because it’s unclear which direction we should head in there… filter contains a few more obscure options, so it’s unclear whether they should all be global
…there was another discussion somewhere recently. can’t find it.
@hundreds-father-404: i’m not sure where we had the discussion about allowing for different
--dependees
values per goal, but could probably move filter there too…
h
Generally I think the best solution is a general purpose
--query
in the meantime, https://pants.readme.io/docs/advanced-target-selection#piping-to-other-pants-runs shows how to pipe between runs you’d want to first do
dependees
, then pipe to a run that does
filter --target-type
w
possibly, yea. the connection here might be that if
query
(or whatever we call it… maybe
filter
with an option
--query
) were a scoped subsystem, you could do
./pants lint --filter-query=.. typecheck --filter-query=..
… and have different queries per goal
yea.
really hacking the existing infrastructure a bit, you could name a root selection Subsystem “`on`” or “`for`”…
./pants lint --for-query=.. typecheck --for-tag=..
cc @happy-kitchen-89482: ^
because it would be a scoped subsystem, each “query”/tag/type/etc would compute the roots for each goal… if you moved it to the left, it would apply to all goals:
./pants --for-query=.. lint typecheck
and then move ~all of the filtering/root-selection options there
pretty excited about this idea actually… will write up a one pager on it.
j
The way the
aws
CLI does this is with a
--query
and a specialized JMSEPath query (which I always have to look up how to use, but isn't unbearable). https://docs.aws.amazon.com/cli/latest/reference/
w
mm, thanks!
i ended up writing up https://docs.google.com/document/d/10F8bi-Es2CjfpvZcxNH-3xb0vPhlq3cQljNHmdI-zNg/edit# … query is probably still in the future, but in the meantime, i think that we can take steps towards centralizing and making more general