-
-
Notifications
You must be signed in to change notification settings - Fork 607
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
What target modeling changes to land in Pants 2.8? #13160
Comments
Works for me. Thanks for writing this up.
The fact that |
Agreed that that is a super awkward edge, possibly enough to be a bug. Thanks for your comments on #13086 - I'm going to focus for now on what I proposed in Pants 2.8 because it is unblocked by everything else, and then will spend more time thinking about What Remains... |
I revised the plan for 2.8 to distinguish between renaming target types we already expose ( I think it makes sense to do the renames of existing symbols no matter what, as they are more descriptive (people get confused what "library" means) and it prepares us for introducing the new targets. But I want to take more caution with the new target types, as it means users will be able to explicitly declare them in BUILD files. I want to make sure we have the modeling of those file-based targets right before we do this. For example, I feel fairly convinced that it should be |
I had a productive weekend :) Status update: Newly finished
Remaining
|
The target generator proposal kicked off a slew of changes and new questions. This ticket tries to catalog Where We're At and Where We Should Go.
What has already landed
Much of the target generator proposal has been implemented:
dir:generator#generated
address syntax #12891, although the generated address syntax is only used by Go and Terraform, and it's still subject to changefiles
andresources
targets to not pull in sibling files #12941_go_internal_package
complaining about missing.s
files #13145)./pants dependencies --transitive
when run on a target generator likepython_library
#12956java_source
) vs. "generator" target (java_sources
), although Shell and Protobuf are purely internal refactors for now.What I suggest for Pants 2.8
Finish most of the original target generator proposal, but punt on any changes to project introspection.
files
,resources
,python_tests
, andpython_library
. Plan to internally splitpython_library
into two targets without user API changes #12954python_requirement_library
->python_requirement
python_library
->python_sources
protobuf_library
->protobuf_sources
shell_library
->shell_sources
source: str
field to complementsources: list[str]
.shell_source
shunit2_test
python_source
python_test
file
resource
protobuf_source
overrides
field for file-based target generators likepython_tests
. This is a splashy new feature with tangible benefits in boilerplate reduction../pants mend
to automate fixing this all.Why do these now?
These changes can wait if I can't finish them in time—they're not blocking.
However, I'd like to try to land them because they clean up the conceptual space of "file targets" without changing any current semantics. The only deprecation is needing to run our migration script
rename_target_types_pants28.py
. We already have file targets, which are confusing and under-documented, both for users and for plugin authors. These changes give us the benefits of the target generator proposal right away.I'd like to land the
overrides
field because it is an easy win to make a big dent in boilerplate and to give an alternative to the confusing semantics of how splitting out a new target currently requires excluding thesources
from its previous owner.We still have a lot of upcoming changes—landing these changes in Pants 2.8 will make those subsequent changes easier to adapt to. We're amortizing the deprecations.
What remains
python_requirements
with target generators. Deprecation plan for macros (python_requirements
andpoetry_requirements
) becoming targets with addresses #12915name
left off Remove badname=
default for targets #12286name
to be always set../pants peek
to include generated targets: [wip] Stop removing target generators from project introspection like./pants list ::
#12952 and./pants list ::
now includes generated targets #12951UnexpandedTargets
#13086The text was updated successfully, but these errors were encountered: