dazzling-elephant-33766
07/25/2024, 10:26 AMnumpy
) being included in my final pex_binary
that isn’t listed in my targets dependencies
$ pants --no-pantsd dependencies --transitive services/launch_dashboard:gunicorn
But is included in the final build
$ pants --no-pantsd repl services/launch_dashboard:gunicorn
>>> import numpy
>>> ???
More evidence
$ pants package services/launch_dashboard:gunicorn
unzip -l dist/services.launch_dashboard/gunicorn.pex | grep numpy -c
991
Doing a pants dependents //:root#numpy
shows a few dependees of numpy
, but none of these are consumed by the target I’m building
$ pants dependents //:root#numpy
//:root
multiply/advice/simulators/premiums/premiums.py
multiply/advice/tests/helpers.py
multiply/advice_launch/pension/annuity.py
Any ideas/tips for how I can dig a little deeper to determine why this dep is being included?fast-nail-55400
07/25/2024, 2:06 PMpants paths
to see the dependency path between the pex_binary
and the numpy
requirement? Try pants paths --from=services/launch_dashboard:gunicorn --to=//:root#numpy
broad-processor-92400
07/25/2024, 10:44 PM--transitive
flag is handy, e.g. pants dependents --transitive //:root#numpy
But... if numpy is only pulled in as a transitive dependency of a third party package (rather than your own code), this isn't currently visible to pants' introspection goals: https://github.com/pantsbuild/pants/issues/12733
If that's the case, you might have to do something like pants dependencies --transitive services/launch_dashboard:gunicorn | grep '//:root#'
to find the direct third-party deps and then work out which of those includes numpydazzling-elephant-33766
07/26/2024, 9:49 AMpip show <dep>
It’s a dependency of a dependency of a dependency.
Thanks both for the help.