https://pantsbuild.org/ logo
#general
Title
# general
f

flaky-artist-57016

01/16/2023, 7:14 PM
We have a Python repo that uses a
conda
environment. This means we have to add
python_requirement
entries for all third-party dependencies used by goals like
test
and
package
to our root
BUILD
file or
python_infer
throws
UnownedDependencyError
. I’d like to run
./pants dependencies
on our tests to check that Pants can infer all the third-party dependencies successfully. What is the best way to do this?
e

enough-analyst-54434

01/16/2023, 7:16 PM
There is none that I'm aware of better than your process. We've had no conda user yet to my knowledge contribute in any significant way to Pants and none of the existing contributors have meaningful conda experience.
Perhaps you could dive in? We always welcome help and will guide.
f

flaky-artist-57016

01/16/2023, 7:19 PM
Gotcha. I’ve chimed in on the GitHub discussion about
conda
. I can try to dig into
conda
integration when I find some time. In the meantime, is there a way to tell
./pants dependencies
to only run on tests and imported modules? I thought about adding
tags=["tests"]
to
python_sources
in test directories, but my understanding is that this will only check dependencies for ancillary Python files in those directories. Is it possible to pass
python_tests
as a target?
e

enough-analyst-54434

01/16/2023, 7:20 PM
See
./pants help filter
You can always mix in
./pants --filter-xxx=yyy <goal>
🙌 1
f

flaky-artist-57016

01/16/2023, 7:20 PM
Thanks, will do!
e

enough-analyst-54434

01/16/2023, 7:20 PM
Maybe a lie, but the option exists. There is fuzziness in my head about when it applies / pre vs post.
But the big hammer is
./pants peek
and
jq
f

flaky-artist-57016

01/16/2023, 7:22 PM
Looks like
--filter-target-type
does the trick.
5 Views