astonishing-dentist-76763
02/25/2025, 9:20 AMsrc/AAA, depends on BBB, which is also hosted in the monorepo under src/BBB, is it possible to automatically generate both AAA.whl and BBB.whl without explicitly running pants package src/AAA src/BBB ?
My original guess was pants package src/AAA automatically generates dist/AAA.whl and dist/BBB.whl, but the command only generates AAA.whl .wide-midnight-78598
02/25/2025, 12:24 PMpants package ::
?
What's the problem you're trying to solve?astonishing-dentist-76763
02/25/2025, 1:43 PMpants package :: generates too many packages and PEX binaries (in my repo), which isn’t ideal for our workflow.
Our team frequently modifies internal packages in our monorepo, so we’ve been using shell scripts to clean and rebuild dependencies:
rm -rf dist
pants package src/AAA src/BBB
pip install dist/*.whl
However, this approach redundantly replicates Pants’ dependency resolution logic, which doesn’t seem optimal. While using PEX binaries can sometimes help, there are still cases where pip install is necessary.
Is there a better way to package (and install) only what’s needed while ensuring dependencies are built automatically?wide-midnight-78598
02/25/2025, 1:46 PMpants package ::
Is there a fixed set of packages you want built? Could you use a CLI alias to shorten it?wide-midnight-78598
02/25/2025, 1:48 PMpants --filter-target-type=... package src/:: kinda thingsquare-elephant-85438
02/25/2025, 3:49 PMsquare-elephant-85438
02/25/2025, 6:47 PMastonishing-dentist-76763
02/26/2025, 7:59 AMsquare-elephant-85438
02/27/2025, 11:49 PMarchive target with the wheels that you want:
https://www.pantsbuild.org/stable/docs/using-pants/assets-and-archives#archive-create-a-zip-or-tar-filebroad-processor-92400
03/04/2025, 2:48 AMpants export --py-editable-in-resolve=... --resolve=... might be a good way to handle that: https://www.pantsbuild.org/stable/reference/goals/export#py_editable_in_resolve
Also, I'm not 100% sure of this, but potentially there's pants-level dependencies between targets, in which case something like pants dependencies src/AAA | xargs pants list --filter-target-type=python_distribution | xargs pants package might work? That is designed to find everything AAA depends on, filter to just the python_distributions and then package those.