• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

pantsbuild / pants / 24699019654

21 Apr 2026 01:19AM UTC coverage: 92.924% (+0.001%) from 92.923%
24699019654

push

github

web-flow
Fix use of generic target in runtime package dependencies (Cherry-pick of #23248) (#23276)

## What

Fixes the following setup:

```py
# BUILD
pex_binary(name='bin_a', entry_point='main_a.py')
pex_binary(name='bin_b', entry_point='main_b.py')
target(name='all_bins', dependencies=[':bin_a', ':bin_b'])
python_test(name="tests", runtime_package_dependencies=[":all_bins"])
```

Previously the PEX dependencies would not get packaged and materialized
when the tests were run.

## Why

Allows a `target()` alias to be used in `runtime_package_dependencies`
to group packageable targets, rather than having to list each one
individually. This would help simplify a setup I have where I have the
misfortune of having to write a loop to generate a list of targets:

```py
# BUILD
for model in models:
  docker_image(name=model.name)

target(name="models", dependencies=[model.name for model in models])
```

Using the generic target I can isolate this mess to the one relevant
directory and keep the rest of the codebase clear.

## Test plan

- [x] New test added to cover the scenario

## Open questions

- Is this the kind of thing we would add to the release notes? Or is it
a bit niche?
- Is this the most reliable way to implement this? I was surprised to
find that generic target isn't modeled as a `TargetGenerator` would that
be a more robust fix? (sounds like it would be a much more invasive
change)
- I _think_ this issue affects the `archive` target too. Shall I
investigate that in this PR? Or keep it small and investigate
separately?

Co-authored-by: Ryan Loader <talk@ryanloader.me>

91686 of 98668 relevant lines covered (92.92%)

4.04 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

95.6
/src/python/pants/core/goals/test_test.py


Source Not Available

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc