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

nice-florist-55958

04/29/2022, 12:20 PM
Is there a direct way to get the list of external dependencies Pants will put in a
python_distribution
's auto-generated
setup.py
without packaging it and unzipping the sdist archive? Maybe some option on the
dependencies
goal I did not notice? We're starting to use IPython's Sphinx directive for a lot more projects, but the virtual environment that needs to be made for this purpose now depends on the project itself.
👀 1
c

curved-television-6568

04/29/2022, 12:36 PM
Possibly not the most pretty or efficient way, but seems to work, for me at least:
Copy code
$ ./pants --no-pantsd dependencies --transitive <target> | xargs ./pants --no-pantsd filter --target-type=python_requirement | xargs ./pants --no-pantsd peek | jq -r '.[]|.requirements[]'
backoff~=1.10.0
blinker<2.0.0,>=1.4
cachetools<5.0.0,>=4.2.2
flasgger<0.10.0,>=0.9.5
flask<3.0.0,>=2.0.2
flask-cors<4.0.0,>=3.0.10
...
😮 1
😩 1
n

nice-florist-55958

04/29/2022, 1:42 PM
Just tried this out. I get quite a different set compared to what's in setup.py. One is obvious, first-party distributions are included by setup.py but not this cmd (tried adding python_distribution to target-type filter, but no luck). Another is semi-obvious: transitive dependencies; setup.py doesn't include these (pip would resolve them), but when I remove this, I get almost no third party requirements back from the cmd (only the ones I explicitly declare in the BUILD file).
c

curved-television-6568

04/29/2022, 1:44 PM
Right. Not ideal, then. I’ll hope for the experts to come up with a better answer for you. Do note that most of the maintainers or currently visiting PyCon, so response times may be slightly longer than usual.
👍 1
n

nice-florist-55958

07/13/2022, 1:54 PM
Bump. To clarify, is there a way to get a list of both first and thirdparty direct (non-transitive) dependencies? (The "firstparty" dependencies are external dependencies too from the published distribution's point of view). The above attempt returns transitive dependencies for thirdparty only, and nothing when attempting to modify for direct.
4 Views