Is there an easy way to find all the libraries we ...
# general
p
Is there an easy way to find all the libraries we depend on in first party code? I am moving from pipenv_requirements to python_requirements and it seems like we depend on a lot of transitive dependencies that we didn't directly reference in our Pipfile
n
we use this to generate a requirements.txt file. but we are using an older version of pants (2.15.0) so it may not work on latest version. also this probably won't give you transitive deps, since that probably cannot be known until actually installing the first level deps.
Copy code
./pants peek 3rdparty:: | jq -r ".[].requirements | select( . != null ) | flatten[]" | sort -f | uniq > requirements.txt
p
Thanks for the code; I tried porting this directly to our setup but sort of ended up with the other extreme (all transitive deps), but this got me to thinking of just pulling all the direct deps and their requirements, and that seems to be what I want:
Copy code
pants peek --filter-target-type=python_source,python_test,pex_binary :: | jq -r '.[].dependencies | flatten[] | select( startswith("//:root") )' | sort -f | uniq | xargs pants peek | jq -r ".[].requirements | select( . != null ) | flatten[]" | sort -f | uniq > requirements.txt