https://pantsbuild.org/ logo
#plugins
Title
# plugins
c

cold-mechanic-10814

04/16/2023, 6:15 PM
Hi, I'm trying to understand how I can query a lockfile for the exact versions of the transitive requirements of a 3rd party package. For example, say I have a requirements.txt that contains:
Copy code
simplejson>=3.11.1
pyyaml~=6.0.0
flytekit~=1.5.0
coverage>=7.1.0
mock>=5.0.1
pytest==7.0.1
pydantic==1.10.7
And I've generated a lockfile from this. How can I query the lockfile for the subset of exact requirements needed for
pydantic
? Looking around seeing how PEX files are built, it seems as if
PexRequirements
is the right "request", but I can't figure out which rule will give me the complete closure of the subset of dependencies. Ultimately I want to implement a custom packageable target that will generate a
requirements.txt
with the exact versions per the lockfile.
Copy code
my_custom_requirements_txt(
   resolve="python-default",
   roots=["pydantic"]
)