FYI plugin authors with custom target types: 1.30....
# general
h
FYI plugin authors with custom target types: 1.30.0 will require writing light weight bindings for the new Target API. See https://groups.google.com/forum/#!topic/pants-devel/WsRFODRLVZI for more context. As mentioned there, we would be happy to help you do write these bindings!
đŸ‘©đŸœâ€đŸ« 1
a
none of the documentation linked from that post contain the word "bindings"; are the docs up-to-date?
h
Hey Wyatt, yes, they are. Slightly confusing because the docs take the perspective of using entirely V2, ie not having V1 custom targets already. The concepts page is a brief FYI on how the target api works. You can skim it. Most of the work is are on the “Creating new fields” page. That’s 80% of what’s involved. Then finally “creating new targets” (Btw, you’ll want to be on 1.28.0 or newer)
w
@astonishing-jelly-60479: bindings are mentioned at the bottom of https://pants.readme.io/docs/target-api-new-targets
but i’ll respond to the thread to point that out
h
@witty-crayon-22786 those are bindings in the reverse direction, when you wrote a V2 target and plan to use that in your plugin, but need a V1 binding for V1 goals to still work.
w
well then i am also confused 😃
h
* No matter what, you need a V2 target definition so that Pants can parse your target when running in V2 mode. Even if you’re not yet using V2 Python, we are switch several core goals like
list
to run with V2. * Unless you are completely V2, you will need a V1 Target definition so that Pants can parse the target when running in V1 mode. If your plugin is written in V2, then the V1 binding can be a dummy binding just so that Pants can parse things.
w
yep, fine. but is it a “different type” of binding, or is that same type of binding that is described on the linked page?
h
The bulk of the new docs talk about how to write a V2 target definition. That one small part you linked to is about writing the V1 target definition.
For current users, they do not need to write the V1 target definition. They already have that. They need to write a V2 definition using the Target API.
It’s confusing in part because “binding” is used twice, and it depends on your perspective which is the “binding” vs. the canonical implementation. Maybe a clearer explanation is “you need a target definition with both the V1 and V2 APIs (unless you are exclusively using V2)”
Okay, wrote some instructions specifically for bindings. Also going to write a Gist showing a full example. Sorry for the confusion @astonishing-jelly-60479! @witty-crayon-22786 if you have a moment, feedback appreciated on the new instructions: https://pants.readme.io/docs/target-api-concepts