one of the most confusing (as a python beginner to...
# general
f
one of the most confusing (as a python beginner too) aspect of trying to grok pants is how the mixin/dependency injection works, and knowing what i can “request” in the conrext of writing a goal/rule — are there any (heh…), uhm — rules around that behaviour? how do i set myself up for success as a first time pants plugin developer?
w
yea, that definitely takes some getting used to.
the actual extension points for plugins are `@union`s: so if you want to write a plugin, you’ll generally be implementing a member of a
@union
: https://www.pantsbuild.org/docs/rules-api-unions
(not “creating a `@union`”: just “implementing a `@union`”)
f
🤔 — yeah, i’ve been reading most of thr conceptual parts of the docs — but probably takes a couple of good thorough reads before just getting 10% of it to stick 😂
thanks for the pointers
b
It would be really useful to raise your initial questions from reading it, rather than just trying to sort it out alone. Hearing how a novice interprets it, and what would benefit from further clarification, can help the team improve that doc for you and everyone else too,
c
Also, for discoverability, the cli help has rather comprehensive information about the various rules and api types as well.
Example:
Copy code
╰─❯ ./pants help SyntheticTargetsRequest

`pants.engine.internals.synthetic_targets.SyntheticTargetsRequest` api type
---------------------------------------------------------------------------

Union members of the `SyntheticTargetsRequest` should implement a rule returning an instance
of a `SyntheticAddressMaps`.

activated by : pants.engine.internals.synthetic_targets
union members: PythonSyntheticLockfileTargetsRequest

Include API types and rules dependency information by running `./pants help-advanced pants.engine.internals.synthetic_targets.SyntheticTargetsRequest`.
and
./pants help api-types
gives a long list of stuff.. 😛
h
Yeah the API is very powerful, but with great power comes great inscrutability, at the moment… We want to write more docs/guides/examples for this, when we have the time and resources
Sorry it’s been a grind
w
@curved-television-6568: ah, yea! those are great. i’m not sure that the docs mention them
c
you’re right, we’ve likely overlooked that part 😅
w
thanks for adding that.
🙏 1
b
If that's not in the docs, would someone please open a ticket to add it? That's a heck of a tip.
It'd also make a nice blog post, if anyone is interested in promoting that tip further.