rough-vase-83553
09/30/2022, 2:16 PMpython_requirements. I'm aware that you can create an arbitrarily large lockfile without having to worry about everything in the lockfile getting dragged in to each Python target. But do you have to also create separate python_requirements for each binary / library if you want to restrict the number of dependencies they pull in? Or can Pants still resolve which ones to pull in via import statements?enough-analyst-54434
09/30/2022, 2:24 PMpython_dependencies do you mean python_sources.dependencies ? Perhaps you mean python_requirements? Either way, when building a venv / Pex for a given target, Pants will always only include the subset of deps it (transitively) needs. That information will come from a combination of dependency inference (analyzing imports as you guessed) and explicit dependecies lists on various `python_X`targets that need coaching.rough-vase-83553
09/30/2022, 2:25 PMpython_requirementsenough-analyst-54434
09/30/2022, 2:25 PMrough-vase-83553
09/30/2022, 2:27 PMpython_requirements and apply it to everything in a directory tree, will every target in the directory tree pull in boto3 even if they don't really need it?rough-vase-83553
09/30/2022, 2:31 PMpython_requirements at and expect Pants to resolve deps intelligently?enough-analyst-54434
09/30/2022, 2:36 PMdependecies list additions. In either case, if neither a file or target (or its transitive dependencies) import boto3, then it will not get a dep on boto3 and, as a result, it will not get boto3 included in its venv / PEX.enough-analyst-54434
09/30/2022, 2:37 PMpython_requirements should include all direct dependencies of all code in your repo.enough-analyst-54434
09/30/2022, 2:38 PMrough-vase-83553
09/30/2022, 2:39 PMpython_requirements applies to a project directory if not for sources.dependencies ? I think I've been putting python_requirements in the sources.dependencies for everything to avoid ambiguity since we have some lingering requirements files that are getting turned into python_requirements by tailorrough-vase-83553
09/30/2022, 2:39 PMenough-analyst-54434
09/30/2022, 2:40 PMenough-analyst-54434
09/30/2022, 2:42 PMpython_requirements targets you're likely in multiple resolve territory unless I'm not seeing some alternate setup. Do you have 1 lock file per requirements file right now?enough-analyst-54434
09/30/2022, 2:44 PMrough-vase-83553
09/30/2022, 4:29 PMpython_requirements for these lingering requirement files or manually remove them.rough-vase-83553
09/30/2022, 4:30 PMhundreds-father-404
09/30/2022, 4:31 PMto have requirements specifiable at the Python target level?They can be, via manually creating
python_requirement targets. python_requirements is a "target generator" that creates one python_requirement target for you: it solely exists for boilerplate reductionrough-vase-83553
09/30/2022, 4:32 PMpython_library target in the subdirectory, every python_library associated with the same resolve?hundreds-father-404
09/30/2022, 4:35 PMpython_requirement targets your code can use. Usually, your code uses a subset of those, which Pants figures out via dependency inference + your explicit deps
Those python_requirement targets are defined by you, and you can use target generators like python_requirements for less boilerplate
If you are using "multiple resolves" (aka lockfiles), you may have multiple "universes". Each "universe" is self-contained, and code can only choose exactly one resolve/universerough-vase-83553
09/30/2022, 4:47 PM