Synthetic targets API #17253
kaos
started this conversation in
Development
Replies: 2 comments 2 replies
-
Specifically, the targets I wanna generate stem from https://blog.pantsbuild.org/optimizing-python-docker-deploys-using-pants/ (so generate a handful of PEXs and Docker images) |
Beta Was this translation helpful? Give feedback.
1 reply
-
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
This is a post-fact kind of discussion, as the PR has already landed #16998.
Design doc: https://docs.google.com/document/d/1PPnXzUedm5mpPVuUdEm7WJppyiECHn28jIWOdp_uO3E/edit?usp=sharing
My motivation for this feature, as spelled out in #16979 was to address the desire to track changes to lockfiles in order to rebuild targets that depend on them rather than on changes to the requirements file, as there may not be a 1-to-1 mapping between requirements and lockfiles due to multiple resolves.
Another aspect of this is a slight shift nudging in the direction of a possible future having fewer targets explicitly declared in BUILD files as placeholders (that is, empty targets with no added configuration such as you get with
tailor
on a Python source tree sprinkling BUILD files withpython_sources()
in them..)@thejcannon have two questions to address in particular:
For 1) I don't see the synthetic targets affecting this scenario at all as it stands today. It could potentially evolve in that direction somehow, let's have a thread in Slack about that.
pants/src/python/pants/backend/python/goals/lockfile.py
Lines 278 to 305 in 085e892
There are two primary modes of operation to populate the build graph with synthetic targets. A) if you know all your targets up-front without having to look for files in the project source tree you can get a single request and return all your targets with a single response, or for all other cases B) you get a request for each directory where a BUILD file is being parsed so there is a opportunity to add any synthetic targets that should live in that directory (presented as declared in a dedicated BUILD file for the plugin)
pants/src/python/pants/backend/python/goals/lockfile.py
Line 297 in 085e892
The synthetic targets are loaded by the "parse address family" rule, so works the same for both BUILD file discovery as well as looking up a
TargetAdaptor
from anAddress
.Beta Was this translation helpful? Give feedback.
All reactions