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

rapid-bird-79300

02/23/2023, 5:10 PM
Hey Team, really noob question but how would one request
Dependencies
like this
./pants dependencies app/something/::
in a Pants plugin? I have used Dependees (dependents) before like this
Copy code
dependents = await Get(
        Dependees,
        DependeesRequest(
            (t.address for t in req.targets),
            transitive=False,
            include_roots=False,
        ),
    )
but I'm not sure rule similar rule exists for
Dependencies
?
Also I have done this before
Copy code
parsed_dependencies = await Get(
        ParsedPythonDependencies,
        ParsePythonDependenciesRequest(
            request.source.get(PythonSourceField),
            InterpreterConstraints(("==3.9.5",)),
            string_imports=False,
            string_imports_min_dots=2,
            assets=False,
            assets_min_slashes=0,
        ),
    )
but was thinking of a more generic rule that just take addresses and returns all dependencies
w

witty-crayon-22786

02/23/2023, 5:17 PM
DependenciesRequest
exists, but it’s for a single target
if you want to do something for all of the targets in a directory, you’d want to match a
Spec
first to match all of the targets in the directory
👍 1
r

rapid-bird-79300

02/23/2023, 5:18 PM
once we have the spec just
MultiGet
for each
FilteredTarget
?
w

witty-crayon-22786

02/23/2023, 5:19 PM
looking for an example
r

rapid-bird-79300

02/23/2023, 5:23 PM
that is dead simple thank you for sharing these examples. I will give it go on my end
4 Views